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
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 126.96.36.199
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, IdOnFalseTriggerGroup
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 seven values (on one line) separated by commas "," after the "=".
The seven 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 sixth field is where you type the ID number of the TriggerGroup you want to activate when the GlobalTrigger is activated (all conditions are true).
The final field is where you type the ID number of a TriggerGroup you want to activate when the GlobalTrigger is not activated (not all conditions are true).
Take care if using this field since the GlobalTrigger may not be activated for many frames of the game which means this TriggerGroup will be activated every frame.
Type IGNORE in this field if you do not want to activate any TriggerGroup when not all conditions are true.
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.
If you are using the latest TRNG, the GlobalTriggers in Paolone's Miscellaneous demo project may need to be updated to the new syntax of seven fields for the script to compile without error. You will need to add the IdOnFalseTriggerGroup field to the end of each GlobalTrigger in the script if there are only six fields present. Use IGNORE as the value.
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.
This type does not need something to happen in the game to activate it. It is activated automatically every tick (frame) of the game.
This GlobalTrigger will activate the TriggerGroup you have nominated in the IDPerformTriggerGroup field every tick (frame) of the game.
Type IGNORE in the IdConditionTriggerGroup field since any value in this field will not be used.