Lineman 3 Posted August 28, 2018 Trying to have a soldier called AA_01 unholster/switch to a rocket launcher that's on his back. He isn't carrying a primary weapon or sidearm. Tried these in unit init and init.sqf: AA_01 action ["SwitchWeapon", AA_01, AA_01, x]; /// x = numbers I tried from 0 to 16 AA_01 action ["useWeapon", AA_01, AA_01, x]; AA_01 selectWeapon "CUP_LAUNCH_IGLA"; Found this but I don't understand what to do with the info given: https://forums.bohemia.net/forums/topic/181067-how-to-find-weapon-index/ Share this post Link to post Share on other sites
7erra 629 Posted August 28, 2018 Put this into the unit's init: this spawn { waitUntil {time > 1}; _index = 0; _unit = _this; _weapon = secondaryWeapon _unit; _vehicle = vehicle _unit; _unit action ["SwitchWeapon", _vehicle, _vehicle, _index]; while {(currentWeapon _unit) != _weapon} do { _index = _index + 1; _unit action ["SwitchWeapon", _vehicle, _vehicle, _index]; }; systemchat str _index; }; Original code from @Schatten 2 1 Share this post Link to post Share on other sites
kebman 2 Posted December 18, 2018 Didn't work. I get the following error: Init: Type Script, expected Nothing Share this post Link to post Share on other sites
HazJ 1289 Posted December 18, 2018 WHY IS THIS NOT WORKING?!?!?! God damn it SQF! _unit selectWeapon (secondaryWeapon _unit); SwitchWeapon does not work either. Share this post Link to post Share on other sites
pierremgi 4850 Posted December 18, 2018 6 minutes ago, HazJ said: WHY IS THIS NOT WORKING?!?!?! God damn it SQF! _unit selectWeapon (secondaryWeapon _unit); SwitchWeapon does not work either. Because it works for "one frame" or something like that, then arma's engine override your poor attempt to do something clever. You can remove all other weapons, not sure that helps. In Arma context, AIs means no brain at all, Player means little pea, scripter means near miss brained. Share this post Link to post Share on other sites
pierremgi 4850 Posted December 18, 2018 Yeah! Now, you can work for firing something with that. 1 Share this post Link to post Share on other sites
HazJ 1289 Posted December 18, 2018 AI still actually fires though. lmao Share this post Link to post Share on other sites