Tomb Raider Forums

Tomb Raider Forums (https://www.tombraiderforums.com/index.php)
-   Tutorials and Resources (https://www.tombraiderforums.com/forumdisplay.php?f=28)
-   -   TRNG – A couple of interesting situations with timers (https://www.tombraiderforums.com/showthread.php?t=208608)

AkyV 07-01-15 07:40

TRNG – A couple of interesting situations with timers
 
[COLOR=green]Instructions:[/COLOR]

[COLOR=green]1. Copy the setup in your Script.[/COLOR]
[COLOR=green]2. Build the Script.[/COLOR]

[COLOR=green]Special instructions, if the Script doesn’t work/cannot be built:[/COLOR]

[COLOR=green][FONT=Arial]1. Check TriggerGroup and GlobalTrigger ID’s and change them if you are already using the ID in another TriggerGroup/GlobalTrigger.[/FONT][/COLOR]
[COLOR=green][FONT=Arial]2[/FONT][/COLOR][COLOR=green]. 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.[/COLOR]
[COLOR=green]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:[/COLOR]

[COLOR=green]- 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).[/COLOR]
[COLOR=green]- 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.[/COLOR]
[COLOR=green]- 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.[/COLOR]
[COLOR=green]You are never allowed to change Current Value variable![/COLOR]

[COLOR=green]Export the trigger you have changed, replacing the previous trigger in the Script.[/COLOR]
[COLOR=green]3. Build the Script.[/COLOR]

[COLOR=Red]Don't forget: PARAM_BIG_NUMBERS position ID in the triggers, after the $ sign, must be typed in hexadecimal format![/COLOR]

[B][COLOR=blue][FONT=Arial]Command:[/FONT][/COLOR][/B]
[B][COLOR=blue][FONT=Arial]X enable/disable screen timer[/FONT][/COLOR][/B]

[FONT=Arial]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.[/FONT]
[FONT=Arial]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.)[/FONT]

[FONT=Arial]TriggerGroup= 1, [U]$2000, 263, $[COLOR=red]Z0[/COLOR]FF[/U][/FONT][U][FONT=Arial],[/FONT][/U][FONT=Arial] > put [/FONT]the number at Z0 position of PARAM_BIG_NUMBERS (Z0 is 0 in this example) into Current Value variable
$2000, 278, $4 ;[FONT=Arial]put the value of Current Value into [/FONT]the level flag field.
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]Y0[/COLOR]

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

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

[FONT=Arial]Level flag values are:[/FONT]

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

[FONT=Arial]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.[/FONT]
[FONT=Arial]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.[/FONT]

[B][COLOR=blue][FONT=Arial]Condition:[/FONT][/COLOR][/B]
[B][COLOR=blue][FONT=Arial]If screen timer is X enabled/disabled[/FONT][/COLOR][/B]

[FONT=Arial]“Enabled”: the timer is on the screen. / Or the timer will be on the screen if you activate an F86 in “show” mode.[/FONT]
[FONT=Arial]“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.)[/FONT]

[FONT=Arial]TriggerGroup= 1, $2000, 277, $4, >; [/FONT][FONT=Arial]put [/FONT]the level flag field.[FONT=Arial]value into Current Value variable[/FONT]
[U][FONT=Arial]$8000, 255, $[COLOR=red]Y0[/COLOR]28[/FONT][/U][FONT=Arial],> ;[/FONT]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
[U][COLOR=red][FONT=Arial]W[/FONT][/COLOR][/U][FONT=Arial] ;[/FONT]
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]X0, X1, X2 etc.[/COLOR]

[FONT=Arial]W is one or more copies of this trigger:[/FONT]
[U][FONT=Arial]$8000+TGROUP_OR, 255, $[COLOR=red]YV[/COLOR]28[/FONT][/U][FONT=Arial]: [/FONT]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.

[FONT=Arial]Let’s see some examples:[/FONT]

[FONT=Arial]Only Timer flag exists, you want to study if that is just enabled (so if flag aggregated value is 4096 or not):[/FONT]

[FONT=Arial]TriggerGroup= 1, $2000, 277, $4, >[/FONT]
[U][FONT=Arial]$8000, 255, $[COLOR=red]0[/COLOR]28[/FONT][/U]
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]4096[/COLOR]

[FONT=Arial]Only Timer flag exists, you want to study if that is just disabled (so if flag aggregated value is 0 or not):[/FONT]

[FONT=Arial]TriggerGroup= 1, $2000, 277, $4, >[/FONT]
[U][FONT=Arial]$8000, 255, $[COLOR=red]0[/COLOR]28[/FONT][/U]
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]0[/COLOR]

[FONT=Arial]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):[/FONT]

[FONT=Arial]TriggerGroup= 1, $2000, 277, $4, >[/FONT]
[U][FONT=Arial]$8000, 255, $[COLOR=red]0[/COLOR]28[/FONT][/U]
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]4105[/COLOR]

[FONT=Arial]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:[/FONT]
[FONT=Arial]- Timer is just disabled, Train and ResetHUB are just enabled: 0+128+1024= 1152[/FONT]
[FONT=Arial]- Timer and Train are just disabled, ResetHUB is just enabled: 0+0+1024= 1024[/FONT]
[FONT=Arial]- Timer and ResetHUB are just disabled, Train is just enabled: 0+128+0= 128[/FONT]
[FONT=Arial]- Timer, Train and ResetHUB are all disabled: 0+0+0= 0[/FONT]

[FONT=Arial]TriggerGroup= 1, $2000, 277, $4, >[/FONT]
[U][FONT=Arial]$8000, 255, $[COLOR=red]0[/COLOR]28[/FONT][/U][FONT=Arial],>[/FONT]
[U][FONT=Arial]$8000+TGROUP_OR, 255, $[COLOR=red]1[/COLOR]28[/FONT][/U][FONT=Arial], >[/FONT]
[U][FONT=Arial]$8000+TGROUP_OR, 255, $[COLOR=red]2[/COLOR]28, >[/FONT][/U]
[U][FONT=Arial]$8000+TGROUP_OR, 255, $[COLOR=red]3[/COLOR]28[/FONT][/U]
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]1152, 1024, 128, 0[/COLOR]

[COLOR=red]The easiest solutions to use the conditions:[/COLOR]
[COLOR=red]- 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.[/COLOR]
[COLOR=red]- The TriggerGroup (1) ID is referred by the IdConditionTriggerGroup field of a GlobalTrigger.[/COLOR]

[B][COLOR=blue][FONT=Arial]Command:[/FONT][/COLOR][/B]
[B][COLOR=blue][FONT=Arial]Adjust screen timer to X seconds[/FONT][/COLOR][/B]

[FONT=Arial]TriggerGroup= 1, [U]$2000, 263, $[COLOR=red]Z0[/COLOR]31[/U][/FONT][U][FONT=Arial],[/FONT][/U][FONT=Arial] > put [/FONT]the number at Z0 position of PARAM_BIG_NUMBERS (Z0 is 0 in this example) into Global Long Beta (GLB) variable
[U][FONT=Arial]$2000, 245, $4F31[/FONT][/U][FONT=Arial] ; put the value of GLB into [/FONT]the screen timer
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]Y0[/COLOR]

[FONT=Arial]Y0 is 30×X, so eg. type 750 for Y0 if you want to adjust the timer to 25 seconds.[/FONT]

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

[FONT=Arial]Notes:[/FONT]
[FONT=Arial]- 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.[/FONT]
[FONT=Arial]- If you activate the command, then the timer will show up and start, even without an F86.[/FONT]

[B][COLOR=blue][FONT=Arial]Condition:[/FONT][/COLOR][/B]
[B][COLOR=blue][FONT=Arial]If the screen timer is X more/less/exactly than Y seconds[/FONT][/COLOR][/B]

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).

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

[FONT=Arial]W0 is 30×Y, so eg. type 750 for W0 if you want to study 25 seconds.[/FONT]

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.

[B][COLOR=blue][FONT=Arial]Condition:[/FONT][/COLOR][/B]
[B][COLOR=blue][FONT=Arial]If the timer of X object will expire in Y more/less/exactly than V seconds[/FONT][/COLOR][/B]

[FONT=Arial]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.)[/FONT]

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

[FONT=Arial]W0 is 30×V, so eg. type 750 for W0 if you want to study 25 seconds.[/FONT]

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.
[FONT=Arial]- 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.[/FONT]

[B][COLOR=blue][FONT=Arial]Condition:[/FONT][/COLOR][/B]
[B][COLOR=blue][FONT=Arial]If the activity status of timer of X Moveable object is Y[/FONT][/COLOR][/B]

[FONT=Arial]TriggerGroup= 1, $5000, [COLOR=red]X[/COLOR], $36[/FONT][FONT=Arial], > ; set object with X ID in Level Editor as the subject of Item Memory Zone[/FONT]
[FONT=Arial]$2000, 256, $D11[/FONT][FONT=Arial], > ;[/FONT][FONT=Arial]put the object timer value of into Global Short Alfa2 (GSA2) variable[/FONT]
[U]$2000, 284, $11[/U][FONT=Arial], > ; invert the sign in GSA2 - [/FONT]is needed only [FONT=Arial]if you typed a negative number in the Timer box![/FONT]
[U][COLOR=red][FONT=Arial]Y[/FONT][/COLOR][/U][FONT=Arial], > ;if GSA2 is…[/FONT]
[U][FONT=Arial]$8000, 17, $[COLOR=red]Z0[/COLOR]28[/FONT][/U][FONT=Arial] ; 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.)[/FONT]
Parameters= PARAM_BIG_NUMBERS, [COLOR=red]W0[/COLOR]

[FONT=Arial]W0: the maximum value of the timer, in tick frames (type the positive version of the timer value here, if the timer is negative)[/FONT]

[FONT=Arial]Y values are:[/FONT]

[FONT=Arial]a, $8000, 17, $2B[/FONT]

[FONT=Arial]- the trigger of the positive timer has never been activated before or[/FONT]
[FONT=Arial]- 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)[/FONT]

[FONT=Arial]b, $8000, 17, $2A[/FONT]

[FONT=Arial]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[/FONT]

[FONT=Arial]c, $8000, 17, $129[/FONT]

[FONT=Arial]- the timed (positive or negative) trigger is activated, but the timer is not running because Lara is still standing on the trigger or[/FONT]
[FONT=Arial]- the positive or negative timer of the timed trigger is running*[/FONT]

[FONT=Arial]*: if you use $8000, 17, $[COLOR=red]Z0[/COLOR]28, then you can separate the condition marked by * into two parts:[/FONT]

[FONT=Arial]- Use TGROUP_NOT flag in $8000, 17, $[COLOR=red]Z0[/COLOR]28, 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.[/FONT]
[FONT=Arial]- Or don't use TGROUP_NOT flag in $8000, 17, $[COLOR=red]Z0[/COLOR]28, 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.[/FONT]
[FONT=Arial]
[/FONT]
[FONT=Arial]Note:[/FONT]
[FONT=Arial]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.)[/FONT]

[I]Made using TRNG 1.2.2.7.[/I]


All times are GMT. The time now is 14:34.

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.