Hey I'm trying to make an AI fire his weapon on full auto/single etc using a radio trigger using this command
https://community.bistudio.com/wiki/forceWeaponFire
My AI is AFF autogunner called
S1
This is my code in the OnAct box in the radio trigger alpha
S1 forceWeaponFire [LMG_Mk200_pointer_F, FullAuto];
All seems correct yet nothing happens and the AI wont fire, RPT says :
Could someone correct this for me.
Regards
Bp
I just tried this and it works. I placed a player unit and an AI machinegunner named dude in the editor. Then from the debug console I execute this code and he fires full auto with short pauses between bursts. Unit needs to be in behaviour COMBAT, or he shots into the ground.
dude setbehaviour "COMBAT";
_logic = createGroup west createUnit ["Logic", [0,0,0], [], 0, "NONE"];
_n = [dude, _logic] spawn
{
params["_dude","_logic"];
sleep 1; // give unit time to raise his weapon in combat mode
{
_logic action ["useWeapon", dude, dude, 2]; // 2 is burst mode
sleep .3;
} foreach [1,1,1,1,1,1,1,1,1,1,1,1];
};
You probably want to use a while loop instead of a foreach loop. I was just being lazy in my loop selection for a quick example. You may also want to have other conditions liking pausing loop during reload, some way to terminate loop when some condition is met (time elapsed, player commands to stop via addaction, or whatever).