I run a script which adds insignias to players based on inhouse factions within our clan.
That all works fine, player has both Xml and insignia... until they use the Virtual Arsenal to get a new uniform.
When a uniform is added to the player from the Arsenal the insignias get removed but the Xmls stay.
We use a whitelist Virtual Arsenal.
Anyone know of a work around for this ?
Thanks in advance.
BL1P.
There are likely lots of ways you can accomplish this BL1P.
Using the uiNameSpace variable BIS_fnc_arsenal_cam will tell you whether the arsenal is open or not, its objNulll if its not open.
How to check for this could also be written slightly differently dependent on how/where your calling the arsenal in the first place e.g from an ammo box, player action or from inventoryOpened.
Heres some code from a quick test. It checks via an onEachFrame, its stacked ID is added to the player in a variable called "VAcatch" just incase you maybe want to turn the stacked event off (no sense checking for arsenal ever frame if the only place you can use it is while your back at base). It also checks to see if the player has changed their uniform and reapplies their insignia. Not thoroughly checked but should give you something to go from..
player setVariable [ "VAcatch", [ "VAcatch", "onEachFrame", {
if ( !( isNil { _this getVariable "VAcatch" } ) && { !( isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] ) ) } ) then {
_this setVariable [ "VAcatch", nil ];
_thread = _this spawn {
_uniform = uniform _this;
waitUntil { isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] ) };
_faction = _this getVariable [ "Faction", nil ];
if ( _uniform != uniform _this && { !( isNil "_faction" ) } ) then {
[ _this, _faction ] call BIS_fnc_setUnitInsignia;
};
_this setVariable [ "VAcatch", "VAcatch" ];
};
};
}, player ] call BIS_fnc_addStackedEventHandler ];
As i said above there are likely better ways to implement this based on what you actually need but the above serves as a catch all example.