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 12-06-16, 22:08   #1
Shakira Croft
Archaeologist
 
Shakira Croft's Avatar
 
Join Date: Apr 2009
Location: Switzerland
Posts: 1,363
Default TRNG - Turn Switch

The Turn Switch with TRNG

In this tutorial I'll show you how to set up different events thanks to variables with TRNG.
The Turn Switch is the only required object. You don't need the obelisks and the hammers from TR4.

In this exemple, we'll use 4 doors that will be opened according to the direction of the Turn Switch. When the Turn Switch will face North, the North door will open etc.

Don't forget to change the numbers in red!

The Turn Switch
First of all we will write a command that allows us to select the Turn Switch (via its index):

; Exporting: TRIGGER(54:0) for ACTION(2703)
; <#> : TURN_SWITCH ID 2703 in sector (9,6) of Room132
; <&> : Variables. Set the index of <#>moveable as Selected Item
; (E) :
; Values to add in script command: $5000, 2703, $36

Now we'll have to store the orientation of the Turn Switch in a varaible:

; Exporting: TRIGGER(7444:0) for FLIPEFFECT(256)
; <#> : Variables. Memory. Copy to <&> Numeric Variable the (E)Selected Item Memory
; <&> : Global Short Delta1
; (E) : Facing Horizontal (Short)
; Values to add in script command: $2000, 256, $1D14

Now we can create a TriggerGroup to store those datas:

Quote:
TriggerGroup= 95, $5000, 2703, $36, $2000, 256, $1D14 (this TriggerGroup will change at the end!)
Now we'll ad this TriggerGroup in a GlobalTrigger in order that it's played at any time:

Quote:
GlobalTrigger= 90, IGNORE, GT_ALWAYS, IGNORE, IGNORE, 95, IGNORE
If we want the Turn Switch to be in the same position after we reload the game, we'll have to redefine its position after each load:

; Set Trigger Type - FLIPEFFECT 257
; Exporting: TRIGGER(7509:0) for FLIPEFFECT(257)
; <#> : Variables. Memory. Copy from <&>Numeric Variable to (E)Selected Item Memory
; <&> : Global Short Delta1
; (E) : Facing Horizontal (Short)
; Values to add in script command: $2000, 257, $1D14

Quote:
TriggerGroup= 105, $2000, 257, $1D14
GlobalTrigger= 105, INGORE, GT_AFTER_RELOADING_VARIABLES, 3, IGNORE, 105, IGNORE
Now, we'll have to know the data of the four directions the Turn Switch can have: North, South, East and West. To do that, we'll have to enable the Diagnostic command and run the game!



For exemple, here, when the Turn Switch faces South, the value is 0.
North: -32768
East: 16384
West: -16384

Door A - South (0)
Now we'll have to write a condition that says: if the Turn Switch faces X direction the corresponding door will open and if it doesn't face that direction the door will stay closed. In order to do that we'll need another GlobalTrigger with a condition:

; <#> : Global Short Delta1
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 0
; Values to add in script command: $8000, 20, $2B
Quote:
TriggerGroup= 91, $8000, 20, $2B ;If the variable = 0 then the condition is OK
; Exporting: TRIGGER(282:62) for ACTION(2679)
; <#> : DOOR_TYPE4 ID 2826 in sector (8,2) of Room67
; <&> : Trigger. (Door) (E)Open/Close <#>door
; (E) : Open the door
; Values to add in script command: $5000, 2826, $11A
Quote:
TriggerGroup= 92,$5000, 2826, $11A ; open door A (ID 2826)
; Exporting: TRIGGER(26:62) for ACTION(2679)
; <#> : DOOR_TYPE4 ID 2826 in sector (8,2) of Room67
; <&> : Trigger. (Door) (E)Open/Close <#>door
; (E) : Close the door
; Values to add in script command: $5000, 2826, $1A
Quote:
TriggerGroup= 93, $5000, 2826, $1A ; close door A (ID 2826)
And here is the GlobalTrigger for the door A:

Quote:
GlobalTrigger= 91, IGNORE, GT_CONDITION_GROUP, IGNORE, 91, 92, 93
PARAM_BIG_NUMBERS
For some technical reasons, it is not possible to have a trigger's number bigger than 255 in NGLE. The problem is that we have three orientation whose values are bigger than 255. To avoid this we have to use a script command that allows us to use big numbers. I won't explain how this command works but here is what you'll have in your script:
Quote:
Parameters= PARAM_BIG_NUMBERS, 32768, 16384, 16384
We now face another problem: tow of those numbers are actually negative numbers (-32768 and -16384) but the PARAM_BIG_NUMBERS only allows positive numbers. That's why we have to take back our first TriggerGroup (with ID 95) in order to add two flipeffect that allow us to:
  • store the value in another varaible
  • invert the value of that new variable:

; Exporting: TRIGGER(7440:0) for FLIPEFFECT(256)
; <#> : Variables. Memory. Copy to <&> Numeric Variable the (E)Selected Item Memory
; <&> : Global Short Alfa1
; (E) : Facing Horizontal (Short)
; Values to add in script command: $2000, 256, $1D10

; Exporting: TRIGGER(16:0) for FLIPEFFECT(284)
; <#> : Variables. Numeric. Invert the sign of <&>Numeric Variable
; <&> : Global Short Alfa1
; (E) :
; Values to add in script command: $2000, 284, $10

Global Short Alfa applies for negative values so the new TriggerGroup becomes:
Quote:
TriggerGroup= 95, $5000, 2703, $36, $2000, 256, $1D14, $2000, 256, $1D10, $2000, 284, $10
AkyV's note: Short variable can handle values only between -32768 and 32767. So if you want that 32768 value for Door C setup (see below), then you should choose a Long variable.

Door B - East (16384)

Remember our PARAM_BIG_NUMBERS command:
Quote:
Parameters= PARAM_BIG_NUMBERS, 32768, 16384, 16384
We'll keep the first two values for the negative numbers so we'll take the third one (which is the one in index 2!)

; Exporting: CONDITION(38:58) for PARAMETER(20)
; <#> : Global Short Delta1
; <&> : Variables. The <#>Numeric Variable is >= than (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 2
; Values to add in script command: $8000, 20, $226

Quote:
TriggerGroup= 96, $8000, 20, $226 ; condition for the number in index 2
TriggerGroup= 97, $5000, 2827, $11A ; open door B (ID=2827)
TriggerGroup= 98, $5000, 2827, $1A ; close door B (ID=2827)
GlobalTrigger= 92, IGNORE, GT_CONDITION_GROUP, IGNORE, 96, 97, 98
Door C - North (-32768)
This time we'll use the first value of the PARAM_BIG_NUMBERS

; Exporting: CONDITION(38:62) for PARAMETER(16)
; <#> : Global Short Alfa1
; <&> : Variables. The <#>Numeric Variable is >= than (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 0
; Values to add in script command: $8000, 16, $26
Don't forget that this value is stocked in Global short Alpha!

Quote:
TriggerGroup= 99, $8000, 16, $26; condition for the number in index 0
TriggerGroup= 100, $5000, 2822, $11A ; open door C (ID=2822)
TriggerGroup= 101, $5000, 2822, $1A ; close door C (ID=2822)
GlobalTrigger= 93, IGNORE, GT_CONDITION_GROUP, IGNORE, 99, 100, 101
Door D - West (-16384)
This time we'll use the second value of the PARAM_BIG_NUMBERS

; Exporting: CONDITION(38:60) for PARAMETER(16)
; <#> : Global Short Alfa1
; <&> : Variables. The <#>Numeric Variable is >= than (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 1
; Values to add in script command: $8000, 16, $126
Don't forget that this value is stocked in Global short Alpha!

Quote:
TriggerGroup= 102, $8000, 16, $126; condition for the number in index 1
TriggerGroup= 103, $5000, 2823, $11A ; open door D (ID=2823)
TriggerGroup= 104, $5000, 2823, $1A ; close door D (ID=2823)
GlobalTrigger= 94, IGNORE, GT_CONDITION_GROUP, IGNORE, 102, 103, 104
And that's it!
Here is the final script:

Quote:
Parameters= PARAM_BIG_NUMBERS, 32768, 16384, 16384

TriggerGroup= 95, $5000, 2703, $36, $2000, 256, $1D14, $2000, 256, $1D10, $2000, 284, $10

TriggerGroup= 105, $2000, 257, $1D14
GlobalTrigger= 105, INGORE, GT_AFTER_RELOADING_VARIABLES, 3, IGNORE, 105, IGNORE

;--Door A--
TriggerGroup= 91, $8000, 20, $2B ;If the variable = 0 then the condition is OK
TriggerGroup= 92,$5000, 2826, $11A ; open door A (ID 2826)
TriggerGroup= 93, $5000, 2826, $1A ; close door A (ID 2826)
GlobalTrigger= 91, IGNORE, GT_CONDITION_GROUP, IGNORE, 91, 92, 93

;--Door B--
TriggerGroup= 96, $8000, 20, $226 ; condition for the number in index 2
TriggerGroup= 97, $5000, 2827, $11A ; open door B (ID=2827)
TriggerGroup= 98, $5000, 2827, $1A ; close door B (ID=2827)
GlobalTrigger= 92, IGNORE, GT_CONDITION_GROUP, IGNORE, 96, 97, 98

;--Door C--
TriggerGroup= 99, $8000, 16, $26; condition for the number in index 0
TriggerGroup= 100, $5000, 2822, $11A ; open door C (ID=2822)
TriggerGroup= 101, $5000, 2822, $1A ; close door C (ID=2822)
GlobalTrigger= 93, IGNORE, GT_CONDITION_GROUP, IGNORE, 99, 100, 101

;--Door D--
TriggerGroup= 102, $8000, 16, $126; condition for the number in index 1
TriggerGroup= 103, $5000, 2823, $11A ; open door D (ID=2823)
TriggerGroup= 104, $5000, 2823, $1A ; close door D (ID=2823)
GlobalTrigger= 94, IGNORE, GT_CONDITION_GROUP, IGNORE, 102, 103, 104
In this example, we used four doors for the four cardinal directions but let your imagination guide you

To understand further directions, see this image (added by AkyV):
__________________
Here is my life in the spotlight, spotlight... ♪

Last edited by AkyV; 28-10-16 at 10:55.
Shakira Croft is offline  
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 16:53.


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