The NGLE Manual
Global triggers
By Cook
A GlobalTrigger is like a
CONDITION trigger. It activates if some event happens in the
game. It is a way to trigger (activate) a TriggerGroup
without placing a trigger sector in your level in NGLE.
TriggerGroups are explained in
this tutorial - Script Triggers
and Triggergroup Commands
This means your TriggerGroup can be activated anywhere in
the level if a particular event happens. It is as if you had
placed a CONDITION trigger and the triggers in your
TriggerGroup on every sector in the level. You can disable a
GlobalTrigger by a FLIPEFFECT trigger if you don't want it
to apply in an area of your level. The same FLIPEFFECT
trigger can be used to enable it again.
You can gain some understanding of what GlobalTriggers are
by looking at the names of the different types. They are the
constants that start with GT_ in the mnemonic constants list
of NGCenter's reference tab. These are current as of TRNGdll
1.2.0.1.
GT_COLLIDE_CREATURE
GT_COLLIDE_ITEM
GT_COLLIDE_SLOT
GT_COLLIDE_STATIC_SLOT
GT_CONDITION_GROUP
GT_DAMAGE_BAR_LESS_THAN
GT_DISTANCE_FROM_ITEM
GT_DISTANCE_FROM_STATIC
GT_ENEMY_KILLED
GT_GAME_KEY1_COMMAND
GT_GAME_KEY2_COMMAND
GT_KEYBOARD_CODE
GT_LARA_HOLDS_ITEM
GT_LARA_HP_HIGHER_THAN
GT_LARA_HP_LESS_THAN
GT_LARA_POISONED
GT_LOADED_SAVEGAME
GT_SAVED_SAVEGAME
GT_SCREEN_TIMER_REACHED
GT_USED_BIG_MEDIPACK
GT_USED_INVENTORY_ITEM
GT_USED_LITTLE_MEDIPACK
GT_USING_BINOCULAR
GT_VSCROLL_COMPLETE
GT_VSCROLL_LAST_VISIBLE
To get the syntax for the command (i.e. what values to use
and what order), in the reference tab of NGCenter select new
script commands in the dropdown box and find GlobalTrigger
on the list and press expand info.
Syntax: GlobalTrigger=IdGlobalTrigger, Flags Global
Trigger (FGT_...), Global Trigger (GT_..), Parameter,
IdConditionTriggerGroup, IdPerformTriggerGroup
Scope: To use in [LevelSection]
What does this tell you?
First it tells you where to type the command in the script.
The line starting with "Scope:" says the command is typed in
the [Level] section.
So to create a GlobalTrigger, in NGCenter add GlobalTrigger=
to the [Level] section of your script.
Next it tells you the command must have six values (on one
line) separated by commas "," after the "=".
The six places where you type the values are known as
fields. For all commands you cannot have an empty field
(,,).
The first value is just a number you give the GlobalTrigger
to identify it. Each GlobalTrigger in the same [Level]
section must have a different number.
The next field may contain a flag value that starts with
FGT_.
Change the dropdown box from
new script commands to mnemonic constants and find in the
list all the values that start with FGT_ and read the info.
For example, FGT_SINGLE_SHOT. If you type this value your
GlobalTrigger will only activate once. If you do not want
this, what do you type? You must type something because an
empty field is not allowed. Whenever a field will be empty
type IGNORE.
The FGT_SINGLE_SHOT value must be used with many
GlobalTriggers. Every tick (frame) of the game, and that is
30 times a second, your GlobalTrigger is asking tomb4.exe if
some event has happened. So every frame that event is
happening the GlobalTrigger will activate your TriggerGroup.
This can be seen by creating a TriggerGroup that forces Lara
into animation and a GlobalTrigger without the
FGT_SINGLE_SHOT value that activates when Lara holds a flare
(GT_HOLDS_ITEM).
If you use the GT_ENEMY_KILLED GlobalTrigger without a
FGT_SINGLE_SHOT value your TriggerGroup will activate every
1/30 seconds until the end of the level once the enemy is
killed since the enemy will still be killed in every frame.
The third field is where you choose what type of
GlobalTrigger you are using. You must choose one of the GT_
values in the mnemonic constants. See the list above.
The value you type in the next field depends on which GT_
value you choose. You have to read the info in the mnemonic
constants list in NGCenter for that GT_ value.
The fifth field is an ID number of a TriggerGroup or IGNORE.
The TriggerGroup you use must contain only exported
CONDITION triggers. See this tutorial -
Multiple Condition
Triggers. You only use
a TriggerGroup ID number if you want to impose further
restrictions on the GlobalTrigger. For example if you want
to trigger something when Lara holds a flare (GT_HOLDS_ITEM)
and when Lara is running.
The final field is where you type the ID number of the
TriggerGroup you want to activate.
Notes
You have to be careful how you set up a GlobalTrigger and
have a suitable level design for most of them. How you set
them up depends on what you want them to trigger.
For example, say you use a GT_HOLDS_ITEM GlobalTrigger to
activate a TriggerGroup that will move Lara very quickly up
a vertical pole. If you don't use FGT_SINGLE_SHOT, Lara
won't be able to come down the pole and if she grabs it at
the top she may be moved into the ceiling. If you do use
FGT_SINGLE_SHOT what happens if Lara falls off the pole
before reaching the top. To get around these problems you're
going to have to set up triggers near the pole that enable
and disable the GlobalTrigger.
Nowid used GlobalTriggers to
make it possible to use a fired torch from the inventory,
something I would never have thought of. Another example of
GlobalTriggers can be found in Paolone's quicksand project
where one is used to end the game after Lara has collected
six urns.
GT_CONDITION_GROUP
This is the type you use if you want to create your own
custom GlobalTrigger. Just export all the condition triggers
you want to apply and create a TriggerGroup for them. This
will be a CONDITION TriggerGroup since it only contains
condition script triggers. Condition script triggers start
with $9000 or $8000.
When all the conditions in the CONDITION TriggerGroup are
true your GlobalTrigger will activate the TriggerGroup you
have nominated in the IDPerformTriggerGroup field.