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 03-10-14, 20:49   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,376
Default TRNG – Weapon status (lasersight attached, ammo loaded etc.)

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 ID’s and change them if you are already using the ID in another TriggerGroup.
2. 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 ID’s, then you also need to change the TriggerGroup ID in the trigger (if it is a trigger about a TriggerGroup).
- Maybe you need to choose another variable, because you can’t use the variables (Global Byte Alfa1, Global Byte 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.

Command:
Attach lasersight on Y weapon

The command is useful, because it will do that any time during the game (even if the weapon is in Lara’s hand). Equipment Script command is able to do that only for the start of the game.

Y: on revolver

TriggerGroup=1, $8000, 366, $2, >; if revolver is in the inventory
$2000, 118, $102 ;perform TriggerGroup#2 in “single” mode
TriggerGroup= 2, $2000, 244, $1C00, > ;copy the actual lasersight/ammo status of crossbow into Global Byte Alfa1 (GBA1) variable
$2000, 233, $600, > ;subtract 6 from GBA1
$8000, 0, $72B, >;if GBA1=7 (7+6=13: “normal ammo loaded, with lasersight attached”)
$2000, 246, $91C, >;set 9 in the lasersight/ammo status of crossbow (“normal ammo loaded, without lasersight attached”)
$2000, 118, $103, > ; perform TriggerGroup#3 in “single” mode
$8000+TGROUP_ELSE, 0, $F2B, >;if GBA1=15 (15+6=21: “poisoned ammo loaded, with lasersight attached”)
$2000, 246, $111C, >; set 17 in the lasersight/ammo status of crossbow (“poisoned ammo loaded, without lasersight attached”)
$2000, 118, $103, > ;perform TriggerGroup#3 in “single” mode
$8000+TGROUP_ELSE, 0, $1F2B, >;if GBA1=31 (31+6=37: “explosive ammo loaded, with lasersight attached”)
$2000, 246, $211C, >; set 33 in the lasersight/ammo status of crossbow (“explosive ammo loaded, without lasersight attached”)
$2000, 118, $103, >;perform TriggerGroup#3 in “single” mode
$8000+TGROUP_ELSE, 370, $2, >;if (standalone) lasersight is in the inventory
$2000, 118, $103, >;perform TriggerGroup#3 in “single” mode
$2000, 47, $6F ;remove (standalone) lasersight from the inventory
TriggerGroup= 3, $2000, 246, $D1E, >;set 13 in the lasersight status of revolver (“lasersight attached”)
$8000, 6, $23, >;if Lara is holding crossbow
$2000, 100, $40A, >;swap right hand mesh for CROSSBOW_ANIM slot (to remove lasersight from the hand mesh)
$8000+TGROUP_ELSE, 2, $23, >;if Lara is holding revolver
$2000, 100, $B0A ;swap right hand mesh for LARA_REVOLVER_LASER slot (to add lasersight to the hand mesh)


Y: on crossbow

TriggerGroup=1, $8000, 356, $2, >; if crossbow is in the inventory
$2000, 118, $102 ;perform TriggerGroup#2 in “single” mode
TriggerGroup= 2, $2000, 244, $1E00, >;copy the actual lasersight status of revolver into Global Byte Alfa1 (GBA1) variable
$8000, 0, $D2B, >;if GBA1=13 (“lasersight attached”)
$2000, 246, $91E, >;set 9 in the lasersight status of revolver (“lasersight is not attached”)
$2000, 118, $103, >; perform TriggerGroup#3 in “single” mode
$2000, 118, $104, >; perform TriggerGroup#4 in “single” mode
$8000+TGROUP_ELSE, 370, $2, >;if (standalone) lasersight is in the inventory
$2000, 118, $103, >; perform TriggerGroup#3 in “single” mode
$2000, 118, $104, >; perform TriggerGroup#4 in “single” mode
$2000, 47, $6F ;remove (standalone) lasersight from the inventory
TriggerGroup= 3, $8000, 2, $23, >;if Lara is holding revolver
$2000, 100, $60A, >;swap right hand mesh for SIXSHOOTER_ANIM slot (to remove lasersight from the hand mesh)
$8000+TGROUP_ELSE, 6, $23, >;if Lara is holding crossbow
$2000, 100, $A0A ;swap right hand mesh for LARA_CROSSBOW_LASER slot (to add lasersight to the hand mesh)
TriggerGroup= 4, $2000, 244, $1C00, >;copy the actual lasersight/ammo status of crossbow into GBA1
$8000, 0, $92B, >;if GBA1=9 (“normal ammo loaded, without lasersight attached”)
$2000, 246, $D1C, >;set 13 in the lasersight/ammo status of crossbow (“normal ammo loaded, with lasersight attached”)
$8000+TGROUP_ELSE, 0, $112B, >;if GBA1=17 (“poisoned ammo loaded, without lasersight attached”)
$2000, 246, $151C, > ;set 21 in the lasersight/ammo status of crossbow (“poisoned ammo loaded, with lasersight attached”)
$2000+TGROUP_ELSE, 246, $251C ;set 37 in the lasersight/ammo status of crossbow (“explosive ammo loaded, with lasersight attached”)


Activate an F118 in “single” or “multiple” mode for TriggerGroup#1 to attach the lasersight.
(The command won’t do anything if the required item is not in the inventory.)

If the lasersight is just attached to the crossbow, but you want to attach it to the revolver, then the command will separate that.
If the lasersight is just attached to the revolver, but you want to attach it to the crossbow, then the command will separate that.

Note:
Sometimes it is possible to have two lasersights temporarily in the inventory. – See eg. this Script:

Equipment= LASERSIGHT_ITEM, 1
Equipment= SIXSHOOTER_ITEM, 1+LOAD_LASERSIGHT

It is naturally an invalid Script, don’t do this, or else perhaps the command about lasersights will fail!

Command:
Separate lasersight from Y weapon

It works even if you remove the lasersight when the weapon is in Lara’s hand.

Y: only from revolver

TriggerGroup= 1, $2000, 244, $1E00, >;copy the actual lasersight status of revolver into Global Byte Alfa1 (GBA1) variable
$8000, 0, $D2B, >;if GBA1=13 (“lasersight attached”)
$2000, 246, $91E, >;set 9 in the lasersight status of revolver (“lasersight is not attached”)
$2000, 50, $16F, >;put a (standalone) lasersight in the inventory
$8000, 2, $23, >;if Lara is holding revolver
$2000, 100, $60A ;swap right hand mesh for SIXSHOOTER_ANIM slot (to remove lasersight from the hand mesh)


Y: only from crossbow

TriggerGroup= 1, $2000, 244, $1C00, >;copy the actual lasersight/ammo status of crossbow into Global Byte Alfa1 (GBA1) variable
$2000, 233, $600, >;subtract 6 from GBA1
$8000, 0, $72B, >;if GBA1=7 (7+6=13: “normal ammo loaded, with lasersight attached”)
$2000, 246, $91C, >;set 9 in the lasersight/ammo status of crossbow (“normal ammo loaded, without lasersight attached”)
$2000, 50, $16F, >;put a (standalone) lasersight in the inventory
$8000, 6, $23, >;if Lara is holding crossbow
$2000, 100, $40A, >;swap right hand mesh for CROSSBOW_ANIM slot (to remove lasersight from the hand mesh)
$8000+TGROUP_ELSE, 0, $F2B, >;if GBA1=15 (15+6=21: “poisoned ammo loaded, with lasersight attached”)
$2000, 246, $111C, >; set 17 in the lasersight/ammo status of crossbow (“poisoned ammo loaded, without lasersight attached”)
$2000, 50, $16F, >;put a (standalone) lasersight in the inventory
$8000, 6, $23, >;if Lara is holding crossbow
$2000, 100, $40A, >;swap right hand mesh for CROSSBOW_ANIM slot (to remove lasersight from the hand mesh)
$8000+TGROUP_ELSE, 0, $1F2B, >;if GBA1=31 (31+6=37: “explosive ammo loaded, with lasersight attached”)
$2000, 246, $211C, >; set 33 in the lasersight/ammo status of crossbow (“explosive ammo loaded, without lasersight attached”)
$2000, 50, $16F, >;put a (standalone) lasersight in the inventory
$8000, 6, $23, >;if Lara is holding crossbow
$2000, 100, $40A ;swap right hand mesh for CROSSBOW_ANIM slot (to remove lasersight from the hand mesh)


Y: from any weapon (either revolver or crossbow)

TriggerGroup= 1, $2000, 244, $1E00, >;copy the actual lasersight status of revolver into Global Byte Alfa1 (GBA1) variable
$8000, 0, $D2B, >;if GBA1=13 ("lasersight attached")
$2000, 246, $91E, >;set 9 in the lasersight status of revolver ("lasersight is not attached")
$2000, 118, $102, >;perform TriggerGroup#2 in "single" mode
$2000+TGROUP_ELSE, 244, $1C00, >;copy the actual lasersight/ammo status of crossbow into GBA1
$2000, 233, $600, >;subtract 6 from GBA1
$8000, 0, $72B, >;if GBA1=7 (7+6=13: "normal ammo loaded, with lasersight attached")
$2000, 246, $91C, >;set 9 in the lasersight/ammo status of crossbow ("normal ammo loaded, without lasersight attached")
$2000, 118, $102, >;perform TriggerGroup#2 in "single" mode
$8000+TGROUP_ELSE, 0, $F2B, >;if GBA1=15 (15+6=21: "poisoned ammo loaded, with lasersight attached")
$2000, 246, $111C, >; set 17 in the lasersight/ammo status of crossbow ("poisoned ammo loaded, without lasersight attached")
$2000, 118, $102, >;perform TriggerGroup#2 in "single" mode
$8000+TGROUP_ELSE, 0, $1F2B, >;if GBA1=31 (31+6=37: "explosive ammo loaded, with lasersight attached")
$2000, 246, $211C, >; set 33 in the lasersight/ammo status of crossbow ("explosive ammo loaded, without lasersight attached")
$2000, 118, $102 ;perform TriggerGroup#2 in "single" mode
TriggerGroup= 2, $2000, 50, $16F, >;put a (standalone) lasersight in the inventory
$8000, 2, $23, >;if Lara is holding revolver
$2000, 100, $60A, >;swap right hand mesh for SIXSHOOTER_ANIM slot (to remove lasersight from the hand mesh)
$8000+TGROUP_ELSE, 6, $23, >;if Lara is holding crossbow
$2000, 100, $40A ;swap right hand mesh for CROSSBOW_ANIM slot (to remove lasersight from the hand mesh)


Activate an F118 in “single” or “multiple” mode for TriggerGroup#1 to separate the lasersight.
(The command won’t do anything if the required item is not in the inventory.)

Note:
See invalid Script bug above.

Command:
Load X ammo into Y weapon

The command is useful, because it will do that any time during the game (even if the weapon is in Lara’s hand). Equipment Script command is able to do that only for the start of the game.

Y: into shotgun

TriggerGroup= 1, $8000, 353, $2, >;if shotgun is in the inventory
$2000, 246, $X1B ; set the proper ammo


X codes are:

9 - normal
11 - wideshot

Y: into grenade gun

TriggerGroup= 1, $8000, 361, $2, >;if grenade gun is in the inventory
$2000, 246, $X1D ; set the proper ammo


X codes are:

9 - normal
11- super
21 - flash

Y: into crossbow

TriggerGroup= 1, $2000, 244, $1C00, >;copy the actual lasersight/ammo status of crossbow into Global Byte Alfa1 (GBA1) variable
$2000, 233, $600, >;subtract 6 from GBA1
$8000, 0, $32B, >;if GBA1=3 (3+6=9: “normal ammo loaded, without lasersight attached”)
$8000+TGROUP_OR, 0, $B2B, >;if GBA1=11 (11+6=17: “poisoned ammo loaded, without lasersight attached”)
$8000+TGROUP_OR, 0, $1B2B, >;if GBA1=27 (27+6=33: “explosive ammo loaded, without lasersight attached”)
$2000, 246, $X*1C, >; set the proper ammo
$8000+TGROUP_ELSE, 0, $72B, >;if GBA1=7 (7+6=13: "normal ammo loaded, with lasersight attached")
$8000+TGROUP_OR, 0, $F2B, >;if GBA1=15 (15+6=21: "poisoned ammo loaded, with lasersight attached")
$8000+TGROUP_OR, 0, $1F2B, >;if GBA1=31 (31+6=37: "explosive ammo loaded, with lasersight attached")
$2000, 246, $X**1C ; set the proper ammo


X codes are (each ammo needs two codes, type the first code where you see X*, the second one for X**):

9, D - normal
11, 15 – poisoned
21, 25 – explosive

Activate an F118 in “single” or “multiple” mode for TriggerGroup#1 to set the proper ammo.
(The command won’t do anything if the required item is not in the inventory.)

Condition:
If Y weapon/lasersight status is X

The condition is able to do with weapons something what C1 cannot do:
It will distinguish “missing because it has not been picked up” from “missing because it has been removed”.

And it is able to do something what C2 cannot do:
It will distinguish “present without lasersight attached” from “present with lasersight attached”.
And it will be able to study a given ammo. C2 is able to study only “present with any ammo”.

Y: shotgun status:

TriggerGroup= 1, $2000, 244, $1B00, >;copy the actual status of shotgun into Global Byte Alfa1 (GBA1) variable
$8000, 0, $X2B, > ; if GBA1=X
W


X codes are:

0 – the shotgun has not been picked up yet
8 - the shotgun has been removed (W is necessary only now. It is $8000+TGROUP_OR, 0, $102B: if GBA1=16.)
9 – the shotgun is picked up, loaded with normal ammo
11 – the shotgun is picked up, loaded with wideshot ammo

Y: Uzi status:

TriggerGroup= 1, $2000, 244, $1A00, > ;copy the actual status of Uzi into Global Byte Alfa1 (GBA1) variable
$8000, 0, $X2B ; if GBA1=X


X codes are:

0 – the Uzis have not been picked up yet
8 - the Uzis have been removed
9 – the Uzis are picked up

Y: revolver status:

TriggerGroup= 1, $2000, 244, $1E00, > ;copy the actual status of Uzi into Global Byte Alfa1 (GBA1) variable
$8000, 0, $X2B, > ; if GBA1=X
W


X codes are:

0 – the revolver has not been picked up yet
8 - the revolver has been removed (W is necessary only now. It is $8000+TGROUP_OR, 0, $C2B: if GBA1=12.)
9 – the revolver is picked up, lasersight is separated, or has not attached yet. (The inventory presence of the lasersight is not studied now.)
D – the revolver is picked up, attached to lasersight.

Y: grenade gun status:

TriggerGroup= 1, $2000, 244, $1D00, > ;copy the actual status of grenade gun into Global Byte Alfa1 (GBA1) variable
$2000, 233, $300, > ;subtract 3 from GBA1
$8000, 0, $X, >;if GBA1 is…
W, >
V


X codes are:

1F29 – the grenade gun has not been picked up yet (This code works only with byte variables!)
52B - the grenade gun has been removed (W is necessary only now. It is $8000+TGROUP_OR, 0, $D2B: if GBA1=13. V is necessary only now. It is $8000+TGROUP_OR, 0, $1D2B: if GBA1=29.)
62B – the grenade gun is picked up, loaded with normal ammo
E2B – the grenade gun is picked up, loaded with super ammo
1E2B – the grenade gun is picked up, loaded with flash ammo

Y: crossbow status:

X: the crossbow has not been picked up yet:

TriggerGroup= 1, $2000, 244, $1C00, >;copy the actual status of crossbow into Global Byte Alfa1 (GBA1) variable
$8000, 0, $2B ;if GBA1=0


X: the crossbow is picked up, loaded with Z ammo:

TriggerGroup= 1, $2000, 244, $1C00, >;copy the actual status of crossbow into Global Byte Alfa1 (GBA1) variable
$2000, 233, $600, > ;subtract 6 from GBA1
$8000, 0, $Z*2B, >; if GBA1=Z*
$8000+TGROUP_OR, 0, $Z**2B ;if GBA1=Z**


Z codes are (each ammo needs two codes, type the first code where you see Z*, the second one for Z**):

3, 7 - normal
B, F – poisoned
1B, 1F – explosive

X: the crossbow has been removed:

TriggerGroup= 1, $2000, 244, $1C00, >;copy the actual status of crossbow into Global Byte Alfa1 (GBA1) variable
$2000, 233, $600, > ;subtract 6 from GBA1
$8000, 0, $22B, >; if GBA1=2
$8000+TGROUP_OR, 0, $A2B, > ;if GBA1=10
$8000+TGROUP_OR, 0, $1A2B, > ;if GBA1=26
$8000+TGROUP_OR, 0, $62B, > ;if GBA1=6
$8000+TGROUP_OR, 0, $E2B, >;if GBA1=14
$8000+TGROUP_OR, 0, $1E2B ;if GBA1=30


X: the crossbow is picked up, lasersight is separated, or has not attached yet (the inventory presence of the lasersight is not studied now):

TriggerGroup= 1, $2000, 244, $1C00, >;copy the actual status of crossbow into Global Byte Alfa1 (GBA1) variable
$2000, 233, $600, >;subtract 6 from GBA1
$8000, 0, $32B, > ;if GBA1=3
$8000+TGROUP_OR, 0, $B2B, > ;if GBA1=11
$8000+TGROUP_OR, 0, $1B2B ;if GBA1=27


X: the crossbow is picked up, attached to lasersight:

TriggerGroup= 1, $2000, 244, $1C00, >;copy the actual status of crossbow into Global Byte Alfa1 (GBA1) variable
$2000, 233, $600, > ; subtract 6 from GBA1
$8000, 0, $72B, > ;if GBA1=7
$8000+TGROUP_OR, 0, $F2B, > ;if GBA1=15
$8000+TGROUP_OR, 0, $1F2B ;if GBA1=31


Y: lasersight status:

X: lasersight is picked up, attached to any weapon (revolver or crossbow):

TriggerGroup= 1, $2000, 244, $1E00, >;copy the actual status of revolver into Global Byte Alfa1 (GBA1) variable
$2000, 244, $1C01, >;copy the actual status of crossbow into Global Byte Alfa2 (GBA2) variable
$2000, 233, $601, > ; subtract 6 from GBA2
$8000, 0, $D2B, > ;if GBA1=13
$8000+TGROUP_OR, 1, $72B, > ;if GBA2=7
$8000+TGROUP_OR, 1, $F2B, > ; if GBA2=15
$8000+TGROUP_OR, 1, $1F2B ;if GBA2=31


X: There is no need for a “lasersight is picked up, separated from any weapon or has not attached yet”condition, because if C2 condition says “lasersight is in the inventory”, that means the lasersight is not attached. I mean, technically the lasersight is not in the inventory when it is attached to a weapon.

X: lasersight is picked up, either attached to any weapon or separated/not attached yet:

TriggerGroup= 1, $2000, 244, $1E00, >;copy the actual status of revolver into Global Byte Alfa1 (GBA1) variable
$2000, 244, $1C01, >;copy the actual status of crossbow into Global Byte Alfa2 (GBA2) variable
$2000, 233, $601, > ; subtract 6 from GBA2
$8000, 0, $D2B, > ;if GBA1=13
$8000+TGROUP_OR, 1, $72B, > ;if GBA2=7
$8000+TGROUP_OR, 1, $F2B, > ; if GBA2=15
$8000+TGROUP_OR, 1, $1F2B, > ;if GBA2=31
$8000+TGROUP_OR, 370, $2 ;a (standalone) lasersight is in the inventory


The easiest solutions to use the conditions:
- The TriggerGroup 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 ID is referred by the IdConditionTriggerGroup field of a GlobalTrigger.


Made using TRNG 1.2.2.7.
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 17:49.


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