12-06-16, 22:08 | #1 | ||||||||||||||
Member
Joined: Apr 2009
Posts: 1,442
|
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. ------------------- AkyV's note: If you install AkyVMix01 plugin, then there is an easier way to check the orientation of Turn Switch object. See this Condition trigger there: C215: Object generally. Moveable (including Lara) or Statics object has <#> orientation -------------------- 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:
Quote:
; 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:
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:
; <#> : 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:
; <#> : 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:
Quote:
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:
; 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:
Door B - East (16384) Remember our PARAM_BIG_NUMBERS command: Quote:
; 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:
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:
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:
Here is the final script: Quote:
To understand further directions, see this image (added by AkyV): Last edited by AkyV; 06-10-19 at 10:54. |
||||||||||||||
Thread Tools | |
|
|