Jump to content
Sign in to follow this  
Twiznak

[Solved] How to check if a player has an explosive in their inventory?

Recommended Posts

Hi, it's me again! I want to know how to check to see if a player has an explosive satchel in their inventory as part of a set of conditions that must be satisfied for an addAction. hasWeapon works for primary, secondary and launchers. The notes at the bottom of the page by Benagree 

"ItemGPS" in (items player + assignedItems player)
OR
'ItemGPS' in (items player + assignedItems player) 

works for all items. But for the life of me I can't find any documentation for how to do this for explosives. As a matter of fact the ONLY mention of this is on the BIwiki items page and a note by Druid

Quote

Arma 3, version 0.70 - magazines, explosives, grenades and all items currently linked on the unit are not returned now.

Would someone who is in the know please share with me the command and syntax that will do this for explosives? Thank you.

Share this post


Link to post
Share on other sites

There's magazinesmagazinesDetailuniform/vest/backpackItems and uniform/vest/backpackMagazines. Try whichever one of those suits best.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

This will work fine in singleplayer:

this && "SatchelCharge_Remote_Mag" in magazines player

as long as the player meets the triggers Activation rules. MP is a little trickier.

  • Like 1

Share this post


Link to post
Share on other sites
26 minutes ago, beno_83au said:

There's magazinesmagazinesDetailuniform/vest/backpackItems and uniform/vest/backpackMagazines. Try whichever one of those suits best.

Thank you beno_83au. These are the wiki pages I should have been looking harder at.

22 minutes ago, Harzach said:

This will work fine in singleplayer:


this && "SatchelCharge_Remote_Mag" in magazines player

as long as the player meets the triggers Activation rules. MP is a little trickier.

Thank you Harzach! This is the answer.I was way off. I wasn't even using the right classname for the satchel charge. I copied classname from the editor and it was "SatchelCharge_F". 

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, Twiznak said:

These are the wiki pages I should have been looking harder at.

 

Haha, all good. I remember spending lots of time just browsing through the commands back in OFP days, and there wasn't as many as there is now so it was a bit easier.

  • Like 3

Share this post


Link to post
Share on other sites

Yup, usually worth it to do a keyword search on the scripting command page (and don't forget the BIS functions page!)


Bookmark 'em:
https://community.bistudio.com/wiki/Category:Scripting_Commands

https://community.bistudio.com/wiki/Category:Arma_3:_Functions

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers

 

My "solution" is rather simplistic, so if you want to filter for a certain number of objects, or carried by a specific unit/vehicle, mp compatibility, etc. - you'll have to get your hands dirty. 

 

copyToClipboard str magazines this

Run on any unit/ vehicle to get all magazine classnames it has in its inventory. 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, Twiznak said:

Hi, it's me again! I want to know how to check to see if a player has an explosive satchel in their inventory as part of a set of conditions that must be satisfied for an addAction. hasWeapon works for primary, secondary and launchers. The notes at the bottom of the page by Benagree 


"ItemGPS" in (items player + assignedItems player)
OR
'ItemGPS' in (items player + assignedItems player) 

works for all items. But for the life of me I can't find any documentation for how to do this for explosives. As a matter of fact the ONLY mention of this is on the BIwiki items page and a note by Druid

Would someone who is in the know please share with me the command and syntax that will do this for explosives? Thank you.

Forgive me if I get it wrong, as English is not my native language and I use the web translator to communicate.

If you are looking for a condition that checks whether the player has an item in his inventory, you can use the "BIS_fnc_hasItem" function, from which he verifies that the assigned item is with the character.

 

[player, "SatchelCharge_Remote_Mag"] call BIS_fnc_hasItem;

 

https://community.bistudio.com/wiki/BIS_fnc_hasItem

  • Like 1
  • Thanks 1

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
Sign in to follow this  

×