Jump to content
Asmodeuz

Prevent players from opening/accessing/manipulating with AI unit's inventory

Recommended Posts

Human players can access individual AI soldier's inventory when they are the acting squad leader for a squad filled with AI soldiers. Acessing the inventory can be done from the Action menu by selecting menu number 6 ("Action") and from there selecting Open subordinate's inventory

 

Also already thinking past that human squad leader can also give an "inventory command" which makes the selected AI to approach some container and after reaching the container the AI's inventory dialog will open where the player can then freely transfer items between the AI's inventory and the container.

 

Might there be some way to prevent players from opening, accessing or manipulating AI's inventory in aforementioned ways?

Share this post


Link to post
Share on other sites

The power of the search.

https://forums.bohemia.net/forums/topic/215211-disable-the-option-for-opening-the-backpacks-of-others-inventory-when-they-are-alive/?tab=comments#comment-3305875

This may not be directly what you want. I assume people are abusing the AI command to take their loadout? Modify this if it isn't exactly what you need.

Check out:

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

  • Like 1

Share this post


Link to post
Share on other sites

Strange thing is that so far I have for whatever reason completely overlooked the possibility of even using InventoryOpened event handler and instead I've been on a seemingly hopeless search throughout the internet and especially BI forums for a one-stop solution.

 

Yes, the expectation is that players will abuse the current system by getting their gear from the AI since it will be "cheaper" that way.


For sure I'm all for using event handlers and already got two InventoryOpened ones going: the one from the discussion you posted there HazJ and this one from the Disable looting gear from corpses discussion.

 

What one would have to include in such EH to select the correct target? Is there a common denominator that can tackle both opening the subordinate's inventory and using the inventory command which essentially makes the AI subordinate open its inventory close to a container?

  • Like 1

Share this post


Link to post
Share on other sites

By using  inGameUISetEventHandler it seems to be possible to disable actions from the user action menu.

For example selecting the action to disassemble a weapon can be disabled as described in the aforementioned EH's example 3:

Spoiler

 

//Insert the below script for example in the player's Init-field


inGameUISetEventHandler ["Action", " if (_this select 3 == 'DisAssemble') then { hint 'You are not allowed to do this'; true } "];

 

And just by changing _this select 3 == 'DisAssemble' to _this select 3 == 'Gear' the action to open a container's inventory using the action Inventory can be disabled.

In CfgActions (where one can find the aforementioned Gear and DisAssemble actions among others) there's also GearOpen action and it has the following description: "Open subordinate's inventory". Apparently this should be the user action that governs opening AI subordinates inventory.

Now, if I place that action name like so

inGameUISetEventHandler ["Action", " if (_this select 3 == 'GearOpen') then { hint 'You are not allowed to do this'; true } "];

I can still use the action "Open subordinate's inventory" to access any subordinate AI's inventory. What gives?

Share this post


Link to post
Share on other sites

This prevents players from accessing an AI's backpack.

 

inGameUISetEventHandler ["Action", " if (_this select 3 == 'OpenBag') then { hint 'You are not allowed to do this'; true } "];

 

  • Like 3
  • Thanks 2

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

×