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;
}];