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 30-12-14, 08:39   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default TRNG A couple of interesting torch/flare statuses

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 Byte Alfa1, Global Short Alfa2) 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!

Condition:
Lara is picking up X torch

Not the whole picking animation, only when the torch is already in the hand.

TriggerGroup= 1, $8000, X, $23, > ; if Lara is holding the torch
$8000, 39, $1F ; if Lara is performing a usual picking animation (StateID 39)

X codes are:

8: out
9: fired
16: any

Note:
The condition is useful only if there is the torch in Lara’s hand when the animation ends. (So eg. it is useless for the sarcophagus animation – by the way, that animation is not included in StateID 39.)

Feel free to use C30 triggers with TGROUP_OR constants, just after $8000, 39, $1F, if you use some special picking animation (eg. TR5 animation: from cupboard).

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.

Condition:
Lara is igniting the torch with a flame

TriggerGroup= 1, $2000, 244, $1400, >; put the torch status into Global Byte Alfa1 (GBA1) variable
$8000, 0, $32B, > ;if GBA1=3
$8000, 8, $23 ; Lara is holding a torch-out

Note:
There are more animations to ignite the torch. If you surely know the animation ID that will be performed, then use an animation condition (C30) together with the holding condition, instead of the variable trigger+condition:

TriggerGroup= 1, $8000, X, $1E, > ; if Lara is performing Animation X to ignite the torch
$8000, 8, $23 ; Lara is holding a torch-out

If you want to use an animation condition, then maybe you should use an absolute animation ID (W0) and frame condition (V0) (see more in this tutorial: http://www.tombraiderforums.com/show...14#post7218614 ), so the true part of the condition will be shorter. I mean, the igniting procedure has two parts: Lara reaches the torch to the fire+Lara holds the torch at the fire. Naturally, the condition looks better, if you rule out the part when the torch is not at the fire, i.e. when Lara reaches it to the fire.

TriggerGroup= 1, $2000, 244, $5B11, >; put the actual animation of the torch into Global Short Alfa2 (GSA2) variable
$2000, 244, $5A00, > ; put the actual frame of the torch actual animation into Global Byte Alfa1 (GBA1) variable
$8000, 17, $Z028,> ;if GSA2 is the number at Z0 position of PARAM_BIG_NUMBERS (Z0=0: first position, 1: second position etc.), Z0 is 0 in this example
$8000, 0, $V029 ; if GBA1 >= V0 (so if the animation has left the frame where Lara haven’t reached the torch to the fire yet)
Parameters= PARAM_BIG_NUMBERS, W0

Condition:
Lara is igniting a flame with the torch

TriggerGroup= 1, $2000, 244, $1400, >; put the torch status into Global Byte Alfa1 (GBA1) variable
$8000, 0, $32B, > ;if GBA1=3
$8000, 9, $23 ; Lara is holding a torch-fired

Condition:
Lara is X throwing/dropping a Y torch

TriggerGroup= 1, $2000, 244, $1400, >; put the torch status into Global Byte Alfa1 (GBA1) variable
$8000, 0, $X2B, > ;if GBA1=X
$8000, Y, $23 > ; if Lara is holding the torch

X codes are:
1 – throwing, by hitting space
2 – dropping, by drawing a weapon (with shortcut keys or in inventory)

Y codes are:

8: out
9: fired
16: any

Here is a complex example – Lara is throwing or dropping any torch:

TriggerGroup= 1, $2000, 244, $1400, >; put the torch status into Global Byte Alfa1 (GBA1) variable
$8000, 0, $12B, > ;if GBA1=1
$8000+TGROUP_OR, 0, $22B, > ;if GBA1=2
$8000, 16, $23 > ; if Lara is holding the torch

Notes:

- If you want to force some other action with the torch, then see these flipeffect triggers: F83 (to make Lara drop the torch) or F199, F200.
- Imagine this: if Lara drops the torch then the condition enables an F200 trigger to put out the torch. So it looks like the air – moved by the flying torch – puts the torch out.

Condition:
Lara is igniting a flare

TriggerGroup= 1, $2000, 244, $5B11, >; put the actual animation of the flare into Global Short Alfa2 (GSA2) variable
$8000, 17, $Z028 ;if GSA2 is the number at Z0 position of PARAM_BIG_NUMBERS, Z0 is 0 in this example
Parameters= PARAM_BIG_NUMBERS, W0

W0 is the absolute animation ID of Animation3 (igniting animation) of FLARE_ANIM. The other part of the procedure (animation for reaching for the flare in the backpack: Animation2) is not included now.

Note:
“Extract flare” (C13) is not a really good condition now, because:
- it works even when Lara throws the flare with the flare button, and
- it works only for the first moves: when Lara reaches into the backpack for the flare (to extract), or when she starts throwing the flare.

Condition:
Lara is picking up a working flare (she has dropped before)

For the whole animation:

TriggerGroup= 1, $8000, 67, $1F ; if Lara is performing a working flare-picking animation (StateID 67)

Not the whole picking animation, only when the flare has not been in the hand yet.

TriggerGroup= 1, $8000+TGROUP_NOT, 7, $23, > ; if Lara is not holding the flare
$8000, 67, $1F ; if Lara is performing a working flare-picking animation (StateID 67)

Not the whole picking animation, only when the flare is already in the hand.

TriggerGroup= 1, $8000, 7, $23, > ; if Lara is holding the flare
$8000, 67, $1F ; if Lara is performing a working flare-picking animation (StateID 67)

Condition:
Lara is throwing/dropping a flare in X way

X: throwing the flare:

TriggerGroup= 1, V, >
$2000, 244, $5B11, >; put the actual animation of the flare into Global Short Alfa2 (GSA2) variable
$2000, 244, $5A00, > ; put the actual frame of the flare actual animation into Global Byte Alfa1 (GBA1) variable
$8000, 17, $Z028,> ;if GSA2 is the number at Z0 position of PARAM_BIG_NUMBERS, Z0 is 0 in this example
$8000, 0, $12B ; if GBA1=1
Parameters= PARAM_BIG_NUMBERS, W0

This setup is made only for the moment when Lara just starts throwing the flare.

V values are:

- there is no V: in any throwing way
- $8000, 10, $10D: throwing the flare with the flare button,
- $8000+TGROUP_NOT, 10, $10D: throwing the flare automatically when the flare just got dead

W0 is the absolute animation ID of Animation1 (throwing animation) of FLARE_ANIM.

X: dropping the flare by extracting a weapon:

TriggerGroup= 1, $8000, 0, $12B, > ; if GBA1=1
$8000, 9, $10D ; if Lara is extracting a weapon

You need one more GlobalTrigger as well:

GlobalTrigger= 2, IGNORE, GT_CONDITION_GROUP, IGNORE, 2, 3, 4
TriggerGroup= 2, $8000, 7, $23 ; if Lara is holding a flare
TriggerGroup= 3, $2000, 232, $100 ; set 1 in Global Byte Alfa1 (GBA1) variable
TriggerGroup= 4, $2000, 232, $0 ; set 0 in Global Byte Alfa1 (GBA1) variable

Condition:
The flare has started dying (blinking) in Lara’s hand

TriggerGroup= 1, $2000, 244, $5B11, >; put the actual animation of the flare into Global Short Alfa2 (GSA2) variable
$8000, 17, $Z028,> ;if GSA2 is the number at Z0 position of PARAM_BIG_NUMBERS, Z0 is 0 in this example
$2000, 244, $1500, > ; put the status of blinking/not blinking into Global Byte Alfa1 (GBA1) variable
$8000, 0, $2B ; if GBA1=0
Parameters= PARAM_BIG_NUMBERS, W0

W0 is the absolute animation ID of Animation0 (holding flare) of FLARE_ANIM. (“If Lara is holding a flare” doesn’t seem a perfect condition now.)

Note:
For the executable trigger, that will be executed if the condition is true, I recommend a trigger that can be executed only once (at least, till she has another flare in the hand) and that is only a moment long event (for example, spawning a baddy, or One Shot+playing an audio file), or else the trigger will be executed several times while the flare is dying (blinking) in her hand.

Command:
Make the flare go dead in Lara’s hand in X tick frames

TriggerGroup= 1, $2000, 263, $Z011, > put the number at Z0 position of PARAM_BIG_NUMBERS (Z0 is 0 in this example) into Global Short Alfa2 (GSA1) variable
$2000, 245, $C11 ; put the value of GSA2 into the remaining time of the actual flare
Parameters= PARAM_BIG_NUMBERS, Y0

Y0 is W-X. W is 900 frames, i.e. 30 seconds – the maximum lifetime of a flare. (W is naturally another value if you customized the maximum lifetime in a CUST_FLARE Script command.)
For example, if you want Lara drops the flare in 2 seconds (with the default lifetime) then Y0 is 900-60=840.

Activate an F118 in “single” or “multiple” mode for TriggerGroup#1 to make her drop the flare in X tick frames.

Notes:
- The flare won't forget about the forced value if Lara drops it before putting out. If she extract a new flare, that won’t apply this X value.
- If X is 0, then the flare goes dead right away and Lara throws it right away, automatically.
- You can’t force a value like that if the flare is just dropped down on the floor.
- Nothing will happen if you activate F118 when Lara has no flare in the hand.

Condition:
If the flare in Lara’s hand will be dead in X more/less/exactly than Y tick frames

TriggerGroup= 1, $8000, 7, $23, > ; if Lara is holding a flare
$2000, 244, $C11, >; put the remaining time of the actual flare into Global Short Alfa2 (GSA2) variable
$8000, 17, $Z0X ;if GSA2 is the number at Z0 position of PARAM_BIG_NUMBERS, Z0 is 0 in this example
Parameters= PARAM_BIG_NUMBERS, U0

U0 is W-Y. W is 900 frames, i.e. 30 seconds – the maximum lifetime of a flare. (W is naturally another value if you customized the maximum lifetime in a CUST_FLARE Script command.)

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

Notes:
- It doesn't matter if Lara throws directly the flare after using the condition or not. (I mean, the condition could be true till the death of the flare, if that is in just Lara’s hand.)
- If she extracts a new flare when the condition is true for the old flare, the condition won’t be true automatically for the new flare.

---------------------------------------------

How to add a sound to a flare?
A whole setup made for Titia about 2.5 years ago. – So all is here is quoted now, a PM for her from me:

I mean, see this field in my variable tutorial:

Lara. Hands. Attached Lara Status (Short)

0: empty hands or holding a flare
1: ..., picking up (first moves) a torch or a working flare, ...
2: ..., igniting a flare
3: ..., throwing automatically a flare
4: ...
5: picking up (last moves) the working flare


So, start a frame counter when "Lara holds flare" is true AND if this variable is 0. That's why both the backpack-ignition part and the "real empty hands" must be ruled out.
("Starting a frame counter" means you will enable a GlobalTrigger that will start Local or Global Long Timer variable to count the frames. The Globaltrigger must be Single Shot so that the counter won't start again and again if Lara is holding the flare. - I mean, because of the "well-known problem of re-usage" it must be Single Shot Resumed.)
Stop the sound (and the counter) and turn the counter into 0 for the next flare by another GT if the counter reaches the 900th frame (i.e. when the flare will be burnt out) - it will also stop them if Lara has dropped the flare. (So the counter will count the frames even if the flare is just dropped on the floor.)

It is not problem now if Lara has dropped the flare but then she will pick it up.

But there is a problem:
What if Lara has dropped the flare but ignited another one before the counter reached 900?
Well, you should stop the counter (and turn it to 0) when she ignites a new one (i.e. if "Lara holds flare" is true AND if this variable is 2), by another GT - and, after that, the first GT will start the counter again, so the counter/sound will stop only if the second flare has been put out.

That's my setup:

Customize= CUST_FLARE, FFL_ADD_SMOKE_TO_SPARKS + FFL_ADD_SPARKS, IGNORE, 255, 200, 55, 10
GlobalTrigger= 1, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, -1, 1, 2, -1
TriggerGroup= 1, $8000, 7, $23, $2000, 244, $450, $8000, 80, $2B

; Set Trigger Type - CONDITION 35
; Exporting: CONDITION(35:0) for PARAMETER(7)
; <#> : Holding_Flare
; <&> : Lara. (Holds) Lara is holding/driving the <#>item
; (E) :
; Values to add in script command: $8000, 7, $23

; Set Trigger Type - FLIPEFFECT 244
; Exporting: TRIGGER(1104:0) for FLIPEFFECT(244)
; <#> : Variables. Memory. Copy to <&>Numeric Variable the (E)Savegame Memory value
; <&> : Local Short Alfa1
; (E) : Lara. Hands. Attached Lara Status (Short)
; Values to add in script command: $2000, 244, $450

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:62) for PARAMETER(80)
; <#> : Local Short Alfa1
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 0
; Values to add in script command: $8000, 80, $2B

TriggerGroup= 2, $2000, 264, $0, $2000, 70, $65

; Set Trigger Type - FLIPEFFECT 264
; Exporting: TRIGGER(0:0) for FLIPEFFECT(264)
; <#> : Variables. Timer. Start the <&>TRNG Timer in (E)Mode
; <&> : Local Timer
; (E) : Increasing Timer
; Values to add in script command: $2000, 264, $0

; Set Trigger Type - FLIPEFFECT 70
; Exporting: TRIGGER(101:0) for FLIPEFFECT(70)
; <#> : Sound. Play <&>Sound sample of first group (0-255) for (E) time
; <&> : BEETLE_CLK_WHIRR 101 Ok l_toy1
; (E) : Forever (use other action/effect to disable it)
; Values to add in script command: $2000, 70, $65

GlobalTrigger= 2, -1, GT_CONDITION_GROUP, -1, 3, 4, -1
TriggerGroup= 3, $8000, 115, $26

; Set Trigger Type - CONDITION 38
; Exporting: CONDITION(38:62) for PARAMETER(115)
; <#> : Local Long Timer
; <&> : 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, 115, $26

TriggerGroup= 4, $2000, 265, $0, $2000, 266, $0, $2000, 72, $65

; Set Trigger Type - FLIPEFFECT 265
; Exporting: TRIGGER(0:0) for FLIPEFFECT(265)
; <#> : Variables. Timer. Stop the <&>TRNG Timer
; <&> : Local Timer
; (E) :
; Values to add in script command: $2000, 265, $0

; Set Trigger Type - FLIPEFFECT 266
; Exporting: TRIGGER(0:0) for FLIPEFFECT(266)
; <#> : Variables. Timer. Initialize <&>TRNG Timer to (E)Seconds
; <&> : Local Timer
; (E) : Seconds= 0
; Values to add in script command: $2000, 266, $0

; Set Trigger Type - FLIPEFFECT 72
; Exporting: TRIGGER(101:0) for FLIPEFFECT(72)
; <#> : Sound. Stop <&>Sound sample of first group (0-255)
; <&> : BEETLE_CLK_WHIRR 101 Ok l_toy1
; (E) :
; Values to add in script command: $2000, 72, $65

Parameters= PARAM_BIG_NUMBERS, 900
GlobalTrigger= 3, -1, GT_CONDITION_GROUP, -1, 5, 6, -1
TriggerGroup= 5, $8000, 7, $23, $2000, 244, $450, $8000, 80, $22B

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:58) for PARAMETER(80)
; <#> : Local Short Alfa1
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 2
; Values to add in script command: $8000, 80, $22B

TriggerGroup= 6, $2000, 265, $0, $2000, 266, $0

Notes:
1. The sound is not smooth now, a bit abrupt. But I didn't want to solve this problem because I think it is just cool for a sparking.
2. The volume is not adjusted with this kind of flipeffects. If Lara drops the flare and runs far from that, then the volume remains the same.
3. There is a tiny bug, but I think it is not important: if Lara ignites the second flare just in the moment when the first one extinguishes on the floor, then the sound will be heard, though the second one is still not burning but the first one has just been extinguished.

Made using TRNG 1.2.2.7.

Last edited by AkyV; 05-01-17 at 01:19.
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:15.


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