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 22-05-15, 10:16   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,374
Default TRNG – AI special

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 Beta1, 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.

Command:
Force GUARD property on X enemy

The property will be 'created' where the creature just is. So, if you force the property then the creature will stop where he just is and starts acting as if he were standing at an AI_GUARD object.
But be careful! The creature at an AI_GUARD object will drop GUARD property, when noticing Lara. That's why you cannot force GUARD property on the creature if Lara is too close to him.

TriggerGroup= 1, $5000, X, $36, > ; defining the object with its X ID code you see in Room Editor
$2000, 261, $W027 ; ** put the number at W0 position of PARAM_BIG_NUMBERS into the „AI” parameter (W0 is 0 in this example, W0 must be typed in hexadecimal format now in the trigger code)
Parameters= PARAM_BIG_NUMBERS, 547

Activate an F118 in „single” mode for TriggerGroup#1 to force the property.

Notes:
- Force the value only if the creature is active (alive).
- An AI_GUARD object works only once during the lifetime of the creature. But you can force GUARD property any time you want while the creature is living.
- 'Forcing GUARD' means only the single GUARD property, i.e. not including GUARD+MODIFY.
- 'Forcing GUARD' when the creature is standing at an AI_GUARD and an AI_MODIFY object means the creature will drop MODIFY property and starts acting as if only there were an AI_GUARD object there.
- Forcing other AI properties is buggy or effectless. (Or useless. For example why should you force FOLLOW property? I mean, 'AI_FOLLOW type creatures' - Guide, Von Croy etc. - always need AI_FOLLOW objects, but other creatures can't do anything with FOLLOW property even if you force it on them.)

Command:
Force X enemy to drop all the AI properties

For example, if the creature keeps guard at an AI_GUARD object, then dropping this GUARD property means the creature will leave his post - though Lara has not disturbed him, being too far away from him.
So 'drop' means now 'as if Lara had distracted the creature performing GUARD property'.

The command is useful only with GUARD, MODIFY, GUARD+MODIFY, PATROL properties.

TriggerGroup= 1, $5000, X, $36, > ; defining the enemy with its X ID code you see in Room Editor
$2000, 255, $2327; ** force Value 35 for the „AI” parameter

Activate an F118 in „single” mode for TriggerGroup#1 to drop the properties.

Notes:

- Force the value only if the creature is active (alive).
- It also works with forced GUARD property. (See the previous command.)

Condition:
If X enemy has Y AI property

TriggerGroup= 1, $5000, X, $36, > ; defining the object with its X ID code you see in Room Editor
$2000, 256, $2710, > ; * put the actual AI status into Global Short Alfa1 (GSA1) variable
$8000, 16, $W028; 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, Y

Y values are:

35: the enemy doesn't have an AI property, because:

a, he's dropped his AI properties when he's been distracted by Lara, or
b, you've made him drop all the AI properties by the command above, or
c, he will have GUARD AI property, but only later, if you will force it on him.

547: the enemy has GUARD AI property, because

a, he's standing at an AI_GUARD object, or
b, you've forced GUARD property on him, or
c, he's reached the second AI_AMBUSH object from the first one, or
d, he was standing at an AI_GUARD and an AI_MODIFY object but you've forced GUARD property on him.

1059: the enemy has AMBUSH AI property, because he's running from the first AI_AMBUSH object to the second one.
2083: the enemy has PATROL AI property, because he's patrolling between AI_PATROL1 and AI_PATROL2 objects.
4131: the enemy has MODIFY AI property, because he's standing at an AI_MODIFY object.
4643: the enemy has GUARD+MODIFY AI property, because he's standing at an AI_GUARD and an AI_MODIFY object.

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.

Notes:

- Don't use the condition if the enemy is not alive (still not living or dead). (So maybe you should use a C14 condition, as the first trigger of the TriggerGroup, saying, “only if the enemy is alive”.)
- The value is also 35 if the enemy doesn't have an AI property and he hasn't had it before and he won't have it later. But it is naturally a case which is not needed to study.
- We won't study the FOLLOW AI property (Y=8227), because, as I said above it is logical that some objects have that flag but some objects don't.
(In fact, the guide or Von Croy won't have FOLLOW property continuously during their lifetime, sometimes they drop it temporarily. But it is not easy to tell exactly when it happens so we should skip discussing this.)
- The condition doesn’t seem useable with AI_X1 and AI_X2 properties.
- Be careful, we can have some special situations with AI properties. - Some cases I discovered:

= It is not so easy to 'really' lose the MODIFY property. For example, a crocodile will leave AI_MODIFY after having been distracted, but still having Value 4131 of MODIFY property. Or, baddy_1 distracted can't leave AI_MODIFY, just starts shooting at Lara with infinite ammo, still having Value 4131 of MODIFY property. - To make everything work normally again, you need to force the creature to drop all the AI properties.
= If the skeleton/baddy jumps aside when triggered (see: OCB 1 or 2) then he adopts GUARD property (temporarily, while he's doing that movement).
= If Setha can't find Lara, then he adopts AMBUSH property (forever, so he won't drop it if he will find Lara later).

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

*: Be careful! If you use commands with some $...27 triggers (see eg. “poison X enemy”), that may affect the usability of the condition. If you want the condition then you may avoid that command.
**: Be careful! If you use other commands with other $...27 triggers at the same time when you use this command, then one or more of the commands will fail. If you want the command to work, then you may avoid the other commands.

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

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

SOME EXTRAS:

Command:
Make X crocodile waiting an AI_GUARD to move his tail in Y direction

Maybe this command seems dull, but how about this example:
If the creature moves the tail leftwards, then a GlobalTrigger will emit a red light with F355, or if the creature moves the tail rightwards, then another GlobalTrigger will emit a green light with F355.

TriggerGroup= 1, $5000, X, $36, > ; defining the enemy with its X ID code you see in Room Editor
$2000, 261, $W016 ; put the number at W0 position of PARAM_BIG_NUMBERS into the tail direction (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:

- 12 - leftwards
12 - rightwards

You need a continous activation. So the tail will keep that direction till you stop forcing. After that, the creature will start moving his tail as his wish.
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.

Condition:
If the latest move of the tail of X crocodile waiting an AI_GUARD was in Y direction

I said above at the command, why this crocodile-tail thing could be useful.

TriggerGroup= 1, $5000, X, $36, > ; defining the object with its X ID code you see in Room Editor
$2000, 256, $2710, > ; * put the actual AI status into Global Short Alfa1 (GSA1) variable
$8000, 16, $W028, >; 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
$2000, 256, $1604, > ; put the actual tail status into Global Byte Beta1 (GBB1) variable
Y
Parameters= PARAM_BIG_NUMBERS, 547

Y values are:
- rightwards:
$8000, 4, $C2B ; if GBB1=12
- leftwards:
$8000, 4, $2A; if GBB1<0


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 02:13.


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