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 07-01-15, 07:40   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default TRNG A couple of interesting situations with timers

Instructions:

1. Copy the setup in your Script.
2. Build the Script.

Special instructions, if the Script doesn’t work/cannot be built:

1. Check TriggerGroup and GlobalTrigger ID’s and change them if you are already using the ID in another TriggerGroup/GlobalTrigger.
2. If you already have a Parameters= PARAM_BIG_NUMBERS command at your level, then remove the same command of the setup you’ve just copied, and type the amount value of the removed command into the old command.
3. Open the Find Trigger Number window in Set Trigger Type panel, and copy-paste the underlined triggers there (one by one), to check them:

- If you changed TriggerGroup/GlobalTrigger ID’s, then you also need to change the TriggerGroup/GlobalTrigger ID in the trigger (if it is a trigger about a TriggerGroup/GlobalTrigger).
- If you removed the new Parameters= PARAM_BIG_NUMBERS command, you need to check if the big number index is still okay in the trigger (if it is a trigger about big numbers). If it is not, then choose the good one.
- Maybe you need to choose another variable, because you can’t use the variables (Global Short Alfa2, Global Long Beta) I used in the setups. So choose another one now (if it is a trigger about variables), if it is needed.
You are never allowed to change Current Value variable!

Export the trigger you have changed, replacing the previous trigger in the Script.
3. Build the Script.

Don't forget: PARAM_BIG_NUMBERS position ID in the triggers, after the $ sign, must be typed in hexadecimal format!

Command:
X enable/disable screen timer

Screen timer is what you see running on the screen in TRLR when Lara and Von Croy are racing in Angkor Wat. This timer could be controlled in some new ways in TRNG.
However, when you use F86 to hide/show the timer, then the “hide” function removes+stops the timer, the “show” function shows it+starts it+turns it to 0. On the other hand, with this new enable/disable command, the “disable” function will remove it (not stopping it!), and the “enable” function will show it again. – So, with the new command, the timer will be able to run even in “hidden mode”, i.e. when you can’t see it on the screen. (Moreover, F86 is able to start/stop the timer even if that is just not seen.)

TriggerGroup= 1, $2000, 263, $Z0FF, > put the number at Z0 position of PARAM_BIG_NUMBERS (Z0 is 0 in this example) into Current Value variable
$2000, 278, $4 ;put the value of Current Value into the level flag field.
Parameters= PARAM_BIG_NUMBERS, Y0

Activate an F118 in “single” or “multiple” mode for TriggerGroup#1 to enable/disable the timer.

Y0 values are:
- if X is “enable”, then Y0 is 4096, plus the aggregated values of all the other existing level flags.
- if X is “disable”, then Y0 is the aggregated values of all the existing level flags. (Screen timer level flag doesn’t exist now.)

Level flag values are:

1: YoungLara
2: Weather
4: Horizon
8: Layer1
16: Layer2
32: StarField
64: Lightning
128: Train
256: Pulse
512: ColAddHorizon
1024: ResetHUB
2048: LensFlare
4096: Timer
8192: Mirror
16384: RemoveAmulet
32768: NoLevel

So, for example, if it is a level for the young Lara, with Layer1 on the sky, without other existing level flags in the script, then Y0 must be 1+8+4096= 4105, if you want to activate an F118 to enable the timer.
Or, if the existing flags are Train (128), ResetHUB (1024) and Timer (4096), then Y0 must be 128+1024=1152, if you want to activate an F118 to disable the timer.

Condition:
If screen timer is X enabled/disabled

“Enabled”: the timer is on the screen. / Or the timer will be on the screen if you activate an F86 in “show” mode.
“Disabled”: the timer is not on the screen, an F86 in “show” mode won’t put it on the screen. (You can start/stop it with F86, though.)

TriggerGroup= 1, $2000, 277, $4, >; put the level flag field.value into Current Value variable
$8000, 255, $Y028,> ;if Current Value is the number at Y0 position of PARAM_BIG_NUMBERS (Y0=0: first position, 1: second position etc.), Y0 is 0 in this example
W ;
Parameters= PARAM_BIG_NUMBERS, X0, X1, X2 etc.

W is one or more copies of this trigger:
$8000+TGROUP_OR, 255, $YV28: if Current Value is the number at YV position of PARAM_BIG_NUMBERS. V is 1, 2 etc., so YV values are Y1 second position, Y2 third position etc.

Let’s see some examples:

Only Timer flag exists, you want to study if that is just enabled (so if flag aggregated value is 4096 or not):

TriggerGroup= 1, $2000, 277, $4, >
$8000, 255, $028
Parameters= PARAM_BIG_NUMBERS, 4096

Only Timer flag exists, you want to study if that is just disabled (so if flag aggregated value is 0 or not):

TriggerGroup= 1, $2000, 277, $4, >
$8000, 255, $028
Parameters= PARAM_BIG_NUMBERS, 0

Only Timer, YoungLara and Layer1 flags exist, you want to study if screen timer is just enabled (so if flag aggregated value is 1+8+4096=4105 or not):

TriggerGroup= 1, $2000, 277, $4, >
$8000, 255, $028
Parameters= PARAM_BIG_NUMBERS, 4105

Only Timer, Train and ResetHUB flags exist, you want to study if screen timer is just disabled. You also want to disable Train and ResetHUB in the level (See F150 for the layer, I will tell later in another tutorial how it is possible with ResetHUB), so flag aggregated values are:
- Timer is just disabled, Train and ResetHUB are just enabled: 0+128+1024= 1152
- Timer and Train are just disabled, ResetHUB is just enabled: 0+0+1024= 1024
- Timer and ResetHUB are just disabled, Train is just enabled: 0+128+0= 128
- Timer, Train and ResetHUB are all disabled: 0+0+0= 0

TriggerGroup= 1, $2000, 277, $4, >
$8000, 255, $028,>
$8000+TGROUP_OR, 255, $128, >
$8000+TGROUP_OR, 255, $228, >
$8000+TGROUP_OR, 255, $328
Parameters= PARAM_BIG_NUMBERS, 1152, 1024, 128, 0

The easiest solutions to use the conditions:
- The TriggerGroup (1) ID is referred by a C15 trigger. There is a TRIGGER placed in the map, overlapped with the CONDITION trigger. The TRIGGER will be executed if Lara is in the trigger zone when the CONDITION is true.
- The TriggerGroup (1) ID is referred by the IdConditionTriggerGroup field of a GlobalTrigger.

Command:
Adjust screen timer to X seconds

TriggerGroup= 1, $2000, 263, $Z031, > put the number at Z0 position of PARAM_BIG_NUMBERS (Z0 is 0 in this example) into Global Long Beta (GLB) variable
$2000, 245, $4F31 ; put the value of GLB into the screen timer
Parameters= PARAM_BIG_NUMBERS, Y0

Y0 is 30X, so eg. type 750 for Y0 if you want to adjust the timer to 25 seconds.

Activate an F118 in “single” or “multiple” mode for TriggerGroup#1 to adjust the timer.

Notes:
- If the value you want is less than about 18 minutes then you don’t need to “waste” a “long” variable, so choose a “short” one.
- If you activate the command, then the timer will show up and start, even without an F86.

Condition:
If the screen timer is X more/less/exactly than Y seconds

It is useful sometimes instead of C20, because:

- C20 works “only” for 1023 seconds. This condition is good till about 71 million seconds.
- C20 won’t work if you run the timer in “hidden mode” (see above).

TriggerGroup= 1, $2000, 244, $4F31, >; put the screen timer value of into Global Long Beta (GLB) variable
$8000, 49, $Z0X, > ;if GLB is the number at Z0 position of PARAM_BIG_NUMBERS, Z0 is 0 in this example
$8000, 49, $129; if GLB is >= 1
Parameters= PARAM_BIG_NUMBERS, W0

W0 is 30Y, so eg. type 750 for W0 if you want to study 25 seconds.

X values are:
26 – for a “bigger” condition (this time Y must be the original Y plus 1 frame, so eg. if you want a “bigger than 200 tick frames” condition, then W0 is 201)
27 – for a “smaller” condition
28 – for an “equal” condition

Note:
We need to be careful with the “less” condition, because 0 is less than any value, so the condition will also be true if the timer has not started yet. That is why I also used “>=1” condition.

Condition:
If the timer of X object will expire in Y more/less/exactly than V seconds

This condition is about the good old object timer that you can adjust in the Timer window of the trigger. (And it also works for the similar ACTION trigger.)

TriggerGroup= 1, $5000, X, $36, > ; set object with X ID in Level Editor as the subject of Item Memory Zone
$2000, 256, $D11, > ;put the object timer value of into Global Short Alfa2 (GSA2) variable
$2000, 284, $11, > ; invert the sign in GSA2 - is needed only if you typed a negative number in the Timer box!
$8000, 17, $Z0Y, > ;if GSA2 is the number at Z0 position of PARAM_BIG_NUMBERS, Z0 is 0 in this example
$8000, 17, $129; if GSA2 is >= 1
Parameters= PARAM_BIG_NUMBERS, W0

W0 is 30V, so eg. type 750 for W0 if you want to study 25 seconds.

Y values are:
26 – for a “bigger” condition (this time Y must be the original Y plus 1 frame)
27 – for a “smaller” condition
28 – for an “equal” condition

Notes:

- We need to be careful with the “less” condition, because 0 is less than any value, so the condition will also be true if the timer has not started yet. That is why I also used “>=1” condition.
- You shouldn't use the timer maximum value in this condition. So eg. if it is 300 frames (10 seconds), then use 299 frames for W0.

Condition:
If the activity status of timer of X Moveable object is Y

TriggerGroup= 1, $5000, X, $36, > ; set object with X ID in Level Editor as the subject of Item Memory Zone
$2000, 256, $D11, > ;put the object timer value of into Global Short Alfa2 (GSA2) variable
$2000, 284, $11, > ; invert the sign in GSA2 - is needed only if you typed a negative number in the Timer box!
Y, > ;if GSA2 is…
$8000, 17, $Z028 ; if GSA2 is the number at Z0 position of PARAM_BIG_NUMBERS, Z0 is 0 in this example. - Use it only if you want to separate the meanings of * marked condition! (See below.)
Parameters= PARAM_BIG_NUMBERS, W0

W0: the maximum value of the timer, in tick frames (type the positive version of the timer value here, if the timer is negative)

Y values are:

a, $8000, 17, $2B

- the trigger of the positive timer has never been activated before or
- the negative timer is not running (because the timer has never been activated before or expired, so not because Lara is standing on the trigger)

b, $8000, 17, $2A

The positive timer is not running (because the timer has expired so not because Lara is standing on the trigger), but has been activated at least once before

c, $8000, 17, $129

- the timed (positive or negative) trigger is activated, but the timer is not running because Lara is still standing on the trigger or
- the positive or negative timer of the timed trigger is running*

*: if you use $8000, 17, $Z028, then you can separate the condition marked by * into two parts:

- Use TGROUP_NOT flag in $8000, 17, $Z028, if you want only this meaning of the condition: '”the positive or negative timer of the timed trigger is running', ruling out the “Lara is standing on the trigger” part.
- Or don't use TGROUP_NOT flag in $8000, 17, $Z028, if you want only this meaning of the condition: “the timed (positive or negative) trigger is activated, but the timer is not running because Lara is still standing on the trigger”, ruling out the “timer is running” part.


Note:
This condition is useful, because the object (triggered by a positive or negative timer) will have “active” status forever (except: if you antitrigger the object) for C14 trigger always after the timed trigger has been activated for the very first time. (I.e. C14 is not useful for timed objects.)

Made using TRNG 1.2.2.7.

Last edited by AkyV; 08-07-16 at 10:32.
AkyV 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 04:35.


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