Jump to content
Lineman

Force AI to equip item from their backpack?

Recommended Posts

For example: AI has sawn-off shotgun in backpack. What would I place in a trigger's On Activation to equip the shotgun?

Share this post


Link to post
Share on other sites

something like this maybe (untested):
 

if ( "BAF_L85A2_RIS_SUSAT" in backpackItems Your_AI)then {
Your_AI addMagazine "30Rnd_556x45_Stanag";
Your_AI addWeapon "BAF_L85A2_RIS_SUSAT";
Your_AI removeItemFromBackpack "BAF_L85A2_RIS_SUSAT";
};

change classes names as needed

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
4 hours ago, Mr H. said:

something like this maybe (untested):
 


if ( "BAF_L85A2_RIS_SUSAT" in backpackItems Your_AI)then {
Your_AI addMagazine "30Rnd_556x45_Stanag";
Your_AI addWeapon "BAF_L85A2_RIS_SUSAT";
Your_AI removeItemFromBackpack "BAF_L85A2_RIS_SUSAT";
};

change classes names as needed

 

Another solution would be this:

_AI action ["TakeWeapon",backpackContainer _AI,"hgun_P07_F"];

If the AI has a P07 in the backpack he will first play some default "take" action and then equip the pistol, if currently no other gun has been equipped.

 

Cheers

  • Like 3

Share this post


Link to post
Share on other sites

yep @Grumpy Old Man's solution is actually way better than mine ^^ use his solution instead

  • Like 1

Share this post


Link to post
Share on other sites
On 21/08/2018 at 10:06 AM, Mr H. said:

something like this maybe (untested):
 


if ( "BAF_L85A2_RIS_SUSAT" in backpackItems Your_AI)then {
Your_AI addMagazine "30Rnd_556x45_Stanag";
Your_AI addWeapon "BAF_L85A2_RIS_SUSAT";
Your_AI removeItemFromBackpack "BAF_L85A2_RIS_SUSAT";
};

change classes names as needed

 

On 21/08/2018 at 3:12 PM, Grumpy Old Man said:

 

Another solution would be this:


_AI action ["TakeWeapon",backpackContainer _AI,"hgun_P07_F"];

If the AI has a P07 in the backpack he will first play some default "take" action and then equip the pistol, if currently no other gun has been equipped.

 

Cheers

Thank you both!

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

×