Yesterday i've made a couple of tests which i must say should have been
done right from beginning of mission editing in ofp.
Before a few words about how i got inspired to start these tests:
Until a few weeks ago i've been in the meaning that init fields of units become
executed in order of first unit being placed = first init field being executed.
Then i found out that this is not true by trying to initialise an array from the
first unit's init field i've placed onto the map (a West unit) and adding other
units by their init fields to this array (West and East units).
Now the result was that the East units weren't added to the array which made
me stunning.
After a little bit of playing around i figured out that East unit's init fields become
executed before West unit's init fields.
Then yesterday i found a thread by UNN at official forums where he was
also posting about initialisation of units or vehicles but from the config
point of view. I shared my experiences to him.
So i started thinking about testing what gets executed when at missionstart;
Initialisation test:The following events i've taken into consideration when starting my tests:
- East unit's Init field
- West unit's init field
- Resistance unit's init field
- Civilian unit's init field
- Empty Object's init field
- Gamelogic's init field
- Trigger (with condition: true)
- Init.sqs
- Script (started from init field of a unit)
- Script (started from init.sqs)
- Script (started by waypoint scripted)
:note - wp scripted scripts execute once a unit's next waypoint is the wp type scripted.
Therefore i've made the very first waypoint of a unit type scripted. - Script (started by normal waypoint placed right on top)
- OnActivation field of a waypoint
Point of the test was:
In which order these aspects become executed.
This is an important information when it comes to initialise variables/arrays/scripts or
any other important events when mission starts.
Here are the results of the tests in ascendending order (most top gets executed first and
most bottom gets executed last):
- East unit's init field
- West unit's init field
- Resistance unit's init field
- Civilian unit's init field
- Gamelogic's init field
- Empty Object's init field
- Script (started from init field)
- Init.sqs
- Script (started from init.sqs)
- Trigger (condition true)
- Script (started by waypoint scripted)
- OnActivation field of a waypoint (placed on top of unit)
- Script (started from onActivation field of a waypoint)
Now something weird occured too;
Two times the trigger became executed last.
The only thing i can say about it is:
It happened after changing something in editor
e.g: delete a waypoint or a group here and/or add a waypoint
or group there.
I could not recreate the triggers execution at the end by
intension but i can confirm that it was not just a imagination
(i thought that first), because it happened twice (though not twice in a row).
Now i've also tried to test same type of waypoints on several
groups which ended in the result that: first group being placed, first waypoint being executed,
but still along those results shown above - East first then West, then Resistance,
followed by Civilian and at last Gamelogic's waypoints.
----------------------------------------------------------------------------------------------------------------------
end of initialisation tests
----------------------------------------------------------------------------------------------------------------------
Now part two of my tests:
Trigger list:As you all know, a trigger with a radius features a list of units which do match with the
trigger's activation condition.
This means: a trigger of size: 300/300 / activation: WEST / present / once or repeatedly (doesn't matter)
features a list of all west units inside the trigger area whenever you use the command:
thislist from within
the trigger, or
list triggername.
My tests were about how this trigger list is built up at mission start with units already inside.
Therefore i've made a trigger: 550/550 activation: anybody/present
First try:
player (west)
east soldier
resistance soldier
civilian
gamelogic
The result was along the initialisation results as stated above:
- West
- East
- Resistance
- Civilian
- Gamelogic
Now i enhanced the tests by adding another East unit and placed it
far away from the others.
This i did because i figured out that in the config the units are defined
that way:
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7
This made some sense in combination with the results i got
from the initialisation testing and how the trigger list was built.
Now i thought about the aspect: SideUnknown
So i thought that the East unit being placed far from
trigger's center AND out of sight of player could receive
the status: SideUnknown.
The result was:
- West
- East
- Resistance
- Civilian
- Gamelogic
- East (the unit being placed far away)
Now to confirm that i exchanged the two east units
locations and the result was:
- West
- East (the one which was formerly far away and now close to the center)
- Resistance
- Civilian
- Gamelogic
- East (the one which was formerly close and now far away from the center)
I later found out that moving units around and changing
positions in relation to the player and/or the trigger's
center everytime has taken some influence on how the
trigger's list was built up.
At the end i couldn't find out why or how the trigger's list
was built up that way but i will not give up finding out - *hint* here's
the point i would like others to join my tests to find that out too,
since this is making me get headache a little bit.
~S~ CD