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 27-05-15, 09:07   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default TRNG – Enemy Jeep customization

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

In a nutshell about the basic setup of Enemy Jeeps:

- The jeep will be seeable in the game even before its activation, where you placed it in Room Editor.
- The jeep will always follow a preset route. (Just like the guide or Von Croy.) You need to draw the route, putting AI_FOLLOW objects in the map. The AI_FOLLOW’s are identified with OCB numbers you typed in their OCB panels (Number A). The first AI_FOLLOW (where the jeep object is placed) has ID -2. The further OCB numbers are in increasing order: -1, 0, 1, 2, 3 etc.
- The way you rotated the AI_FOLLOW nullmesh will define the facing of the jeep at that AI_FOLLOW!
- You need F30 triggers to move the jeep between AI_FOLLOW’s. Each F30 will move the jeep from the actual AI_FOLLOW to the next one. That “next” AI_FOLLOW must be identified in this F30 (Number B), typing it in Timer window. B=A-1, so eg. if this F30 sends the jeep to AI_FOLLOW where 5 is typed in the OCB window, then B must be 4 in the trigger.
- To make the jeep start the route, you need to activate the jeep with a common trigger. (You can’t deactivate the jeep after that.) The very first F30 should be overlapped with the common trigger.
- If there is no F30 to send the jeep to an AI_FOLLOW, then the jeep will only touch it, but won’t stop there. Eg. an F30 will send the jeep from AI_FOLLOW 2 to AI_FOLLOW 4. In that case, the jeep will go from AI_FOLLOW 2 to AI_FOLLOW 4, stopping only at AI_FOLLOW 4, only touching AI_FOLLOW 3.
- Be careful! All the AI_FOLLOW’s, to which an F30 sends the jeep, must have OCB Button 2 pushed.
- You can’t reverse the route, so eg. the jeep can’t go from AI_FOLLOW 7 to AI_FOLLOW 6.
- The jeep will never overrun Lara (or other creatures), so if she is in front of the jeep, then the vehicle will only be pushing her. (Maybe you can use a “collision” GlobalTrigger to make it overrun her.)
- The jeep will shoot grenades at Lara, if she is (even a bit farther, sometimes even much farther) behind the vehicle. The jeep will shoot grenades only parking at an AI_FOLLOW. The jeep will shoot a grenade in each fifth second, till leaving that AI_FOLLOW.
- The jeep will activate HEAVY/HEAVYANTITRIGGER triggers at each AI_FOLLOW, where the vehicle just is. (Either parking there or only touching the nullmesh.)
- The (most of the) objects seem air for the jeep, they are no obstacles.
- Jeeps are able to use object platforms. You can even place AI_FOLLOW’s on the platforms (having AI_FOLLOW’s always on the level of the platform). – But never move the platform with the jeep on it!
- High or bluffy edges, slopes are not obstacles for the jeep. (Naturally the animation could be sometimes ugly in these cases.) The vehicle can go through even water or quicksand.
- Avoid complicated routes. (Eg. hairpin bends.)

Here is a tutorial project for enemy jeeps:

http://www.trsearch.org/Items/908

Troubleshooting:

- If you use F30 in the previous levels (because eg. you used another enemy jeep in that level) then you need to reset ID values (you used typed in F30 triggers) back to 0, for the new level, with a ResetHUB Script command.
- If you also have a guide or Von Croy (or more) in the level, then you can try some different OCB ID sequence for them, than usual. For example, the jeep AI_FOLLOW OCB sequence ends at 28 (…26, 27, 28), and the Von Croy AI_FOLLOW OCB sequence, that usually starts from 0 (0, 0, 1, 2 etc.), this time will start from 29 (29, 29, 30, 31 etc.) - This could be also useful, if you don’t want to use ResetHUB between levels.
(If you have more than one AI_FOLLOW users in a level – eg. a jeep and then a Von Croy -, and you have problems with the first user – because you can’t activate properly the second one till the first one is alive -, then kill the first one with an A14.)
- You can use only one Enemy Jeep per level, because its sequence always starts from -2.

Command:
Adjust the speed of X Enemy Jeep to Y

TriggerGroup= 1, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 261, $W015 ; put the number at W0 position of PARAM_BIG_NUMBERS into the speed (W0 is 0 in this example, W0 must be typed in hexadecimal format now in the trigger code)
Parameters= PARAM_BIG_NUMBERS, Y

Y values are “units/second” (approximately). So eg. if Y=256 then the jeep will drive 256 units in each second, driving between two AI_FOLLOW’s. 1024 units mean 1 square distance.

You need a continous activation. So the customized speed will get back to the default one when you stop the continuous activation.
Activate an F118 in “continuous” mode for TriggerGroup#1 to start the continous activation. – Activate an F192 for the same TriggerGroup to stop the continous activation.
Or activate TriggerGroup#1 with a GlobalTrigger, with a continuous condition (eg. GT_ALWAYS) to start the continous activation. – If the condition goes false or you disable the GlobalTrigger with an F109 that will stop the continous activation.

Note:
The jeep needs some time to turn to an AI_FOLLOW. So if the speed is too big then the jeep may no time enough to turn to an AI_FOLLOW, and the jeep will even miss that nullmesh. (And there can be other anomalies, too.)

Condition:
If X Enemy Jeep is just Y moving/parked

TriggerGroup= 1, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 256, $1500, > ;put the actual status into Global Byte Alfa1 (GBA1) variable
Y

Y values are:
- parking at an AI_FOLLOW:
$8000, 0, $2B ; if GBA is 0
- moving between two AI_FOLLOW’s (or just touching an AI_FOLLOW, not stopping there):
$8000+TGROUP_NOT, 0, $2B ; if GBA is not 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:
Make X Enemy Jeep shoot the next grenade in Y seconds

TriggerGroup= 1, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 261, $W017 ; put the number at W0 position of PARAM_BIG_NUMBERS into the speed (W0 is 0 in this example, W0 must be typed in hexadecimal format now in the trigger code)
Parameters= PARAM_BIG_NUMBERS, Z

Z values are in tick frames. Z=30×Y, so eg. if Z=90, then Y is 3 seconds.

Activate an F118 in „single” mode for TriggerGroup#1 to start the counter.

Notes:

- So it is only for the next shot! The further shots after that will happen by the default 5 seconds.
- The command will be useable only if the jeep is in “grenade-shooting mode” (i.e. parking at an AI_FOLLOW when Lara is behind the vehicle).

Command:
Make X Enemy Jeep have Y seconds between shooting two grenades

GlobalTrigger= 1, IGNORE, GT_CONDITION_GROUP, IGNORE, 1, 2, IGNORE
TriggerGroup= 1, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 256, $1700, > ; put the time value into Global Byte Alfa1 (GBA1) variable.
$8000, 0, $W028; if GBA1 is the number at W0 position of PARAM_BIG_NUMBERS, W0 (must be typed in hexadecimal format now in the trigger code)is 0 in this example
TriggerGroup= 2, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 261, $W117 ; put the number at W1 position of PARAM_BIG_NUMBERS into the shooting time (W1 is 1 in this example, W1 must be typed in hexadecimal format now in the trigger code)
Parameters= PARAM_BIG_NUMBERS, 149, Z

Z values are in tick frames. Z=30×Y, so eg. if Z=90, then Y is 3 seconds.
This time Z can’t be bigger than 148 frames!

Command:
Disable X Enemy Jeep to shoot grenades

TriggerGroup= 1, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 261, $W017 ; put the number at W0 position of PARAM_BIG_NUMBERS into the shooting time (W0 is 0 in this example, W0 must be typed in hexadecimal format now in the trigger code)
Parameters= PARAM_BIG_NUMBERS, Z

Z values are in tick frames. Z=30×Y, so eg. if Z=90, then Y is 3 seconds.

You need a continous activation. So the grenades will be enabled again when you stop the continuous activation.
Activate an F118 in “continuous” mode for TriggerGroup#1 to start the continous activation. – Activate an F192 for the same TriggerGroup to stop the continous activation.
Or activate TriggerGroup#1 with a GlobalTrigger, with a continuous condition (eg. GT_ALWAYS) to start the continous activation. – If the condition goes false or you disable the GlobalTrigger with an F109 that will stop the continous activation.

Z timer value is only important if the jeep is in “grenade-shooting mode” when you stop the continuous activation. In that case, the jeep will start shooting in Z frames, after re-enabling the grenades. In other cases, Z could be anything (but 0).

Note:
This command is useful eg. if you want to remote control a “peaceful” car, i.e. which is not controlled by Lara, disabling the grenades forever.

Condition:
If X Enemy Jeep shots the next grenade in Y exactly/more/less than Z seconds

TriggerGroup= 1, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 256, $1700, > ; put the time value into Global Byte Alfa1 (GBA1) variable
$8000, 0, $W0Y, > ;if GBA1 is the number at W0 position of PARAM_BIG_NUMBERS, W0 (must be typed in hexadecimal format now in the trigger code)is 0 in this example
$8000, 0, $129 ; if GBA1 >=1 (or else the „smaller” condition will be true even if the jeep is moving)
Parameters= PARAM_BIG_NUMBERS, V

V values are in tick frames. V=30×Z, so eg. if V=90, then Z is 3 seconds.
This time V can’t be bigger than 148 frames!

Y values are:
26 – for a “bigger” condition (this time V must be the original V plus 1, so eg. if you want a “bigger than 50” condition, then V is 51)
27 – for a “smaller” condition
28 – for an “equal” condition

Note:
The condition is useable only if the jeep is in “grenade-shooting mode”.

------------------------------------------------------------------------------
SOME EXTRAS WITH OTHER ENEMY VEHICLES

Command:
Make X Enemy Submarine tilt continuously in Y way

TriggerGroup= 1, $5000, X, $36, > ; defining the submarine with its X ID code you see in Room Editor
$2000, 261, $W015 ; put the number at W0 position of PARAM_BIG_NUMBERS into the tilt (W0 is 0 in this example, W0 must be typed in hexadecimal format now in the trigger code)
Parameters= PARAM_BIG_NUMBERS, Y

Y values are:
From -1984 (left, maximum) to 1984 (right, maximum) (0: not tilted)

You need a continous activation. When you stop the continuous activation, then the submarine will perform the angle only as its wish after that.
Activate an F118 in “continuous” mode for TriggerGroup#1 to start the continous activation. – Activate an F192 for the same TriggerGroup to stop the continous activation.
Or activate TriggerGroup#1 with a GlobalTrigger, with a continuous condition (eg. GT_ALWAYS) to start the continous activation. – If the condition goes false or you disable the GlobalTrigger with an F109 that will stop the continous activation.

Notes:

- The forced angle won't bother the submarine to turn. So eg. if you force a maximal left tilt with -1984 then the submarine will be able to take a perfect right turn.
- It's not worth a single (i.e. not continuous) force, because the submarine will correct the position at once and you won't really see any forced angle.

Condition:
If X Enemy Submarine is tilted in Y direction

TriggerGroup= 1, $5000, X, $36, > ; defining the jeep with its X ID code you see in Room Editor
$2000, 256, $1500, > ;put the actual status into Global Byte Alfa1 (GBA1) variable
Y

Y values are:
- not tilted
$8000, 0, $2B ; if GBA1=0
- tilted right:
$8000, 0, $129; if GBA1>=1
- tilted left:
$8000, 0, $2A; if GBA1<0

Condition:
If X Enemy Submarine is tilted Y exactly/more/less than Z degrees

If Z is positive or 0, so if the submarine is not tilted or tilted right:

TriggerGroup= 1, $5000, X, $36, > ; defining the submarine with its X ID code you see in Room Editor
$2000, 256, $1510, > ; put the actual angle into Global Short Alfa (GSA1) variable
$8000, 16, $W0Y ;if GSA1 is the number at W0 position of PARAM_BIG_NUMBERS, W0 (must be typed in hexadecimal format now in the trigger code)is 0 in this example
Parameters= PARAM_BIG_NUMBERS, Z

Y values are:
26 – for a “bigger” condition (this time Z must be the original Z plus 1, so eg. if you want a “bigger than 1024” condition, then Z is 1025)
27 – for a “smaller” condition
28 – for an “equal” condition

Z: from 0 to 1984.

If Z is negative, so if the submarine is tilted left:

TriggerGroup= 1, $5000, X, $36, > ; defining the submarine with its X ID code you see in Room Editor
$2000, 256, $1510, > ; put the actual coordinate into Global Short Alfa1 (GSA1) variable
$2000, 284, $10, > ; turn the sign in GSA1
$8000, 16, $W0Y ;if GSA1 is the number at W0 position of PARAM_BIG_NUMBERS, W0 (must be typed in hexadecimal format now in the trigger code)is 0 in this example
Parameters= PARAM_BIG_NUMBERS, Z

Y values are:
26 – for a “bigger” condition (this time Z must be the original Z plus 1, so eg. if you want a “bigger than 1024” condition, then Z is 1025)
27 – for a “smaller” condition
28 – for an “equal” condition

Z: from -1 to -1984.

If Z is negative, then turn the sign in PARAM_BIG_NUMBERS! (So eg. if Z=-1024, then type 1024 in PARAM_BIG_NUMBERS.) – It is important, because PARAM_BIG_NUMBERS doesn’t like conditions with negative numbers.


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 01:00.


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