bigpickle 0 Posted February 25, 2014 (edited) 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 : Error in expression <S1 forceWeaponFire [LMG_Mk200_pointer_F, Fu> Error position: <forceWeaponFire [LMG_Mk200_pointer_F, Fu> Error Type Any, expected String Could someone correct this for me. Regards Bp Edited February 25, 2014 by Bigpickle Share this post Link to post Share on other sites
Tankbuster 1747 Posted February 25, 2014 Both the weapon classname and the firemode have to be strings. They need to be in speechmarks. Share this post Link to post Share on other sites
bigpickle 0 Posted February 25, 2014 ok I made it like this: S1 forceWeaponFire ["LMG_Mk200_pointer_F", "FullAuto"]; But nothing happens and rpt is clear this time with no errors :o Share this post Link to post Share on other sites
Tankbuster 1747 Posted February 25, 2014 Was the command issued locally to the unit? that command has to be run locally. Try the fire command too, though bear in mind, that command has local effect only, as well. ---------- Post added at 13:37 ---------- Previous post was at 13:34 ---------- Try fireAtTarget as well. The biki seems to suggest that command might not have to be local to the unit, though it doesn't say it explicitly. https://community.bistudio.com/wiki/fireAtTarget Share this post Link to post Share on other sites
bigpickle 0 Posted February 25, 2014 (edited) I get a bit confused between local and global sorry. I put my ai on the map and gave him name of S1. put down a trigger sat it to radio alpha, repeatedly and detected by Blufor. I then put this into On Act. S1 forceWeaponFire ["LMG_Mk200_pointer_F", "FullAuto"]; That's all i did, oh yeah the AI has that correct weapon too, is that not local? Just Tried Fire instead using below in On Act. S1 fire ["LMG_Mk200_pointer_F", "FullAuto"]; Same deal, no firing and no rpt error :( Edited February 25, 2014 by Bigpickle Share this post Link to post Share on other sites
Tankbuster 1747 Posted February 25, 2014 The problem might lie in your trigger. You wouldn't do radio alpha AND detectedby blufor. Remove the detected by condition from the script. If you are doing this in editor preview, the locality shouldn't be a problem as all the units are on the one machine. ---------- Post added at 13:49 ---------- Previous post was at 13:46 ---------- Confusingly, people are updating the biki page for fire right now. :) Thanks guys. hehe https://community.bistudio.com/wiki?title=fire&curid=4638&action=history Share this post Link to post Share on other sites
bigpickle 0 Posted February 25, 2014 Yeah I've tried setting trigger to present but same as before. Beginning to think those commands may be problematic. Share this post Link to post Share on other sites
cobra4v320 27 Posted February 25, 2014 [] spawn { soldier doTarget truck; sleep 5; while {true} do {sleep 0.01; soldier forceWeaponFire ["arifle_MX_F", "fullauto"];};}; I did the code above in the debug console worked fine. If you do it without the sleep 0.01 it will crash your game. Share this post Link to post Share on other sites
MulleDK19 21 Posted February 25, 2014 "FullAuto" is not a valid fire mode for that weapon. For that specific weapon, the valid firemodes are: "manual", "close", "short", "medium", "far_optic1" and "far_optic2". Share this post Link to post Share on other sites
PartyHead 10 Posted February 25, 2014 Haven't tried this myself but would using suppressFor maybe work. S1 suppressFor 10; Share this post Link to post Share on other sites
bigpickle 0 Posted February 25, 2014 (edited) "FullAuto" is not a valid fire mode for that weapon.For that specific weapon, the valid firemodes are: "manual", "close", "short", "medium", "far_optic1" and "far_optic2". Thanks mate. *Edit* Ok with that in mind can that be put into a radio trigger? I tried to put it straight in and got an error, so i put this: S1 doTarget truck; sleep 5; while {true} do {sleep 0.01; S1 forceWeaponFire ["LMG_Mk200_pointer_F", "manual"];}; but he fired 1 shot at the floor :p I appreciate baby walking me through this guys. Edited February 25, 2014 by Bigpickle Share this post Link to post Share on other sites
Tankbuster 1747 Posted February 25, 2014 "FullAuto" is not a valid fire mode for that weapon.For that specific weapon, the valid firemodes are: "manual", "close", "short", "medium", "far_optic1" and "far_optic2". Well spotted! Share this post Link to post Share on other sites
AlexMercerIV 4 Posted April 2, 2019 Is it possible to force bots to shoot with automatic fire or bursts (at a distance of more than 200-300m)? Share this post Link to post Share on other sites
johnnyboy 3797 Posted April 2, 2019 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). 1 Share this post Link to post Share on other sites