Jump to content
Alias001

Disabling an object's inventory

Recommended Posts

I'm making an old fashioned "blow up the weapons cache" style mission and I've got something like 20 crates the players can blow up but every time you go near one of the boxes, it offers to let you mooch through and see if there's anything you want to steal which feels like bad security if nothing else.

I can remove the stuff that's in the crates but it's a less than ideal solution since it'd feel like you were blowing up empty boxes. Is there any way to remove the option of seeing the inventory at all essentially making them nothing but static objects (which can still be destroyed)?

Share this post


Link to post
Share on other sites

"Put" / "Take" eventhandler

check if the container is the target cache, then "closeDialog 602".

Share this post


Link to post
Share on other sites

Hmm, by the look of the descriptions of the put & take eventhandlers, they appear to only fire when the unit actually alters the inventory of the object. Assuming closedialog 602 is closing the inventory, wouldn't that let someone pick up a medkit or whatever but then immediately & automatically close the inventory after it was done?

Share this post


Link to post
Share on other sites

while { true } do
{
   _gear = findDisplay 602;
   if (!isNull _gear) then
   {
       closeDialog 602;
   };

   sleep 0.1;
};

Though, keep in mind that this will prevent the inventory all together.

I'll try to work out something.

EDIT: Okay, I couldn't find neither a command to detect when the inventory opens nor a variable containing the object the inventory is open for, so I made this script that blocks the inventory completely, but only when close to specific objects. Simply put all the ammo boxes you wanna block the inventory for in the BlockInventoryObjects array, instead of ammo_crate1.

disableSerialization;
_blockInventoryObjects = [ammo_crate1];
while { true } do
{
   _blockInventory = false;
   {
       _distance = player distance _x;
       if (_distance < 2) exitWith { _blockInventory = true };
   } forEach _blockInventoryObjects;

   if (_blockInventory) then
   {
       _gear = findDisplay 602;
       if (!isNull _gear) then
       {
           closeDialog 602;
       };
   };

   sleep 0.1;
};

Edited by MulleDK19

Share this post


Link to post
Share on other sites

So I'd make that an .sqf and put it in the init of all the units I want to not allow inventory actions for? I'll give that a go in the morning, cheers mate.

The weird thing is that the latest patch seems to have changed enablesimulation false to block people from interacting with the inventory contents (unless it was something weird I did in the mission I was making) but still displays whats in it, kind of like letting you look at shiny things through the windows of a shop that will never open...

Share this post


Link to post
Share on other sites
So I'd make that an .sqf and put it in the init of all the units I want to not allow inventory actions for? I'll give that a go in the morning, cheers mate.

No, you run that script once. You put the names of all the units in the _blockInventoryObjects array instead of ammo_crate1. So if you have ammo1, ammo2 and ammo3 you change the line to

_blockInventoryObjects  = [ammo1, ammo2, ammo3];

Share this post


Link to post
Share on other sites

I've used a variation of this in the past to block the dialog in A2 which is why the object types are incorrect.

disables all ammo boxes and car invertory, you can add more types.

while {true} do {
waituntil {dialog and (cursorTarget iskindof "reammobox"  or cursorTarget iskindof "car"  )};
closeDialog 106;
sleep 0.1;
};

specific types of object

_type=["UNBasicWeapons_EP1","USBasicAmmunitionBox"];
while {true} do {
waituntil {dialog and (typeof cursorTarget  in _type )};
closeDialog 106;
sleep 0.1;
};

Much the same as MulleDK19 is doing.

_type=["ambox1","ambox2"];
while {true} do {
waituntil {dialog and (cursorTarget  in _type )};
closeDialog 106;
sleep 0.1;
};

Share this post


Link to post
Share on other sites

I just found a simple solution using https://community.bistudio.com/wiki/lockInventory

A lot of items are "vehicle" in Arma.

 

vehicle this lockInventory true; 

I don't know why but it does not work with that line only but if you add a custom addAction interaction it works:

this addaction ["Replaced action.",{ 
(_this select 1) action ["None", _objectWithInventory]
},[], 6, true, true, "", "(_this distance _target)<2"];
vehicle player lockInventory true; 

 

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

×