Jump to content
Lineman

Force AI to switch to equipped launcher?

Recommended Posts

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

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

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

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
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

Victory?

Vp2nYbv.jpg

  • Haha 1

Share this post


Link to post
Share on other sites

AI still actually fires though. lmao

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×