Last active
April 19, 2022 15:16
-
-
Save JoramD0/ab3c08e3d4eec612c95aefb2e3df3534 to your computer and use it in GitHub Desktop.
Arma 3 variable storing concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These should be defind on initPlayerLocal or something: | |
GVAR(playerVariables) = createHashMap; | |
GVAR(newData) = false; | |
// Would be called like `["earplugs", [player] call ACEFUNC(hearing,hasEarPlugsIn)] call FUNC(this)` | |
params ["_type", "_data"]; | |
GVAR(playerVariables) set [_type, _data]; | |
GVAR(newData) = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private _input = // Data from Athena | |
{ | |
_x params ["_type", "_data"]; | |
switch (_type) do { | |
case "earplugs": { | |
if _data then { | |
player setVariable ["ACE_hasEarPlugsIn", true, true]; | |
[[true]] call ACEFUNC(hearing,updateVolume); | |
[] call ACEFUNC(hearing,updateHearingProtection); | |
}; | |
}; | |
case "insignia": { | |
[player, _data] call BIS_fnc_setUnitInsignia | |
}; | |
case "medical": { | |
[player, _data] call ACEFUNC(medical,deserializeState); | |
}; | |
} | |
} forEach _input; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
GVAR(newData), | |
{ | |
GVAR(playerVariables) call FUNC(saveToAthena); // Obviously function placeholder | |
GVAR(newData) = false; | |
} | |
] call CBA_fnc_waitUntilAndExecute; // Not sure if possible/how but have this execute max once per second or something? If that is even wanted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Whenver possible have these execute on EH's, if not possible on interval | |
["earplugs", [player] call ACEFUNC(hearing,hasEarPlugsIn)] call FUNC(collect); | |
["insignia", [player] call BIS_fnc_getUnitInsignia] call FUNC(collect); | |
["medical", [player] call ACEFUNC(medical,serializeState)] call FUNC(collect); // Not sure about performance on this one but it could for example be done on `ace_treatmentSucceded` and `ace_unconscious` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment