LOzan 10 Posted November 17, 2014 My googling has turned up nothing, so it's time to ask the forums. How do you set an AI unit's fire mode (semi, burst, auto, etc.) through scripting commands? I've got units using Toadie's AK Pack, but the default fire mode is automatic and I need them shooting single-fire. These are trained soldiers, after all. Anybody know the answer? Share this post Link to post Share on other sites
jshock 513 Posted November 17, 2014 Try finding the currentWeaponMode command on the wiki, then take a look at the related commands (i.e. switchWeapon) and see if that does the trick. Share this post Link to post Share on other sites
iceman77 19 Posted November 17, 2014 Hi. Try this. unit init line _nul=this execVM "fireMode.sqf"; fireMode.sqf while {!(isNull _this)} do { waitUntil {!((currentWeaponMode _this) isEqualTo "Single")}; _this action ["SWITCHMAGAZINE", _this, _this, 0]; }; Share this post Link to post Share on other sites
iceman77 19 Posted November 17, 2014 (edited) Alternatively. { if (!(isPlayer _x)) then { _x spawn { while {!(isNull _this)} do { waitUntil {!((currentWeaponMode _this) isEqualTo "Single")}; _this action ["SWITCHMAGAZINE", _this, _this, 0]; }; }; }; } forEach allUnits; Or a bit faster for "_i" from 0 to (count allUnits) - 1 do { if (!(isPlayer (allUnits select _i))) then { (allUnits select _i) spawn { while {!(isNull _this)} do { waitUntil {!((currentWeaponMode _this) isEqualTo "Single")}; _this action ["SWITCHMAGAZINE", _this, _this, 0]; }; }; }; }; Or EH { if (!(isPlayer _x)) then { _x addEventHandler ["fired", { if !(currentWeaponMode (_this select 0) isEqualTo "Single") exitWith { (_this select 0) action ["SWITCHMAGAZINE", (_this select 0), (_this select 0), 0]; }; }]; }; } forEach allUnits; Edited November 17, 2014 by Iceman77 Share this post Link to post Share on other sites
thefinn 3 Posted November 17, 2014 (edited) https://community.bistudio.com/wiki/forceWeaponFire About half way down the page there's an example by Killzone Kid for this... works perfectly. Something to note - many AI mods will override this anyhow because they have set parameters already for when the AI will automatically switch weapon mode - usually defined by distance from target. Edited November 17, 2014 by thefinn Share this post Link to post Share on other sites
iceman77 19 Posted November 17, 2014 (edited) Well it's a good thing someone posted it here! Never knew about that command ;) Though I'd be willing to bet the code behind that command is almost identical to what was posted earlier. Edited November 17, 2014 by Iceman77 Share this post Link to post Share on other sites