Jump to content

Recommended Posts

Hello all!

 

I am a moderate beginner with Arma 3 scripting. I have a script that is used with the Survival mod (waves of enemies where you are required to loot bodies in order to find weapons, ammo, and FAKs). One of the problems that our group has is knowing which bodies have been looted or not (in the end, there are hundreds on the field).

 

I am using an InventoryClosed (Script 1)event handler to change the color or remove the uniform (doesn't matter which behavior) after a player has closed the dead body's inventory.

 

The problem that I'm having is that two of the three ways of opening an inventory (scrolling to the action and activating it, or pressing "I" when in range) work just fine. But if the player presses "Use" when the inventory icon is up on the screen, the inventory opens and closes immediately. They can go back into the Inventory after that and loot, but it's an odd experience.

 

I tried switching to InventoryOpened (Script 2), and the behavior now pressing "I" or pressing "Use", and sometimes supports scrolling to "Inventory" action (but sometimes closes the inventory immediately in that case). It seems like an Arma 3 scripting bug to me.

 

Any ideas about what I can try to prevent that weird behavior? Here are the scripts (I placed them in initPlayerLocal.sqf).

 

Script 1:

player addEventHandler ["InventoryClosed", {
	params ["_unit", "_container"];
	
	if (_container isKindOf "Man") then 
	{
	    _container setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0.61,0.65,0.6)"];
	};
}];

 

Script 2:

player addEventHandler ["InventoryOpened", {
	params ["_unit", "_container"];
	
	if (_container isKindOf "Man") then 
	{
	    _container setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0.61,0.65,0.6)"];
	};
	false;
}];

 

 

 

Share this post


Link to post
Share on other sites

Ah, never mind. Looks like it's a weird bug in Arma 3 that has nothing to do with my script. I deleted the junk out of my debug console - not sure if that was the cause, but it's working now.

 

I'll leave this here for anyone else on the same journey as I am. Enjoy!

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

×