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 23-05-12, 19:43   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,505
Default TRNG - Customized switch sequences

Requested by Titak.

When we’re talking about switch sequences then it means the switches will trigger the required thing only if Lara switches them in the required order.

Note:
This tutorial has nothing to do with the original TR4 switch sequence (see the SEQUENCE_SWITCH buttons and the SEQUENCE_DOOR1 doors from the “Underneath the Sphinx” TRLR level).


Let’s see an example to understand the tutorial:

You have three lever switches placed in the map:

Switch1= ID25
Switch2= ID15
Switch3= ID24

If you push the switches in the required order (this is 1-2-3 now) then a placed door (ID14) will open. The switches won’t be reset automatically after pushing all of them.
If you don’t push the switches in the required order then the door won’t open. The switches will be reset automatically after pushing all of them.
If you have pushed a switch then you can’t pushed it back directly by Lara into the starting position.
There is no any other task that the switches should do now.

THE SETUP:

1. In WADMerger Animation Editor


See the Animation2 of the LEVER_SWITCH. Remove the only one entry from State Change Editor (that enables “pushing back to the starting position” Animation3 when Lara does that move), so if Lara wants to push the lever back to the starting position, then the lever won’t move.

2. In Room Editor

Then place the required objects (see above) and triggers on the map:
DON’T place any SWITCH triggers or triggers for the door. But place two triggers for each switch:

- An F109 trigger on the square of Switch1 that enables GlobalTrigger1 when Lara is on that square. And another F109 trigger near the switch (Lara must activate that before reaching the other two switches) to disable the same GlobalTrigger.
- An F109 trigger on the square of Switch2 that enables GlobalTrigger2 when Lara is on that square. And another F109 trigger near the switch (Lara must activate that before reaching the other two switches) to disable the same GlobalTrigger.
- An F109 trigger on the square of Switch3 that enables GlobalTrigger3 when Lara is on that square. And another F109 trigger near the switch (Lara must activate that before reaching the other two switches) to disable the same GlobalTrigger.

Note:
Maybe you should place the enabling F109 trigger not on the square of the switch but a square next to the switch if you experience the GlobalTrigger won’t be enabled in the proper time. (I mean maybe Lara will start using the switch first and step on the switch square to enable GlobalTrigger only after that. That causes she will perform Animation324 – that’s bad -, without the switch moving – that’s good -, when she wants to switch off.)

3. In NG Center

And this must go to the Script:

GlobalTrigger= 1, IGNORE, GT_CONDITION_GROUP, IGNORE, 1, 4, IGNORE
TriggerGroup= 1, $8000, 324, $1E, $9000, 25, $215
GlobalTrigger= 2, IGNORE, GT_CONDITION_GROUP, IGNORE, 2, 4, IGNORE
TriggerGroup= 2, $8000, 324, $1E, $9000, 15, $215
GlobalTrigger= 3, IGNORE, GT_CONDITION_GROUP, IGNORE, 3, 4, IGNORE
TriggerGroup= 3, $8000, 324, $1E, $9000, 24, $215
TriggerGroup= 4, $2000, 77, $67
GlobalTrigger= 4, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 5, 6, IGNORE
TriggerGroup= 5, $9000, 25, $215, $9000+TGROUP_NOT, 15, $215, $9000+TGROUP_NOT, 24, $215
TriggerGroup= 6, $2000, 231, $140
GlobalTrigger= 5, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 7, 6, IGNORE
TriggerGroup= 7, $8000, 64, $12B, $9000, 15, $215, $9000+TGROUP_NOT, 24, $215
GlobalTrigger= 6, IGNORE, GT_CONDITION_GROUP, IGNORE, 8, 9, IGNORE
TriggerGroup= 8, $8000, 64, $22B, $9000, 24, $215
TriggerGroup= 9, $5000, 14, $2B
GlobalTrigger= 7, IGNORE, GT_CONDITION_GROUP, IGNORE, 10, 11, IGNORE
TriggerGroup= 10, $9000, 25, $215, $9000, 15, $215, $9000, 24, $215, $9000, 14, $40E
TriggerGroup= 11, $5000, 25, $30F, $5000, 15, $30F, $5000, 24, $30F, $2000, 232, $40

3.1. Preventing Lara from switching off the switches manually

When Lara reaches the square of Switch1 then the GlobalTrigger will be enabled by the F109 placed there. (It's important if you disabled that GlobalTrigger with the disabling F109 trigger before.) So if TriggerGroup1 is true (i.e. if Lara is performing her switch-pushing Animation324 and the switch is performing its “I’m switched on” Animation2) then the game will execute TriggerGroup4, i.e. it will force the basic “standing and still” Animation103 on Lara.

; Set Trigger Type - CONDITION 30
; Exporting: CONDITION(30:62) for PARAMETER(324)
; <#> : Animation= 324
; <&> : Lara. (Animation) Lara is performing <#>animation
; (E) :
; Values to add in script command: $8000, 324, $1E

; Set Trigger Type - CONDITION 21
; Exporting: CONDITION(21:58) for OBJECT(25)
; <#> : LEVER_SWITCH ID 25
; <&> : Creature. Current animation of <#>creature is (E)animation (0-31)
; (E) : Animation= 2
; Values to add in script command: $9000, 25, $215

; Set Trigger Type - FLIPEFFECT 77
; Exporting: TRIGGER(103:0) for FLIPEFFECT(77)
; <#> : Lara. (Animation) Force <&>Animation (0-255) of (E)slot for Lara
; <&> : 103 Animation
; (E) : SLOT_000 LARA
; Values to add in script command: $2000, 77, $67


Why is it important? – Because that’s what will happen:

- Lara pushes the switch from the starting position (i.e. when the switch performs its Animation0). It is successful.
- Lara wants to push the switch from the ending position (i.e. when the switch performs its Animation2). But she can’t, because of that removed WADMerger entry, and because we force Animation103 on her.

If Lara leaves the switch then she will disable the GlobalTrigger with the other F109 near the switch, so she won’t perform Animation103 instead of Animation324 if she switches on Switch2 or Switch3 after switching on Switch1.

All of this works in a similar way with Switch2 or Switch 3 – see GlobalTrigger2, 3 and TriggerGroup2, 3, 4 in the Script.

Note:
It’s easy to identify the object in the C21 trigger: i.e. see the numbers that are written in red above. (I say that because now you can identify $9000, 15, $215 and $9000, 24, $215 triggers.)

3.2. Defining the first switch to switch on

GlobalTrigger4 will activate TriggerGroup6 if TriggerGroup5 is true. It means if Switch1 is switched on (i.e. if the switch is just performing Animation2: $9000, 25, $215) but Switch2 or 3 aren’t ($9000+TGROUP_NOT, 15, $215, $9000+TGROUP_NOT, 24, $215) then the game will add Value 1 to Local Byte Alfa1 – so Local Byte Alfa 1 is 1 now if Lara pushed only Switch1 but didn’t push Switch2 or 3:

; Set Trigger Type - FLIPEFFECT 231
; Exporting: TRIGGER(320:0) for FLIPEFFECT(231)
; <#> : Variables. Numeric. Add to <&>Variable the (E)value
; <&> : Local Byte Alfa1
; (E) : Value 1
; Values to add in script command: $2000, 231, $140

Notes:


1. FGT_SINGLE_SHOT_RESUMED is necessary, or else 1 will be added again and again to the variable if the Switch1 is switched on.
And yes, it is FGT_SINGLE_SHOT_RESUMED and not FGT_SINGLE_SHOT. Without RESUMED, the GlobalTrigger may be useless at the second, third etc. attempts. But we need those attempts if at the first attempt the order of the switches were wrong.
2. Two “TGROUP_NOT” after each other always produce an “or” connection: “not this or not that”. (If you want an “and” connection – “not this and not that” -, then place the two “TGROUP_NOT” trigger in a separated triggergroup, and define that triggergroup as a subject of a MultEnvCondition. Then use that MultEnvCondition as the required condition, in “AND” way.)
So now we have an “or” connection between Switch2 and 3 conditions, but it doesn’t matter. I mean, if either Switch2 or Switch3 is switched on, then the order won’t be proper if you switch on Switch1 after that. So we don’t need a “Switch2 AND Switch3 are switched on” condition now.

3.3. Defining the second switch to switch on

GlobalTrigger5 will activate TriggerGroup6 if TriggerGroup7 is true. It means if Switch2 is switched on (i.e. if the switch is just performing Animation2: $9000, 15, $215) and Local Byte Alfa1 is 1 (i.e. if Switch1 has been switched before: $8000, 64, $12B), but Switch3 isn’t switched on ($9000+TGROUP_NOT, 24, $215) then the game will add Value 1 to Local Byte Alfa1 – so Local Byte Alfa 1 is 2 now if Lara pushed Switch1 and then Switch2 but didn’t push Switch3.

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:60) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 1
; Values to add in script command: $8000, 64, $12B

Note:

Naturally, FGT_SINGLE_SHOT_RESUMED is also necessary now.

3.4. Defining the third switch to switch on

GlobalTrigger6 will activate TriggerGroup9 if TriggerGroup8 is true. It means if Switch3 is switched on (i.e. if the switch is just performing Animation2: $9000, 24, $215) and Local Byte Alfa1 is 2 (i.e. if Switch1 and 2 has been switched before in the right order: $8000, 64, $22B) then the game will open the door:

; Set Trigger Type - ACTION 43
; Exporting: TRIGGER(43:0) for ACTION(14)
; <#> : DOOR_TYPE4 ID 14
; <&> : Trigger. (Moveable) Activate <#>Object with (E)Timer value
; (E) : Timer= +00
; Values to add in script command: $5000, 14, $2B


3.5. Resetting the switches

GlobalTrigger7 will activate TriggerGroup11 if TriggerGroup10 is true. It means if all the switches are switched on (i.e. if all of them perform Animation2) but the door is closed ($9000, 14, $40E) then the game will force Animation3 (“go to the starting position”) on all the three switches and turn the variable into 0:

; Set Trigger Type - CONDITION 14
; Exporting: CONDITION(14:54) for OBJECT(14)
; <#> : DOOR_TYPE2 ID 14
; <&> : Creature. <#>Creature is currently (E)
; (E) : Enemy is not active
; Values to add in script command: $9000, 14, $40E

; Set Trigger Type - ACTION 15
; Exporting: TRIGGER(783:0) for ACTION(25)
; <#> : LEVER_SWITCH ID 25
; <&> : Force (E) animation (0-31) for <#>object
; (E) : 3 Animation
; Values to add in script command: $5000, 25, $30F

; Set Trigger Type - FLIPEFFECT 232
; Exporting: TRIGGER(64:0) for FLIPEFFECT(232)
; <#> : Variables. Numeric. Set <&>Variable with (E)value
; <&> : Local Byte Alfa1
; (E) : Value 0
; Values to add in script command: $2000, 232, $40


So, after pushing all of them – except if they were pushed in the right order, i.e. if the door is open now – the game will reset the switches and the variable as well, for a newer attempt.

Important! If GlobalTrigger7 is placed in the Script before the other GlobalTriggers that may disturb the proper working of the setup.

Notes:

1. It’s easy to identify the object in the A15 trigger: i.e. see the numbers that are written in red above. (I say that because now you can identify $5000, 15, $30F and $5000, 24, $30F triggers.)
2. If you use “the switches are all on and the variable is not 2” condition instead of “the switches are all on and the door is closed” condition, that will do the same now.
And maybe it is important. I mean, eg. if you used the switches to activate a flipmap and not to activate an object, then you can’t use an “if the object is inactive” condition.


And what if I want to open another door by the switches, too?

So, I’m talking about the case, when there is another door placed (eg. it’s ID117 now) as well, and you will open that if you switch on the switches in another order now. Let’s say this order is 3-1-2.
This is how it works now:

If you push the switches in one of the required orders (1-2-3) then the placed doorID14 will open. The switches won’t be reset automatically after pushing all of them if doorID117 is also open now, but they will, if that isn’t.
If you push the switches in one of the required orders (3-1-2) then the placed doorID117 will open. The switches won’t be reset automatically after pushing all of them if doorID14 is also open now, but they will, if that isn’t.
If you don’t push the switches in any of the required orders then none of the doors will open. The switches will be reset automatically after pushing all of them.
If you have pushed a switch then you can’t pushed it back directly by Lara into the starting position.
There is no any other task that the switches should do now.

THE SETUP

Supposing you are just using the “one door setup” now:

1. In WADMerger Animation Editor

Don’t do anything new.

2. In Room Editor

Just place the doorID117 anywhere.

3. In NG Center

Edit the Script, i.e. type the green text in it:

GlobalTrigger= 1, IGNORE, GT_CONDITION_GROUP, IGNORE, 1, 4, IGNORE
TriggerGroup= 1, $8000, 324, $1E, $9000, 25, $215
GlobalTrigger= 2, IGNORE, GT_CONDITION_GROUP, IGNORE, 2, 4, IGNORE
TriggerGroup= 2, $8000, 324, $1E, $9000, 15, $215
GlobalTrigger= 3, IGNORE, GT_CONDITION_GROUP, IGNORE, 3, 4, IGNORE
TriggerGroup= 3, $8000, 324, $1E, $9000, 24, $215
TriggerGroup= 4, $2000, 77, $67
GlobalTrigger= 4, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 5, 6, IGNORE
TriggerGroup= 5, $9000, 25, $215, $9000+TGROUP_NOT, 15, $215, $9000+TGROUP_NOT, 24, $215
TriggerGroup= 6, $2000, 231, $140
GlobalTrigger= 5, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 7, 6, IGNORE
TriggerGroup= 7, $8000, 64, $12B, $9000, 15, $215, $9000+TGROUP_NOT, 24, $215
GlobalTrigger= 6, IGNORE, GT_CONDITION_GROUP, IGNORE, 8, 9, IGNORE
TriggerGroup= 8, $8000, 64, $22B, $9000, 24, $215
TriggerGroup= 9, $5000, 14, $2B
GlobalTrigger= 8, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 12, 13, IGNORE
TriggerGroup= 12, $9000, 24, $215, $9000+TGROUP_NOT, 15, $215, $9000+TGROUP_NOT, 25, $215
TriggerGroup= 13, $2000, 231, $340
GlobalTrigger= 9, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 14, 6, IGNORE
TriggerGroup= 14, $8000, 64, $12B, $9000, 25, $215, $9000+TGROUP_NOT, 15, $215
GlobalTrigger= 10, IGNORE, GT_CONDITION_GROUP, IGNORE, 15, 16, IGNORE
TriggerGroup= 15, $8000, 64, $22B, $9000, 15, $215
TriggerGroup= 16, $5000, 117, $2B

GlobalTrigger= 7, IGNORE, GT_CONDITION_GROUP, IGNORE, 10, 11, IGNORE
TriggerGroup= 10, $9000, 25, $215, $9000, 15, $215, $9000, 24, $215, $9000, 14, $40E, $9000+TGROUP_OR, 117, $40E
TriggerGroup= 11, $5000, 25, $30F, $5000, 15, $30F, $5000, 24, $30F, $2000, 232, $40

3.1. Preventing Lara from switching off the switches manually

You didn’t do anything new about that in the Script.

3.2. Defining the first switch to switch on

- For 1-2-3 sequence (doorID14): as I said above, GlobalTrigger4 and TriggerGroup5 and 6 will care about it.
- For 3-1-2 sequence (doorID117): GlobalTrigger8 and TriggerGroup12 and 13 will care about it.

The difference between the two sequences is 1-2-3 sequence will use the variable value 1 and then the variable value 2, but 3-1-2 sequence will use the variable value 3 and then the variable value 4. That’s why GlobalTrigger8 won’t use TriggerGroup6 to turn the starting variable value from 0 into 1 but will use TriggerGroup13 to turn that 0 into 3.

; Set Trigger Type - FLIPEFFECT 231
; Exporting: TRIGGER(832:0) for FLIPEFFECT(231)
; <#> : Variables. Numeric. Add to <&>Variable the (E)value
; <&> : Local Byte Alfa1
; (E) : Value 3
; Values to add in script command: $2000, 231, $340


3.3. Defining the second switch to switch on

- For 1-2-3 sequence (doorID14): as I said above, GlobalTrigger5 and TriggerGroup7 and 6 will care about it.
- For 3-1-2 sequence (doorID117): GlobalTrigger9 and TriggerGroup14 and 6 will care about it.

So GlobalTrigger5 will use TriggerGroup6 to turn the variable value from 1 into 2, and GlobalTrigger9 will also use that to turn the variable value from 3 into 4.

3.4. Defining the third switch to switch on

- For 1-2-3 sequence (doorID14): as I said above, GlobalTrigger6 and TriggerGroup8 and 9 will care about it.
- For 3-1-2 sequence (doorID117): GlobalTrigger10 and TriggerGroup15 and 16 will care about it.

3.5. Resetting the switches

This time you must type this trigger into TriggerGroup10: $9000+TGROUP_OR, 117, $40E. So the switches will be reset only if any of the doors is closed.
But if both of them are open then the switches won’t be reset any more.


Made using TRNG 1.2.2.6.

Last edited by AkyV; 24-05-12 at 08:50.
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 22:01.


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