Place an AI in editor. Set its var name to "AI". Also, place an enemy unit in front of him. Name him "aiTarget".
Run this sample code in debug console:
```
[] spawn {
_lastDir = 0;
aiTarget disableAI "ALL";
ai setSkill 1;
ai disableAI "MOVE";
ai doWatch aiTarget;
ai doTarget aiTarget;
aiTarget allowDamage false;
_time = time+3;
waitUntil {
ai playMoveNow (["amovpercmtacsraswrfldl", "amovpercmtacsraswrfldr"] select _lastDir);
ai forceWeaponFire [currentWeapon ai, currentWeaponMode ai];
ai reveal aiTarget;
if (time - _time > 3) then {
_time = time;
aiTarget attachTo [ai, [0, 5, ([2, 5] select _lastDir)]];
};
_lastDir = 1 - _lastDir;
ai setAmmo [currentWeapon ai, 10];
sleep 0.3;
false
}
};
```
This will make the AI constantly shoot at the target while playing an animation in a loop.