www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tomb Raider Level Editor Tutorials

Closed Thread
 
Thread Tools
Old 13-05-14, 18:16   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,493
Default TRNG Trigger working methods

An executable trigger will be executed (activated) if all its conditions are true.

The possible conditions are:

- The trigger type of the executable trigger, if it is a local trigger, placed in the map.
For example: PAD – “if Lara touches the trigger square”, TRIGGER – “if Lara is in trigger zone, anywhere between the floor and the ceiling” etc.

- Classic condition triggers, overlapped with the executable local trigger in the map.
For example, SWITCH - “if Lara uses the switch”.

- The new, TRNG type CONDITION trigger, overlapped with the executable local trigger in the map or exported into the Script, together with the executable trigger.

- Special conditions, eg. “if One Shot is not pushed”.

1. Working methods for local triggers

These are the working methods of local executable triggers:

- “Single” method: the event will be activated once, each time in the moment when all the conditions become true.
- “Multiple” method: the event will be activated again and again, at each tick frame, continuously, while all the conditions are true.
- “Continuous” method: the event will be activated again and again, at each tick frame, continuously, after all the conditions become true, till you stop the activation.


Let’s see for example a PAD F231 trigger: “add 1 to Local Byte Alfa1 variable”:

- If Lara walks into the “single” trigger zone, then she will touch the floor there. So PAD becomes true. That is why 1 will be added to Local Byte Alfa1 (LBA1) variable. That is why the value of the variable will be 1.
Now Lara jumps up, which makes PAD false. Then she naturally falls back on the trigger floor square, so PAD becomes true again. So 1 will be added to LBA1 again. That is why the variable value will be 2.

- If Lara walks into the “multiple” trigger zone, then she will touch the floor there. So PAD becomes true. That is why 1 will be added to LBA1 in that moment. That is why the value of the variable will be 1. In the next moment (i.e. at the next tick frame) the PAD is still true, so 1 will be added to LBA1 again. That is why the variable value will be 2. Etc.
Then Lara jumps up, after spending 1 second (30 frames) there on her feet. PAD goes false now. So in the moment when she got in the air, the variable value is 30 and won’t continue increasing (at least, till Lara falls back).

- If Lara walks into the “continuous” trigger zone, then she will touch the floor there. So PAD becomes true. That is why 1 will be added to LBA1 in that moment. That is why the value of the variable will be 1.
After that, we won’t study if PAD is still true or not, 1 will be added to the variable continuously everyway, at each tick frame, till you activate some other trigger (see it later) to stop adding 1 to LBA1.


Let’s see another example, when a C35 CONDITION trigger (“Lara is holding pistols”) is overlapped with a TRIGGER F355 to show a red flash for a short time:

- If Lara gets into the “single” trigger zone, with pistols in the hands, then both TRIGGER and the CONDITION will become true, so a short red flash will show up on the screen now. – Let’s see two different proceedings:
= Lara holsters the pistols, which makes the CONDITION false. Still being in the trigger zone, she draws the pistols, so the CONDITION becomes true again. The TRIGGER is still true, so another short red flash will show up on the screen now.
= Lara – still holding the pistols – leaves the trigger zone now, which makes the TRIGGER false. Still holding the pistols, she comes back into the trigger zone, so the TRIGGER becomes true again. The CONDITION is still true, so another short red flash will show up on the screen now.

- If Lara gets into the “multiple” trigger zone, with pistols in the hands, then both TRIGGER and the CONDITION will become true, so a short red flash will show up on the screen now. But, in the next moment, and after that, Lara is still in the trigger zone, with pistols in the hands, so short red flashes will show up on the screen, continuously, merging into one, long red flash. – Let’s see two different proceedings:
= Lara holsters the pistols, which makes the CONDITION false, the long red flash will disappear. Still being in the trigger zone, she draws the pistols, so the CONDITION becomes true again. The TRIGGER is still true, so another long red flash will show up on the screen now.
= Lara – still holding the pistols – leaves the trigger zone now, which makes the TRIGGER false, the long red flash will disappear. Still holding the pistols, she comes back into the trigger zone, so the TRIGGER becomes true again. The CONDITION is still true, so another long red flash will show up on the screen now.

- If Lara gets into the “continuous” trigger zone, with pistols in the hands, then both TRIGGER and the CONDITION will become true, so a short red flash will show up on the screen now.
After that, we won’t study if TRIGGER and/or the CONDITION are still true or not, short red flashes will show up continuously everyway, at each tick frame, merging into one, long red flash, till you activate some other trigger (see it later) to make the flash disappear.

Default working methods:

Usually you won’t choose if you want to use single, multiple or continuous execution, because the most of the triggers have a default working mode. – For example:

- F231 “add 1 to the variable”. – Reading what the trigger does, you will expect that the variable value will be increased only by 1, and then nothing will happen. And yes, that is what will happen, the variable won’t be increased by further 1 values in the further moments. So it is clearly a single mode.
- A PAD OBJECT trigger to open a door for 5 seconds. – If Lara steps on this trigger, then the door will open and the timer will start from 5. But, if she is on the trigger in the next moments, then the timer will start again and again from 5. (The door naturally won’t open again and again because it is open continuously.) So it looks as if nothing would be timed, because, actually, the timer will turn from 5 to 4 only if Lara steps off the PAD. So it is clearly a multiple mode, the door remains open forever till Lara is on the PAD.
(There is no difference between the default working methods of OBJECT trigger and OBJECT trigger. So, if another PAD OBJECT opens the same door without a timer, then that is also multiple. If a door opens without a timer, then the multiple trigger is still trying to open it in the further moments, but nothing will happen, because the door is just open.)
- A PAD A43 trigger to open a door for 5 seconds. – If Lara steps on this trigger, then the timer starts from 5. If she is on the trigger in the next moments, then the timer counts down: 5, 4, 3 etc. So it is clearly a single mode.
- I don’t think there are triggers nowadays in TRNG with default continuous mode.

General rules about the working method of the triggers:

- Basically, TRLE local triggers are multiple. (See eg. that PAD OBJECT above.)
- Basically, TRNG local triggers are single. (See eg. that PAD A43 above.)
- There are some exceptions. See eg. F90 when you need to choose the proper mode in the trigger, or see F11 OldFlip FLIPEFFECT below.
- You can force different executions either for TRLE or for TRNG triggers.

The ways to force a working method:

- You can force the single method, instead of the multiple one, in some obvious ways: using One Shot button, TGROUP_SINGLE_SHOT flag, switch or PICKUP trigger.
- If you can export the executable trigger into the Script (they are FLIPEFFECT or ACTION triggers), then you can force single or multiple or continuous method for the trigger. In these cases, don’t place the trigger in the map. Instead, export it in a TriggerGroup, then activate the TriggerGroup with one of these triggers placed in the map: F118 (choosing any method in the trigger), F371 (for single method), F372 (for multiple method) or F373 (for continuous method).
You can stop the continuous activation of F118 or F373 with an F192.

In the further part of the tutorial I don’t want to make the things too complicated, that’s why I will mention only F118 to activate a TriggerGroup (saying it is single, multiple or continuous) – but that naturally means you can use F371, F372 or F373 instead of F118, if you want.

However, if the trigger is not able to do anything after the moment of the activation, then you don’t need to beat your brains that you need the trigger only for a moment (single method) or for more moments (multiple, continuous methods). - For example:

- A FINISH trigger makes the level jump during a moment, so in the further moments the game is playing in another level.
- F220 “clear all the contents from the diary”. – If the contents of the diary have just been cleared by this single trigger, then the diary is empty in the moments just after clearing the diary contents. So if it were a multiple or continuous trigger and if it tried to clear the contents again and again at each tick frame, in the empty diary, then naturally nothing would happen.

Some examples to force (or not to force) a working method:


- F231 “add 1 to the variable”. – Single mode is the default. But:

= Export the trigger into a TriggerGroup, and activate the TriggerGroup in “multiple” mode, with a TRIGGER F118 placed in the map. While Lara is in the trigger zone of F118, 1 will be added at each tick frame, continuously, to the value of the given variable.
= Export the trigger into a TriggerGroup, and activate the TriggerGroup in “continuous” mode, with a TRIGGER F118 placed in the map. When Lara gets into the trigger zone of F118, the game will start add 1 at each tick frame, continuously, to the value of the given variable, till you stop the activation with an F192 trigger.

- F220 “clear all the contents from the diary”. – It’s unnecessary to force a multiple/continuous method for this trigger (single by default) into a TriggerGroup. I explained just above why.

- An audio track is continuous, it takes more or less seconds. If you want to play a foreground track, with an F129 trigger (single by default) exported in a multiple/continuous TriggerGroup, then it will start the track again and again at each frame, continuously, so you will hear only the first moment of the track again and again. That is why it always clearly must be a single trigger.

- F11 trigger performs a short earthquake, with an exploding sound. The quake effect is single, but the sound is multiple. So, as I said just above with the audio tracks, the sound will want to start again and again, if eg. it is a TRIGGER, and Lara is in the trigger zone. You can fix that sound bug, if you force single method on the trigger.

- A TRIGGER SINK trigger will always draw Lara to a sink if Lara is in the trigger zone, so it is clearly a multiple mode. If you use the ACTION version of SINK trigger (TRIGGER A46), then that is single. That is a problem, because a single A46 will draw Lara only for a moment. If you want the A46 trigger to act as if it were a SINK trigger, then export A46 into the Script, and activate it in multiple mode, with a TRIGGER F118.

- Continuous TriggerGroups could be pretty useful with some savegame problems.
For example, a placed A50 trigger (single by default) makes a mesh invisible. But if you save the game after activating that A50 and then load that savegame, then you will experience that that mesh go visible again. (NEF_SAVE_MESH_VISIBILITY constant will prevent it possibly only with creatures.)
To solve the problem, export that A50 into a TriggerGroup, and activate it with a “continuous” F118 placed in the map, instead of activating it with an A50 placed in the map.
Thanks to the continuous execution, the invisibility will stop only in these cases:

= you activate an F192 for that TriggerGroup, then save the game and then load that savegame, or
= you activate an F192 for that TriggerGroup, then remove the invisibility with A51.

2. Working methods for exported triggers

F118 could be not only a local trigger. So eg. if an F118 refers to TriggerGroup A, then you can export that F118, to put it in TriggerGroup B in the Script. So, when an F118 executes TriggerGroup B in the map, then all the triggers of TriggerGroup B will be executed, including the F118 for TriggerGroup A, to execute all the triggers in TriggerGroup A.

But which working method should you choose in exported F118 triggers? (Or see eg. an F90 as well.) I mean, working methods are made for trigger zones, but an exported trigger doesn’t have a trigger zone.
Well, here are the possibilities:

Local trigger:

If an F118 placed in the map will activate TriggerGroup B that contains the exported F118 for TriggerGroup A:

- “Singe” or “multiple” exported F118: it is “single” in “single” local F118, “multiple” in “multiple” local F118 and “continuous” in “continuous” local F118.
Naturally you need an F192 to stop the continuous execution of TriggerGroup B, if that is “continuous”.
- “Continuous” exported F118: it is “continuous” in “single”/”multiple”/”continuous” local F118.
This time the F192 to stop TriggerGroup B continuous effects is not enough to stop the continuous effect of the exported F118. (I mean, that trigger is important to stop the continuous activation of TriggerGroup A, but there is still no any sensible effect of that in the game.) After that, you also need an F192 for TriggerGroup A to stop that. (The order of the two F192 triggers is important now.)

Global trigger:

If a GlobalTrigger command starts TriggerGroup B (that contains the exported F118 for TriggerGroup A), that works like a continuous working method: if the conditions (defined in the GlobalTrigger command) are true, then the triggers in TriggerGroup B will start being executed continuously, till the conditions go false or till you disable the GlobalTrigger.
That is also true for “single” or ”multiple” F118 triggers exported in TriggerGroup B.
But if that exported F118 is “continuous”, then, either the conditions are still true or not, first you need to disable the GlobalTrigger (still without any sensible effect), then you need to stop the continuous execution of TriggerGroup A with an F192, to stop the execution.

Notes:

- If the GlobalTrigger has an FGT_SINGLE_SHOT flag, that is equivalent with “disable the TriggerGroup” now, after the first moment of the activation.

- You cannot even try to activate F192 first, or else the control of the GlobalTrigger (more or less) will be buggy.

- I don’t recommend exported conditions in IdPerformTriggerGroup or IdOnFalseTriggerGroup field of the GlobalTrigger, if the executable trigger is a TriggerGroup with “continuous” method, or else the control of the GlobalTrigger (more or less) will be buggy. Use the conditions only in IdConditionTriggerGroup field of the GlobalTrigger now.

Other Script commands:

If another Script command starts TriggerGroup B (that contains the exported F118 for TriggerGroup A), that usually works like a single working method: if the conditions (defined in those Script commands) become true, then the triggers in the TriggerGroup B will be executed.
That is also true for “single” or “multiple” F118 triggers exported in TriggerGroup B.
But if that exported F118 is “continuous” then you need an F192 for TriggerGroup A to stop the continuous effect.

Note:
If you don’t know how a Script command like that is able to define a condition for itself, then see eg. the description of IdTriggerGroupWhenHitEnemy field of CUST_AMMO in NG Center/Reference. It says if you type a TriggerGroup ID there, then the exported triggers stored in the TriggerGroup will be executed, if a bullet of an ammo type (named in that CUST_AMMO) just hits an enemy, any time during the level.

WADMerger AnimCommands:

A WADMerger AnimCommand usually works like a single working method: if the animation reaches that frame, then the AnimCommand will be executed.
That is also true if the AnimCommand is a “single” or “multiple” F118 trigger.
But if that exported F118 is “continuous” then you need an F192 for that TriggerGroup to stop the continuous effect.

3. Special situations

“Really” single triggers:


Single events will be activated if these local conditions of the event will go false for a time while Lara remains in the trigger zone:

- PAD or COMBAT executable trigger, or
- CONDITION triggers.

See eg. again the examples above:

- For PAD F231: Lara jumps up, which makes PAD false. Then she naturally falls back on the trigger floor square, so PAD becomes true again. So 1 will be added to LBA1 again. That is why the variable value will be 2.
- For C35+F355: Lara holsters the pistols, which makes the CONDITION false. Still being in the trigger zone, she draws the pistols, so the CONDITION becomes true again. The TRIGGER is still true, so another short red flash will show up on the screen now.

About the first case:
Maybe you don’t want 1 to be added to the variable if Lara jumps up/falls down back now, so you want 1 to be added only when Lara gets into the trigger zone, stepping on the PAD. – The solution:

- A TRIGGER F118 (in “single” mode) placed in the map instead of PAD 231.
- F231 is exported into that TriggerGroup.
- C25 (in “simulating PAD” mode) also exported in that TriggerGroup as the condition of that exported F231.

About the second case:
Maybe you don’t want to see the short red flash if Lara holsters/draws the pistols in the trigger zone now, so you want the short red flash to appear only if Lara gets into the trigger zone with pistols in the hands. – The solution:

- A TRIGGER F118 (in “single” mode) placed in the map instead of TRIGGER F355 and C35.
- F355 is exported into that TriggerGroup.
- C35 also exported in that TriggerGroup as the condition of that exported F355.

So the conclusion:
If you don’t want an activation of a single event while Lara is already in the trigger zone, then don’t use a PAD or COMBAT executable trigger or local CONDITION triggers. Use only TRIGGER executable trigger and (optionally) exported condition triggers.

Notes:

- I didn’t mention ANTITRIGGER or ANTIPAD now, because they can’t be used for single triggers. – Why? Because you will always use them for OBJECT triggers to deactivate something. And, as I said above, OBJECT executable triggers are multiple triggers.

- There is no problem like that:

= if the activator of the trigger is not Lara, because PAD/COMBAT or local CONDITIONs are impossible for Heavy triggers, or
= if it is not a local trigger, because there is no trigger zone for Lara in the case of non-local triggers.

Continuous trigger anomalies:

You can have problems with the “continuous” method, if the TriggerGroup, that contains the executable trigger, also contains exported condition triggers for the executable trigger:

- As I said above, the continuous event of “continuous” triggers is continuing, after the conditions became false, till you stop the activation with another trigger (F192).
But that is not true, if it is the exported conditions that go false. Because, if the exported conditions go false after the activation of the TriggerGroup, but before activating F192 (either the other conditions are still true or not), then the continuous event will be deactivated, temporarily.
“Temporarily” means the continuous event will restart (till activating F192, still not examining now if the other conditions being true or not), if the exported conditions become true again.

For example:
The “continuous” TRIGGER F118 has a C1 overlapped (“there is no big medipack in the inventory”). The TriggerGroup has an exported C35 condition: “if Lara holds pistols”. Lara goes into the trigger zone, without big medipacks in the inventory. She extracts the pistols, so the “continuous” event will start.
If she leaves the trigger zone and/or if she picks up a big medipack, then the event will continue, but the event will stop if she holsters the pistols. After that, if she extracts the pistols again, then the event will restart, even if she is not in the trigger zone, and/or if she has big medipacks.
After that, if the event works (with pistols extracted), the event will stop if an F192 is activated now for the TriggerGroup. Or, if the event doesn’t work (with pistols holstered), then it won’t start again, if that F192 is activated now, before extracting the pistols again.

- If the trigger type of that F118 (and the possible condition trigger overlapped with the F118) is true, but the exported conditions are not, then the trigger will be executed even if the exported conditions will be true only after (!) the trigger type (or the possible overlapped condition trigger) became false. (Naturally before activating F192.)

See the previous example again:
Lara goes to the trigger zone, without big medipacks in the inventory. Then she leaves the trigger zone, and/or she picks up a big medipack. Then she extracts the pistols (before activating that F192) – so the continuous event will start.

Non-Lara activators:

If the trigger is activated by not Lara, but eg. a motorbike or a boulder, then it usually will be activated in the same single/multiple/continuous way as if the activator were Lara.
But with some activators (see eg. pushblocks) multiple methods will always be activated as if they were single methods.

Made using TRNG 1.2.2.7.

Last edited by Titak; 22-12-14 at 10:57.
AkyV is online now  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 17:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.