Tomb Raider Forums  

Go Back   Tomb Raider Forums > Tomb Raider Level Editor and Modding > Tomb Raider Level Editor > Tutorials and Resources

Closed Thread
 
Thread Tools
Old 18-11-14, 11:43   #1
AkyV
Moderator
 
Joined: Dec 2011
Posts: 4,881
Default TRNG – Weapons in/on the hands/holsters/back

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!

Note:
See this tutorial if you want another default weapon at the start of the game, instead of the pistols:

http://www.tombraiderforums.com/showthread.php?t=205092

Condition:
If Lara’s actual weapon is X in Y way

“Actual” means:
- the weapon in Lara’s hands or
- the weapon you see in the holsters/on the back, that will be extracted if you hit SPACE.

The condition is useful, because C35 is able to study the actual weapon only if that is in Lara’s hands.

Y: in Lara’s hands or in the holsters/on the back:

TriggerGroup= 1, $2000, 244, $700, > ;put the code of the actual weapon into Global Byte Alfa1 (GBA1) variable
$8000, 0, $X2B ;if GBA1=X

X codes are:

0: there is no actual weapon (this will happen for example if you disarm Lara)
1: pistols
2: revolver
3: Uzis
4: shotgun
5: grenade gun
6: crossbow

Y: only on the back (for shotgun, grenade gun, crossbow), i.e. not in Lara’s hands:

TriggerGroup= 1, $2000, 244, $700, > ;put the code of the actual weapon into Global Byte Alfa1 (GBA1) variable
$8000+TGROUP_NOT, X, $23, > ;if Lara is not holding X weapon
$8000, 0, $X2B, > ;if GBA1=X
$2000, 244, $5B11, >; put the actual animation of the weapon into Global Short Alfa2 (GSA2) variable
$2000, 244, $5A00, > ; put the actual frame of the weapon actual animation into GBA1
$8000, 2, $F, > ;if TriggerGroup#2 is true
$8000+TGROUP_OR, 3, $F; if TriggerGroup#3 is true
TriggerGroup= 2, $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, $V02A ;if GBA1 < V0
TriggerGroup= 3, $8000, 17, $Z128,> ;if GSA2 is the number at Z1 position of PARAM_BIG_NUMBERS, Z1 is 1 in this example
$8000, 0, $V129 ; if GBA1 >= V1
Parameters= PARAM_BIG_NUMBERS, W0, W1

W: it is an absolute animation ID. W0 for the extracting animation and W1 for the “holstering” animation.
Never try to adjust an absolute animation ID in the script before surely finishing your WAD. If it has been finished, then open the WAD in NG Center/Tools/Animation Watcher. Choose the given weapon animation object in SLOT window (for example, SHOTGUN_ANIM if the setup is about the shotgun) and “Show Present Animations” in Show window. In Column Anim you can see the animations of the object. Check them in WADMerger: probably Animation1 is the extracting animation and Animation3 is the holstering animation. See the value in Column ABS for both of them. That value is the absolute animation index of that animation.

V: it is the hexadecimal version of an animation frame ID. V0 for the extracting animation and V1 for the “holstering” animation.
Check the given extracting/holstering animation in WADMerger. The animations have two main parts:
- Extracting animation: Lara is reaching for the weapon (the weapon is still on her back) / Lara has the weapon in the hand.
- Holstering animation: Lara has the weapon in the hand / Lara has let the weapon go (the weapon is on her back).
So we need to rule out the frames when the weapon is in the hand. – Let’s see for example the crossbow original animations:
- Extracting animation (Animation1): Lara has started taking the weapon from the back at Frame10. So we should rule out Frame10 and the bigger IDs. That is why GBA1 should be smaller than 10 for the proper condition. That is why V0 is 10.
- Holstering animation (Animation3): Lara has started letting the weapon on the back at Frame24. So we should rule out Frame23 and the smaller IDs. That is why GBA1 should be 24 or bigger for the proper condition. That is why V1 is 24.
So use your Windows calculator, and turn 10 and 24 into hexadecimal (they are A and 18), before typing them in the script.
(The biggest number for $8000, 0, $V02A and $8000, 0, $V129 is 31. Use the PARAM_BIG_NUMBERS version of the triggers, if your frame ID is bigger than 31.)

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.

Y: only in the holsters (for pistols, Uzi, revolver), i.e. not in Lara’s hands:

TriggerGroup= 1, $2000, 244, $700, > ;put the code of the actual weapon into Global Byte Alfa1 (GBA1) variable
$8000+TGROUP_NOT, X, $23, > ;if Lara is not holding X weapon
$8000, 0, $X2B, > ;if GBA1=X
$2000, 244, $5B11, >; put the actual animation of the weapon 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 index for the animation of the last moves of extracting/holstering. (It is, for example, Animation1 for the original animation of PISTOLS_ANIM.)

Note for all the weapons:
If you don’t use the second part (about the animations, after $8000, 0, $X2B) of the “not in the hands” setup then the condition will be true all the way when Lara is just extracting/holstering the weapon, so even if she’s moving the weapon from/on/in the back/holsters.
Or: modify the setup if you want the condition to be true when Lara is moving the weapon from/on/in the back/holsters, ruling out when the weapon is on/in the back/holsters. For example, above, if GBA1 >= 24 that is okay for the holstering animation if the weapon is on the back. Choose another condition (C42 trigger for “if GBA1 < 24”) if the condition is okay when Lara is just moving the weapon to her back.

Command:
Make Lara extract X weapon

Use it if you want to make Lara extract a given weapon, instead of just simply simulating to hit SPACE to extract the actual weapon.
So this command works as if you hit a shortcut key to select a weapon or as if you chose a weapon in the in the inventory.

TriggerGroup= 1, $8000, Z, $2, >; if the given weapon there is in the inventory
$2000, 246, $X06, > ; adjust the X code of the actual item in Lara’s hand
$2000, 244, $700, > ; put the code of the actual item in Lara’s hand into Global Byte Alfa1 (GBA1) variable
$8000+TGROUP_NOT, X, $23, > ; if Lara is not holding X weapon
$8000, 0, $X2B, > ;if GBA1=X
$2000, 53, $A ; simulate hitting Key SPACE

X codes are:

1: pistols (Z: 349)
2: revolver (Z: 366)
3: Uzis (Z: 351)
4: shotgun (Z: 353)
5: grenade gun (Z: 361)
6: crossbow (Z: 356)

Activate an F118 in “single” or “multiple” mode for TriggerGroup#1 to extract the weapon.
The command won’t do anything if the required item is not in the inventory.
If Lara has anything else in the hands (flare, torch, another weapon) now, then she will drop that flare/torch or holster that weapon before extracting X weapon.

Note:
Use F53 if you want to extract a flare.

Condition:
If the weapon just being seeable on Lara’s back is X

It is not the actual weapon everyway. For example, if you put the shotgun back on her back and then extract the pistols, then the pistols are the actual weapons, but you see the shotgun on her back.

TriggerGroup= 1, $2000, 244, $E00, >; put the code of the actual item on Lara’s back into Global Byte Alfa1 (GBA1) variable
$8000, 0, $X2B ; if GBA1=X

X codes are:

0: no weapon
3: shotgun
4: crossbow
5: grenade gun

Notes:
- For example, the condition could be useful if it is a condition for a GlobalTrigger that will add an effect (see AddEffect Script command) to that weapon mesh if this is the weapon just being seeable there, and remove it, if it is not.
- Unfortunately, there is no similar condition for the weapons in the holsters.

Condition:
If there is any weapon being seeable on Lara’s back

TriggerGroup= 1, $2000, 244, $E00, > ;put the code of the actual item on Lara’s back into Global Byte Alfa1 (GBA1) variable
$8000, 0, $129 ;if GBA1>=1

Condition:
General weapon status of Lara is Y

Y: there is no any weapon in the hand:

TriggerGroup= 1, $8000+TGROUP_NOT, 1, $23, > ; Lara is not holding pistols
$8000+TGROUP_NOT, 2, $23, > ; Lara is not holding a revolver
$8000+TGROUP_NOT, 3, $23, > ; Lara is not holding Uzis
$8000+TGROUP_NOT, 4, $23, > ; Lara is not holding a shotgun
$8000+TGROUP_NOT, 5, $23, > ; Lara is not holding a grenade gun
$8000+TGROUP_NOT, 6, $23 ; Lara is not holding a crossbow

The “no weapon” condition is true all the way when Lara is moving her hands to extract/holster the weapons. If you want to modify that then see the absolute animation and animation frame conditions above, so you can also use them here.

Y: there is any weapon in the hand, either shooting or not

TriggerGroup= 1, $8000, 1, $23, > ; Lara is holding pistols
$8000+TGROUP_OR, 2, $23, > ; Lara is holding a revolver
$8000+TGROUP_OR, 3, $23, > ; Lara is holding Uzis
$8000+TGROUP_OR, 4, $23, > ; Lara is holding a shotgun
$8000+TGROUP_OR, 5, $23, > ; Lara is holding a grenade gun
$8000+TGROUP_OR, 6, $23 ; Lara is holding a crossbow

Y: there is any weapon in the hand, (not) shooting

TriggerGroup= 1, $8000+TGROUP_NOT, 8, $10D, > ; Key ACTION (CTRL) is pressed
$8000, 2, $F ;if TriggerGroup#2 is true
TriggerGroup= 2, $8000, 1, $23, > ; Lara is holding pistols
$8000+TGROUP_OR, 2, $23, > ; Lara is holding a revolver
$8000+TGROUP_OR, 3, $23, > ; Lara is holding Uzis
$8000+TGROUP_OR, 4, $23, > ; Lara is holding a shotgun
$8000+TGROUP_OR, 5, $23, > ; Lara is holding a grenade gun
$8000+TGROUP_OR, 6, $23 ; Lara is holding a crossbow

Use +TGROUP_NOT only for the “not shooting” condition.

Notes:

- “Lara is shooting” (C5) instead of the TriggerGroup is not the best choice, because it is true only if she is really shooting. (So it is false when the player holds ACTION pressed down to shoot, but the bullet is just being loaded into the gun.)
.- If you want shooting/not shooting conditions when Lara is looking through the lasersight, then see this tutorial:

http://www.tombraiderforums.com/showthread.php?t=207418

Y: any weapon is just being X extracted/holstered

TriggerGroup= 1, $2000, 244, $400, > ; put the code of a special action into Global Byte Alfa1 (GBA1) variable
$8000+TGROUP_NOT, 7, $23, > ;if Lara is not holding a flare
$8000, 0, $X2B ;if GBA1=X

X codes are:

2: extracted
3: holstered

For “either extracted or holstered”:

TriggerGroup= 1, $2000, 244, $400, > ; put the code of a special action into Global Byte Alfa1 (GBA1) variable
$8000+TGROUP_NOT, 7, $23, > ;if Lara is not holding a flare
$8000, 0, $22B, > ;if GBA1=2
$8000+TGROUP_OR, 0, $32B ; if GBA1=3

Command:
Lower the weapon (not holstering it)

Just use a simple F12 trigger.

Made using TRNG 1.2.2.7.

Last edited by AkyV; 08-07-16 at 10:31.
AkyV is offline  
Closed Thread

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:30.


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.