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 28-10-17, 20:29   #1
matrix54
Tomb Raider
 
matrix54's Avatar
 
Join Date: May 2007
Location: N/A
Posts: 19,449
Default TRNG - Unique Weapon Damage, Triggers, & Effects Based On Enemy Type

Under some circumstances, you may want to have certain weapons do varying amounts of damage based on the enemy type, like pistols doing double damage to an organic target, while doing none to a metallic target. For the purposes of this tutorial, I'll explain everything, so you can make all of the changes you desire for any weapon or number of targets!

First, let's begun by customizing our ammo. We'll use pistols...

Code:
Customize= CUST_AMMO, PISTOLS_AMMO_ITEM, IGNORE, 0, IGNORE, IGNORE, IGNORE, 1 IGNORE, IGNORE, IGNORE, IGNORE, IGNORE
The weapon above does 0 damage, and will activate TriggerGroup1 upon shooting an enemy with either or both of Lara's pistols. Doing 0 damage for every enemy we encounter is important, because we don't want Lara to do any additional damage where we do not want her to.

Let's setup our TriggerGroup. First, we need the item IDs of each of the enemies we plan on using in our levels. We can use an organic target, Baddy1, an armored target, Baddy2, and a robotic target, the Horseman. We need to acquire the slot IDs for each of these enemies, which can be found in NG Center's movable list. The IDs are as follows:

Code:
Baddy1: 41
Baddy2: 43
Horseman: 53
When a weapon is fired and hits an enemy, we can "grab" the shot enemy's data and modify it. We start by putting the found object into the selected item memory...

Code:
; Set Trigger Type - ACTION 54
; Exporting: TRIGGER(54:0) for ACTION(0) {Tomb_NextGeneration}
; <#> : LARA                       ID 0      in sector (9,11) of Room1
; <&> : Variables. Set the index of <#>moveable as Selected Item
; (E) : 
; Values to add in script command: $5000, 0, $36
Attached to the beginning of that particular TriggerGroup entry, we need to use "TGROUP_USE_FOUND_ITEM_INDEX+" so the game doesn't call object 0. You can also replace that longer entry with a "1+" for convenience. Next, we take the selected item's slot ID and put it into the current value...

Code:
; Set Trigger Type - FLIPEFFECT 256
; Exporting: TRIGGER(1023:0) for FLIPEFFECT(256) {Tomb_NextGeneration}
; <#> : Variables. Memory. Copy to <&> Numeric Variable the (E)Selected Item Memory
; <&> : Current Value
; (E) : Slot Id (number of slot) (Short)
; Values to add in script command: $2000, 256, $3FF
We then run a test for the current value to see if it equals any of the enemy values we're using, replacing the red number with our slot of choice.

Code:
; Set Trigger Type - CONDITION 48
; Exporting: CONDITION(48:0) for PARAMETER(0) {Tomb_NextGeneration}
; <#> : Value=     0
; <&> : Variables. The Current Value variable is = than <#>Value
; (E) : 
; Values to add in script command: $8000, 0, $30
This code will require and "TGROUP_ELSE+" statement for every enemy test that's not the first entry, which can also be replaced by a "64+" for convenience.

Then we determine how much damage the weapon will do based on the enemy type...

We want to do:
2x damage if the target is organic.
1x damage if the target is armored.
0x damage if the target is rebotic (which can also be omitted if you desire, since the pistols do 0 damage).

Since pistols originally do 1 damage, the values are equal to 2, 1, and 0. We apply damage to each target with this script, accompanied by a "TGROUP_USE_FOUND_ITEM_INDEX+" to make sure you don't damage item 0, the code in blue being the HEX VALUE of damage you wish to do to the target.

; Set Trigger Type - ACTION 38
; Exporting: TRIGGER(294:0) for ACTION(0) {Tomb_NextGeneration}
; <#> : LARA ID 0 in sector (9,11) of Room1
; <&> : Enemy. Hurth <#>enemy removing (E)Vitality points
; (E) : Vitality Points= 1
; Values to add in script command: $5000, 0, $126
[/CODE]

You can also attach certain behavior to a target when shot if you wish to give weapons different other properties, such as...

Exploding...

Code:
; Set Trigger Type - ACTION 14
; Exporting: TRIGGER(1038:0) for ACTION(0) {Tomb_NextGeneration}
; <#> : LARA                       ID 0      in sector (9,11) of Room1
; <&> : Enemy. Kill <#>object in (E) way
; (E) : Exploding creature
; Values to add in script command: $5000, 0, $40E
Freezing...

Code:
; Set Trigger Type - ACTION 58
; Exporting: TRIGGER(58:0) for ACTION(0) {Tomb_NextGeneration}
; <#> : LARA                       ID 0      in sector (9,11) of Room1
; <&> : Enemy. Freeze. Freeze <#>Enemy for (E)Seconds
; (E) : Forever (use other action/effect to disable it)
; Values to add in script command: $5000, 0, $3A
Code:
; Set Trigger Type - ACTION 53
; Exporting: TRIGGER(16437:30) for ACTION(0) {Tomb_NextGeneration}
; <#> : LARA                       ID 0      in sector (9,11) of Room1
; <&> : Enemy. Mesh. Set for <#>enmey the (E)transparecy level
; (E) : Transparency Level=    64
; Values to add in script command: $5000, 0, $4035
And on top of freezing, you can check if a a creature is frozen with a specific value before you blow it up with a specific weapon by triggering another trigger group.

Code:
; Set Trigger Type - CONDITION 37
; Exporting: CONDITION(37:30) for OBJECT(0) {Tomb_NextGeneration}
; <#> : LARA                       ID 0      in sector (9,11) of Room1
; <&> : Creature. The <#>creature has the (E)Transparency level
; (E) : Transparency =  64
; Values to add in script command: $9000, 0, $1025
Code:
; Set Trigger Type - FLIPEFFECT 118
; Exporting: TRIGGER(258:30) for FLIPEFFECT(118) {Tomb_NextGeneration}
; <#> : TriggerGroup. Perform <&>TriggerGroup from script.dat in (E)way
; <&> : TriggerGroup=     2
; (E) :  Single performing (to use when in TriggerGroup there are only commands)
; Values to add in script command: $2000, 118, $102
Magenta is the HEX VALUE of the TriggerGroup you wish to call. Just remember to attach "TGROUP_USE_FOUND_ITEM_INDEX+" when needed.

Once all is said and done, the final TriggerGroup should look a little something like this, which included tests for all three enemies, as well as calling triggergroup2 for a frozen explosion!

Code:
TriggerGroup = 1, >
1+$5000, 0, $36, > Push target into selected item memory
$2000, 256, $3FF, > Push items slot into current value
$2000, 118, $102, > Trigger TriggerGroup #2
$8000, 41, $30, > If the current value is 41...
1+$5000, 0, $226, > Do 2 damage to this found item
64+$8000, 43, $30, > Else if the current value is 43...
1+$5000, 0, $126, >Do 1 damage to this found item
64+$8000, 53, $30, > Else if the current value is 53...
1+$5000, 0, $26 ; Do 0 damage to this found item
This is the TriggerGroup for checking is an enemy is frozen before exploding...

Code:
TriggerGroup = 2, >
1+$9000, 0, $1025, > Does the selected target have transparency level 64?
1+$5000, 0, $40E ; Explode the target
Keep in mind, some enemies don't respond to certain type (skeletons with normal and poison bolts), but this is a rare occurance.

-----~-----

Also, you can produce a wide variety of systems with this. For example, to create a grappling gun, I would place a single meshed dummy enemy (with script entries for invincibility) with a tile sided hit box in a door way that had opacity on one side enabled to prevent it from falling. After having shot this enemy and running check for its OCB value to see if it matched a specific, UNIQUE OCB number), I would then trigger a specific rope beneath the enemy.

Similarly, dummy enemies can be used as shootable switches that don't shatter to be used over and over and over again. Similar to checking the OCB code to enabled a switch, you can also change it to enabled other behavior. For example, if an enemy has OCB 1234, you will open the door when it's shot and change the OCB to 4321. If the OCB is 4321, close the door and change the OCB to 1234.

Lara could even light a torch or set things on fire with flip effects with an explosive arrow if a trigger so happened to be be within the blast radius. Lot of fun things can be done to turn weapons into tools when shooting enemies, while also being able to do damage to targets individually, while adding various effects to them.
__________________
Check out "Checkout: Journey to Employee of the Month!"

Last edited by matrix54; 28-10-17 at 20:48.
matrix54 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 18:07.


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