Tomb Raider Forums  

Go Back   Tomb Raider Forums > Tomb Raider Level Editor and Modding > Tomb Raider Level Editor > Tutorials and Resources

Closed Thread
 
Thread Tools
Old 19-09-16, 22:53   #1
AkyV
Moderator
 
Joined: Dec 2011
Posts: 4,881
Default TRNG – Disabling switches

Made using TRNG 1.2.2.7.+

Some segments of this tutorial are based on Titak’s ideas.

Notes:
  • I didn’t study TURN_SWITCH and SEQUENCE_SWITCH1-3 which have a special setup.
  • I don’t think it’s worth fiddling with a workaround to make Lara say “no” in these setups when the switch is just useless. However, if you want that, then you need a GlobalTrigger that activates a flipeffect to play the “no” sound. Eg. in the case of the fake StateID the GlobalTrigger has these conditions: “if the object performs StateID 3, plus, Lara is in the proper TestPosition to the ON or the OFF side of the switch, plus, the player hits the Action key, plus, her hand is not engaged”.
    “Engaged” means if she has the torch or the weapons in the hands.
    (Probably only the memory zone based setup of pulley will make Lara say “no” automatically.)
  • If you’d like to use a “switch is enabled/disabled” condition, then study the main argument of the method. For example, in the case of fake StateID you need a “if StateID is 3 or not” condition to get the information about the switch is enabled or disabled.
1. Method of forcing a fake StateID

It disables the switch temporarily or permanently.

Tested successfully with these switches:
  • lever on floor (LEVER_SWITCH of Playable Tutorial Level)
  • switch for a crowbar (CROWBAR_SWITCH of Citadel Gate)
  • switch to grab with a jump (JUMP_SWITCH of Alexandria)
  • underwater wall lever (UNDERWATER_SWITCH of TR3 Jungle, tested in UNDERWATER_SWITCH1 slot in NGLE)
  • underwater ceiling lever (UNDERWATER_SWITCH2 of Citadel)
It is very simple. Just force a StateID which is not used in the setup of the switch.
For example, open a LEVER_SWITCH in WADMerger Animation Editor. As you see, StateID 0, 1 and 2 are used in the setup. So, if you force StateID 3, the lever will be useless (either being in ON or OFF position) while you forcing that state.

The setup is:

Step1
Place an F118 (in “continuous” mode) or an F373 trigger anywhere in the map, to start TriggerGroup#1 in “continuous” mode.
If you activate this trigger, then the switch will be disabled in the actual (ON or OFF) position.

TriggerGroup#1 has only one (A90) trigger:

; Set Trigger Type - ACTION 90
; Exporting: TRIGGER(858:0) for ACTION(X)
; <#> : LEVER_SWITCH ID X
; <&> : Creature. Force for <#>Moveable the (E)State-id
; (E) : State Id 3
; Values to add in script command: $5000, X, $35A

Yes, there is only one trigger in the TriggerGroup, but we need the TriggerGroup for the continuous activation, because an A90 trigger just placed in the map would be activated only in “single” mode.
“Single” A90 triggers will lose their effect if you save the game and then load it.

Step2
Place an F118 (in “single” mode) or an F371 trigger anywhere in the map, to start TriggerGroup#2.
If you activate this trigger, then the switch will be enabled again, restoring the original StateIDs.

TriggerGroup= 2, $2000, 192, $1, > ; F192: to stop the continuous activation of TriggerGroup#1 (so the disablement can be aborted now)
$9000, X, $15, > ; C21: if the switch actual animation is Animation0 (“being in OFF position”, one framed loop animation)
$5000, X, $5A, > ; A90: forces StateID 0 (the original StateID of Animation0)
$9000+TGROUP_ELSE, X, $215, > ; C21: or else if the switch actual animation is Animation2 (“being in ON position”, one framed loop animation)
$5000, X, $15A; A90: forces StateID 1 (the original StateID of Animation2)

Notes:
  • Please don’t forget to check in WADMerger Animation Editor if the ON and OFF animation is Animation0 and 2 in the case of your switch, and their StateID is 0 and 1. And if StateID 3 is really unused in your case.
    Modify the triggers in the setup if they are not true.
  • See more about “single” and “continuous” modes here.
  • If Lara doesn’t need to use the switch in ON position (like a JUMP_SWITCH), then TriggerGroup#2 is shorter:

    TriggerGroup= 2, $2000, 192, $1, > ; F192: to stop the continuous activation of TriggerGroup#1 (so the disablement can be aborted now)
    $5000, X, $5A ; A90: forces StateID 0 (the original StateID of Animation0)

  • If you want to disable more than one switch at the same time, the you naturally need an A90 trigger for each of them in the TriggerGroup.
2. Method of a fake activation

It disables the switch permanently.

Tested successfully with these switches:
  • big lever on wall (SWITCH_TYPE1 of Citadel Gate)
  • small electric lever on wall (SWITCH_TYPE2 of TR3 Area 51)
  • big button on wall (SWITCH_TYPE1 of Catacombs)
  • small button on wall (SWITCH_TYPE2 of Temple of Karnak)
  • small electric button on wall (SWITCH_TYPE3 of TR3 Aldwych)
  • valve switch (of TR2 OffShore Rig, having “ObjectID 92” name in WADMerger, tested in SWITCH_TYPE1 slot in NGLE)
  • keypad (SWITCH_TYPE1 of Paolone’s elevator test project)
  • “hole in the wall” (SWITCH_TYPE1 of The Tomb of Seth)
  • underwater wall lever (UNDERWATER_SWITCH of TR3 Jungle, tested in UNDERWATER_SWITCH1 slot in NGLE)
All you have to do is activate the switch with a common trigger, like:

TRIGGER (0:0) for SWITCH_TYPE1 (X)

Or with a similar ACTION trigger:

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

Now the lever will be useless either being in ON or OFF position,

Notes:
  • Don’t use this method for timed switches.
  • The switch won’t be useable again if you try to “deactivate it” with an “antitrigger”.
  • A useable setup of valve switches can be found here.
3. Method of forcing a non-existing animation

It disables the switch temporarily or permanently.

Tested successfully with these switches:
  • big lever on wall (SWITCH_TYPE1 of Citadel Gate)
  • small electric lever on wall (SWITCH_TYPE2 of TR3 Area 51)
  • big button on wall (SWITCH_TYPE1 of Catacombs)
  • small button on wall (SWITCH_TYPE2 of Temple of Karnak)
  • small electric button on wall (SWITCH_TYPE3 of TR3 Aldwych)
  • valve switch (of TR2 OffShore Rig, having “ObjectID 92” name in WADMerger, tested in SWITCH_TYPE1 slot in NGLE)
  • keypad (SWITCH_TYPE1 of Paolone’s elevator test project)
  • “hole in the wall” (SWITCH_TYPE1 of The Tomb of Seth)
Switches with the name of “SWITCH_TYPE” can use different Lara animations, depending on what number you type in their OCB window.
If you type -1, then that will refer to a non-existing animation, so Lara can’t use the switch.

The proper OCB codes:
  • It is 0 usually.
  • See WADMerger Switch Manager.
  • See _NEW Switch 1/2/3 in NG Center/Reference/OCB list. (According to my experiences it will work not only for SWITCH_TYPE1, 2 or 3 but even for some other SWITCH_TYPEs.)
The setup is:

Step1
Type the proper code in the OCB window, then place an F118 (in “continuous” mode) or an F373 trigger anywhere in the map, to start TriggerGroup#1 in “continuous” mode.
If you activate this trigger, then the switch will be disabled in the actual (ON or OFF) position.

TriggerGroup#1 has only one (A79) trigger:

; Set Trigger Type - ACTION 79
; Exporting: TRIGGER(79:0) for ACTION(X)
; <#> : SWITCH_TYPE1 ID X
; <&> : Enemy. (OCB) Change the OCB value of <#>Moveable with (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 0
; Values to add in script command: $5000, X, $4F

Yes, there is only one trigger in the TriggerGroup, but we need the TriggerGroup for the continuous activation, because an A79 trigger just placed in the map would be activated only in “single” mode.
“Single” A79 triggers will lose their effect if you save the game and then load it.

As you see in the trigger, we refer to PARAM_BIG_NUMBERS#0, but you can naturally refer to another PARAM_BIG_NUMBERS ID, if you want. What matters is you need to type -1 in that ID in the Script.

Step2
Place an F118 (in “single” mode) or an F371 trigger anywhere in the map, to start TriggerGroup#2.
If you activate this trigger, then the switch will be enabled again, restoring the proper OCB code.

TriggerGroup= 2, $2000, 192, $1, > ; F192: to stop the continuous activation of TriggerGroup#1 (so the disablement can be aborted now)
$5000, X, $14F ; A79: just like the A79 above, it also forces a PARAM_BIG_NUMBERS into the OCB code of object X, but this time it is PARAM_BIG_NUMBERS#1, where the proper code is typed

Notes:
  • So I also use this Script entry in this setup:

    Parameters= PARAM_BIG_NUMBERS, -1, the proper OCB code

  • Naturally your switch will be disabled initially if you type -1 in the OCB window.
    But in this setup if you want your switch to be disabled initially then type the proper code, as I said, and place the trigger for TriggerGroup#1 under Lara object.
  • A useable setup of valve switches can be found here.
4. Method of using a switch-related memory zone property

It disables the switch temporarily or permanently.

Tested successfully with these switches:
  • switch for a crowbar (CROWBAR_SWITCH of Citadel Gate)
  • pulley (PULLEY of The Tomb of Seth)
The setup is:

Step1
Place an F118 (in “continuous” mode) or an F373 trigger anywhere in the map, to start TriggerGroup#1 in “continuous” mode. (I have already explained above why we need a continuous TriggerGroup.)
If you activate this trigger, then the switch will be disabled in the actual (ON or OFF) position.

TriggerGroup= 1, $5000, X, $36, > ; A54: define object with ID X, for item memory zone
$2000, 255, $11Y ; disable object

Y values are:
5 – crowbar switch
6 - pulley

Step2
Place an F118 (in “single” mode) or an F371 trigger anywhere in the map, to start TriggerGroup#2.
If you activate this trigger, then the switch will be enabled again.

TriggerGroup= 2, $2000, 192, $1, > ; F192: to stop the continuous activation of TriggerGroup#1 (so the disablement can be aborted now)
$5000, X, $36, > ; A54: define object with ID X, for item memory zone
$2000, 255, $1Y ; enable object

Y values are:
5 – crowbar switch
6 - pulley

5. Method of forcing a fake object slot

It disables the switch temporarily or permanently.

Tested successfully with these switches:
  • shootable switch (SWITCH_TYPE8 of The Lost Library)
  • breakable switch (SWITCH_TYPE7 of Trenches)
Place the copy of the switch into an unused Moveable (mostly an ANIMATING) slot.
Then force that “fake” object slot instead of the switch slot, so the “switch” won’t detect if Lara’s bullet hits it.

The setup is:

Step1
Place an F118 (in “continuous” mode) or an F373 trigger anywhere in the map, to start TriggerGroup#1 in “continuous” mode.
If you activate this trigger, then the switch will be disabled.

TriggerGroup= 1, $5000, X, $36, > ; A54: define switch object with ID X
$2000, 261, $3 ; F261: forces fake object slot ID, typed at Parameters=PARAM_BIG_NUMBERS#0

In this F261 trigger, we refer to PARAM_BIG_NUMBERS#0, but you can naturally refer to another PARAM_BIG_NUMBERS ID, if you want. What matters is you need to type the fake slot ID there in the Script.

Step2
Place an F118 (in “single” mode) or an F371 trigger anywhere in the map, to start TriggerGroup#2.
If you activate this trigger, then the switch will be enabled again, restoring the original object slot.

TriggerGroup= 2, $2000, 192, $1, > ; F192: to stop the continuous activation of TriggerGroup#1 (so the disablement can be aborted now)
$5000, X, $36, > ; A54: define switch object with ID X
$2000, 261, $103 ; F261: forces switch object slot ID, typed at Parameters=PARAM_BIG_NUMBERS#1

Notes:
  • See object slot IDs in NG Center/Reference/Slot Moveables indices list.
  • So I also use this Script entry in this setup:

    Parameters= PARAM_BIG_NUMBERS, ANIMATING slot ID, switch slot ID

  • The setup won’t work with switches that are active (moving) before hitting them (like SWITCH_TYPE7 of City of the Dead).
  • Switches that should be move when Lara’s bullet hits them (like SWITCH_TYPE8 of The Lost Library) won’t move if they are being disabled when Lara hits them.
  • The setup will be valid for all the similar switches at the same time. So eg. if you want to disable a breakable switch then all the breakable switches of the level will be disabled.
6. Method with a TestPosition

It disables the switch temporarily or permanently.

Tested successfully with cog switch (COG_SWITCH of Chambers of Tulun).

Lara can’t use Key Action (to use the switch) when she is in the required position to the switch.

The setup is:

Step1
Place an F109 or F374 trigger anywhere in the map, to enable GlobalTrigger#1.
If you activate this trigger, then the switch will be disabled in the actual (ON or OFF) position.

This is what you need to type in the Script:

GlobalTrigger= 1, FGT_DISABLED, > ; so the GlobalTrigger is disabled initially
GT_CONDITION_GROUP, IGNORE, 1, 2, 3 ; so the condition for the GlobalTrigger is in TriggerGroup#1, if it is true then TriggerGroup#2 will be executed, or if it is false, then TriggerGroup#3 will be executed
TriggerGroup= 1, $8000, 1, $10, > ; C16: if MultEnvCondition#1 is true
$8000+TGROUP_NOT, 4, $F ; C15: and if TriggerGroup#4 is not true
TriggerGroup= 2, $2000, 51, $9 ; F51: disable CTRL
TriggerGroup= 3, $2000, 52, $9 ; F52: enable CTRL again
TriggerGroup= 4, $8000, 1, $23, $8000+TGROUP_OR, 2, $23, $8000+TGROUP_OR, 3, $23, >
$8000+TGROUP_OR, 4, $23, $8000+TGROUP_OR, 5, $23, $8000+TGROUP_OR, 6, $23, $8000+TGROUP_OR, 16, $23 ; C35: if Lara is holding any weapon or torch
TestPosition= 1, TPOS_TEST_ITEM_INDEX+TPOS_FOUR_HORIENT, X, > ; Position condition for Object ID X, on all the four sides
-540, 540, -100, 100, -1600, -600, -5400, 5400, -100, 100, -100, 100 ; coordinates
MultEnvCondition= 1, ENV_ITEM_TEST_POSITION, 1, IGNORE ; TestPosition#1=MultEnvCondition#1

Notes:
  • If she holds a weapon or a torch in that position, she will be able to shoot or drop the torch. But she won’t be able to do anything else in that position what needs Key ACTION. (Like picking up a flare dropped.)
    See this tutorial if you’d like to use ACTION in the menus when the key is disabled.
  • This MultEnvCondition has only one condition, which means we needed to choose an “AND” type execution instead of an “OR” type in C16 trigger.
  • “On all the four sides” means this condition will work not only in position for which the coordinates are made (which is the object position without any rotation), but even if you rotate the object with 90, 180 or 270 degrees.
Probably TPOS_FOUR_HORIENT results in disabling ACTION in some other tiny positions just around the switch as well, not only in the required position. If that bothers you then remove TPOS_FOUR_HORIENT. But in that case you need to calculate TestPosition coordinates yourself, avoiding the recommended one, if you rotate the switch with 90, 180 or 270 degrees.
However, you need to calculate TestPosition coordinates yourself everyway if you rotate the switch, but not with 90, 180 or 270 degrees.

Step2
Place an F109 or F375 trigger anywhere in the map, to disable GlobalTrigger#1 again.
If you activate this trigger, then the switch will be enabled again.

7. Using switches a limited times

For example you want this setup:

Lara moves a lever switch to activate a flame.
Then she moves the lever again to deactivate the flame.
Then she moves the lever again to activate the flame again.
If she tries to move the switch fourthly, then she can’t, because the switch is disabled.

So you need a condition (“it was used three times”) to start the “disable the switch” setup.
We need an A90 in TriggerGroup#1 to force StateID 3 to disable a lever switch, I said above.
So we need this GlobalTrigger now:

GlobalTrigger= 1, IGNORE, GT_CONDITION_GROUP, IGNORE, 3, 4, IGNORE
TriggerGroup= 3, $8000, 64, $32B ; C43: if Local Byte Alfa1 (LBA1) variable is 3
TriggerGroup= 4, $2000, 118, $201; F118: to start TriggerGroup#1 in “continuous” mode

First use (=switch moves to ON position): it adds 1 to LBA1 (LBA1=1)
Second use (=switch moves to OFF position): it adds 1 to LBA1 (LBA1=2)
Third use (=switch moves to ON position): it adds 1 to LBA1 (LBA1=3)

So you need one more GlobalTrigger:

GlobalTrigger= 2, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 5, 6, IGNORE
TriggerGroup= 5, $9000, X, $115, > ; C21: if the switch actual animation is Animation1 (“moving to ON position”)
$9000+TGROUP_OR, X, $315 ; C21: or if the switch actual animation is Animation3 (“moving to OFF position”)
TriggerGroup= 6, $2000, 231, $140 ; F231: it adds 1 to LBA1

Note:
FGT_SINGLE_SHOT_RESUMED is necessary or else 1 will be added to the variable all the time while the switch moves to ON/OFF position.
AkyV is online now  
Closed Thread

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:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Tomb Raider Forums is not owned or operated by CDE Entertainment Ltd.
Lara Croft and Tomb Raider are trademarks of CDE Entertainment Ltd.