Condition Triggers with Variables
Thanks to TRNG, we can now use plenty of conditions (see CONDITION triggers) for our executable triggers.
But what if we don't have a CONDITION trigger for a situation? - Well, then we use the 'general condition', i.e. the good old 'Trigger Triggerer method'. For example, what if you want Lara to activate Trigger X only if she collected Secret No.2 in the level? - Well, then you do this:
1. You place a TRIGGER_TRIGGERER nullmesh object on the square of Trigger X.
2. Then you click on T button to create a blue frame around the square.
3. Then you adjust a trigger for the TRIGGER_TRIGGERER in the Set Trigger Type panel.
4. Then you click on the square of SECRET trigger (having Value 2 in its 'Object to trigger' box) to place the trigger of that TRIGGER_TRIGGERER on the same square where the SECRET trigger is placed.
Okay, but that method doesn't work in these two cases:
- If Trigger X has many squares, I mean, if the zone of Trigger X is eg. 10 squares (eg. 5x2) sized then supposedly you don't want to place ten TRIGGER_TRIGGERER objects with ten triggers for them.
- If Trigger X is not a placed trigger but an executable trigger in a GlobalTrigger Script command.
To solve those problems, we will use a simple new method, i.e. a new type of the 'general condition', not using TRIGGER_TRIGGERER objects or triggers for them:
The theory of the new method is about a variable. It can be any 'Byte' variable you don't use at that moment. Let's say it's Local Byte Alfa1 (LBA1) now. If the variable has Value A then the condition is not true, but if the variable has Value B then the condition is true.
For example, that is how we'll use the new method in the case of SECRET triggers:
1. Place an F232 FLIPEFFECT trigger ('Variables. Numeric. Set <&>Variable with (E)value') on the square where you placed that SECRET trigger. Choose LBA1 in F232, then set Value 1 in it. - I.e. when Lara has got the secret then the value of LBA1 will be 1.
2. You have two possibilities now:
- If Trigger X is a placed trigger with more than one square:
Place one C43 CONDITION trigger ('Variables. The <#>Numeric Variable is = than (E)Value'), exactly overlapped with all the squares of Trigger X. Then choose the same parameters (LBA1, Value 1) in C43. (So, if Lara steps on Trigger X then C43 will examine if LBA1 is 1. Trigger X cannot be activated if LBA1 is not 1, i.e. if Lara hasn't got that secret so far.)
- If Trigger X is in a GlobalTrigger, for example GlobalTrigger#1:
Type the export
values of that C43 (with LBA1, Value 1 parameters) in a brand new
TriggerGroup, for example TriggerGroup#1. Then type the ID of the
TriggerGroup (1) in IdConditionTriggerGroup field of the GlobalTrigger.
(So, C43 in the GlobalTrigger will examine continuously if LBA1 is 1.
Trigger X cannot be activated if LBA1 is not 1, i.e. if Lara hasn't got
that secret so far.)
1. If the GlobalTrigger works when Lara gets the secret then the GlobalTrigger is useless, because LBA1 will be 1 at once when getting the secret, i.e. Trigger X will be activated at once when getting the secret - as if Trigger X were a placed trigger (without any condition), placed overlapped with the SECRET trigger.
- You should enable the GlobalTrigger later, after getting the secret (so the GlobalTrigger must be disabled so far), but before reaching Trigger X.
- And/or you should use one or more further conditions in the GlobalTrigger. Only if all the conditions are true (including LBA1=1) Trigger X will be activated.
2. Problems if you used LBA1 before the secret setup in your level, for any other feature:
- The default value of each numeric variable is naturally 0. But if you've used LBA1 yet then maybe the value of LBA1 is not 0 (eg. 1) when you start using it for your secret setup. (Just think about it: eg. if LBA1 is 1 before getting the secret, but if Lara steps on Trigger X now then Trigger X will be activated - though it must not.)
Do this to solve the problem:
Place a second F232. You can place it anywhere in your level, but you must be sure that this second F232 will be activated before Lara can reach the secret or Trigger X. (Choose LBA1 in F232, then set Value 0 in it.)
- As I said above you can disable GlobalTrigger temporarily if that is needed.
And you can have one more reason to disable the GlobalTrigger: if you've used LBA1 for another purpose, before that secret setup. Because, if LBA1 is 1 due to that 'other purpose' then the 'LBA1=1' condition in the GlobalTrigger will be true when it mustn't be true.
That's why, if that happens, then the GlobalTrigger should be disabled everyway till that second F232 turns LBA1 into 0. (But it should be enabled before reaching the secret or Trigger X.)
See some further examples:
You want to activate a placed Trigger X only after an F217 trigger has placed an image on the screen. That's why there is an F232 overlapped with that F217 to set Value 1 in LBA1 when the image gets on the screen. If Lara steps on Trigger X then C43 examines if LBA1=1, i.e. if that image has been placed on the screen or not. (It is not important now if the image is still on the screen or not.) If it has then Trigger X will be activated, but if it has not then Trigger X won't be activated.
See that special Lightning Conductor setup in 'Street Bazaar' TRLR level: when Lara pushes/pulls a pushable object on the square of one of the Lightning Conductor objects then a HEAVYSWITCH will activate a FLAME_EMITTER2 to divert the lightning to the other Lightning Conductor. (By the way the setup would work properly with a simple HEAVY instead of a HEAVYSWITCH.)
So, there is an F232
TRIGGER overlapped with the HEAVYSWITCH (HEAVY) to set Value 1 in LBA1
if the lightning has been diverted. If it has - and if the other
conditions in the GlobalTrigger are also true - then the GlobalTrigger
will activate Trigger X.
This time this is what we can find in three GlobalTriggers:
if LBA1=0 plus other conditions are also true then activate Trigger X
if LBA1=1 plus other conditions are also true then activate Trigger Y
if LBA1=2 plus other conditions are also true then activate Trigger Z
There is an F232 overlapped with a FLIPMAP trigger to turn LBA1 into 1.
And this time there is another F232 overlapped with a FLIPOFF trigger to turn LBA1 into 2.
So, the conditions say:
- if the flipmap hasn't been switched on (LBA1=0, the default value) then activate Trigger X
- if the flipmap is switched on (LBA1=1) then activate Trigger Y
- if the flipmap is
switched off (LBA1=2) then activate Trigger Z
This time we don't have a placed F232 in the map to turn LBA1 into 1. But we have a GlobalTrigger: if the condition of the GlobalTrigger is true then the executable trigger of the GlobalTrigger (an F232 to turn LBA1 into 1) will be executed.
Lara steps on Trigger X in the level. A C43 examines there if the condition of the GlobalTrigger has been true before or not (i.e. if LBA1 has been turned 1 or not). If it has then Trigger X will be activated.
Made using TRNG 18.104.22.168