OFPEC Forum
Addons & Mods Depot => Arma2 - Configs & Scripting => Topic started by: DMarkwick on 05 Sep 2009, 20:09:50
-
OK, so in my Fire & Smoke addon, I'm implementing a maximum concurrent fires limit. Lets say that limit is 100, starting from 0, and that the variable I'll use will be called JTD_CurrentFires. The addon itself is driven by eventhandlers, so there is no single-run script where I can initialise global variables.
(If anyone knows how I CAN run an initialisation script from a config, that will be the best method BTW.)
So, how DO I initialise a global variable in this case? In the config I've tried:
JTD_CurrentFires = 0; but that doesn't seem to work on its own, and so in the script I've tried:
JTD_CurrentFires = getNumber(configFile >> "JTD_FireTrees");but all that does is set the number back to 0 every time, as you would expect :)
?
-
if (isNil "JTD_CurrentFires") then {JTD_CurrentFires = getNumber(configFile >> "JTD_FireTrees")};
Should initialize JTD_CurrentFires in the script (once). Then just add and remove from that number as you desire, I guess!
Wolfrug out.
-
Thanks :)