Timed Events using Organizer= Script Command
by
Cook
When you want to setup a timed sequence of events in your level you can use an Organizer= command in your script.
I have placed a WATERSKIN1_1 object in my level.
This object is not an object that can be picked up by
Lara so I am going to fake it as follows.
When Lara steps on the
sector she will perform her pickup animation, the WATERSKIN1_1 will
disappear and be added to her inventory.
I need to use an
Organizer= command since I want to delay the disappearance of the
WATERSKIN1_1 object so it disappears at the right time of Lara's
animation. Many of NGLE's new triggers use the Timer field of the Set
Trigger Type window for other things so it cannot be used. There is a
new TIMER_FIELD type trigger in NGLE for these cases but I will use an
Organizer here.
The
Organizer= command only activates TriggerGroups in the script so I will
need to export my triggers as script triggers. Exporting script triggers
is explained in this tutorial.
Here are the NGLE triggers I exported as script triggers.
And here are TriggerGroups I defined in the script in NGCenter.
Note: Your script trigger for making the WATERSKIN1_1 object invisible may be different. This object was index number 4 in my level in NGLE. This corresponds to the 4 in the script trigger.
Add the Organizer= command to the [Level] section of the script and after the "=" sign type a number and then a comma ",". You must use a unique number for each Organizer= command in the same [Level] section.
Next you must type a flag value for the Organizer.
Flag values for a command change the way it behaves and you will notice
that flag values for a command start with "F". For an Organizer the
choices are FO_ENABLED, FO_LOOP and FO_TICK_TIME. If you do not want to
change the behaviour of the Organizer you must type IGNORE.
If
you want to use more than one flag you type the first one, then a plus
"+" and then the next one and so on for the other flags you want. For
example FO_LOOP+FO_TICK_TIME. This joins the flags into one value.
FO_ENABLED will
enable (activate) the Organizer when the level starts.
FO_LOOP will make the
Organizer repeat itself over and over once it is enabled.
FO_TICK_TIME is the flag
you use if you want more precision in the timing of events. Tick time
equals one thirtieth of a second (1/30 seconds) corresponding to one
frame of the game.
The only flag I will use in this case is
FO_TICK TIME since after studying the pickup animation I want the
WATERSKIN1_1 object to disappear after 19 frames. So next I type
FO_TICK_TIME and then a comma "," to separate it from the next value.
You can use decimal times (0.5) if using seconds as the time unit but
only whole numbers if using FO_TICK_TIME.
Next type IGNORE and a comma ",". There are no other choices for this value yet.
Now the process is: type a time increment, a comma
",", the TriggerGroup number you want to activate at this time, a comma
"," , the next time increment, a comma ",", the TriggerGroup number you
want to activate at this time and so on until your sequence is complete.
I want to force Lara's pickup animation at the same time the
Organizer is enabled so I type zero "0" for the time increment and "1"
for the TriggerGroup number.
19 * 1/30 seconds after TriggerGroup 1 is activated I want the WATERSKIN1_1 object to disappear and be added to the inventory so I type "19" for the time increment and "2" for the TriggerGroup number.
The sequence is complete. Build the script. Here is the Organizer split over more than one line and commented.
Now I need to enable (activate) the Organizer.
In NGLE I place a FLIPEFFECT trigger under the WATERSKIN1_1 object
to enable Organizer 1. It is a PAD type trigger with One Shot enabled.
Here is an Organizer from Paolone's Miscellaneous sample project script.
Note:
The Enemy:kill object
options in the ACTION triggers did not work with the WATERSKIN1_1
object.
The Inventory_item FLIPEFFECT trigger Inc (+1) did not
work for the WATERSKIN1_1 object and if the draw object option was used
Lara's root mesh was drawn.
For a custom or cutscene animation
you could export the NGLE triggers as an AnimCommand and place them on
the correct frame in the animation using Wadmerger.
On completion you will notice that the WATERSKIN1_1 pickup needs improvement. Lara performs the animation as soon as she steps on the trigger sector. This means the pickup animation is performed at the edge of the sector and not at the centre where the WATERSKIN1_1 object is located. This can be fixed by following the Fragmented Triggers Example tutorial also by Cook.