OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: DMarkwick on 15 Aug 2009, 23:32:28
-
I'm testing a couple of methods for fire propagation, I got one method sort of working but it's pretty flaky. However, for this test I'm trying to maintain an array of all destroyed trees in the mission, and using that to check if the current tree is to be burned.
But, I cannot work out why the code inside the loop will not execute:
if (!(_objID in JTD_FireTrees)) then
{
hint "JTD_FireTrees loop";
nul = [_x] execVM "ForestFireTree.sqf";
JTD_FireTrees = JTD_FireTrees + [_objID];
sleep 5;
};
?
_x being the tree currently being tested. The loop works with the other method (testing for proximity of a custom object) and I'm not getting errors in the rpt. _objID definitely exists, 'cos I hint it just before the loop. JTD_FireTrees is initialised in the config like this:
JTD_FireTrees[] = {};
and yet the loop never executes. I never see the inner hint.
JTD_FireTrees is an array that all destroyed trees will go in, and objID is the ID number of the currently tested tree.
-
Weird.
Cant test the script outside of the addon, with an initialization of JTD_FireTrees = [];
-
I don't have the addon or know how to edit config.
but placing JTD_FireTrees=[] in an init line and adding _objID=2 to the script to give it a value to check it reaches the inner hint.
If I change JTD_FireTrees=[3,6,2] the inner hint does not show so I assume the script is fine.
It's either how it's initialised or the compared items or incorrect in some way.
-
You're right F2kSel, if I initilise the array in the player's init field to [1,2], it all works. But if I initialise it in the config like:
JTD_FireTrees[] = {1,2};
it does not. Odd.
-
Have you tried putting this before the if statement?
JTD_FireTrees = getArray(configFile >> "JTD_FireTrees");
If you're already done this then it certainly is weird.. :dunno:
-
I had trouble calling a .sqf this way from another .sqf:
nul = [_x] execVM "ForestFireTree.sqf";
But when I dropped the "nul =" part it worked. So this might work:
[_x] execVM "ForestFireTree.sqf";
This worked for me (not with your .sqf, but another one I'm working on). Good luck.