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 09-05-14, 14:12   #1
Krystian
Explorer
 
Join Date: May 2010
Posts: 787
Default TRNG - TRC Submarine crowbar pickup

Hello!

In this tutorial I will show how to recreate the crowbar pickup, as seen in The Submarine level of Tomb Raider Chronicles, using TRNG scripting.



Credits for the outfit go to Horus Goddess.

At the bottom of this tutorial is a fully functional script for those that don't want to do all the hard work, but I would encourage following it step by step to understand how it came to be.

Things required:
  • NGLE/TRNG
  • WadMerger
  • Basic knowledge on exporting triggers and using TriggerGroups, Animation scripts and Organizers.
So, let's get started!

Last edited by Krystian; 09-05-14 at 14:32.
Krystian is offline  
Old 09-05-14, 14:13   #2
Krystian
Explorer
 
Join Date: May 2010
Posts: 787
Default Gathering resources and exporting triggers.

First off, you will need to get the bar object from the submarine wad. You can get the wad from this package. The wad containing that object is TR5, Russia, joby3a.
When you open the wad with WadMerger, extract the SPHINX object into your wad and rename it to any ANIMATING slot (I used ANIMATING3).
Also, don't forget to take Lara's bar-pulling animation too! It's anim #471. Put it into any free slot you currently have in your Lara object.

Once you have everything you need, place the bar animating object somewhere in your level.
Select it (so it’s highlighted in red) and export the following trigger:
Code:
; Set Trigger Type - ACTION 43
; Exporting: TRIGGER(43:0) for ACTION(35)
; <#> : ANIMATING3                 ID 35     in sector (4,1) of Room11
; <&> : Trigger. (Moveable) Activate <#>Object with (E)Timer value
; (E) : Timer= +00
; Values to add in script command: $5000, 35, $2B
The values of the trigger you’ve exported will most likely be different than in my example, of course.

The next trigger we need is a Kill Object Action trigger for the bar object:
Code:
; Set Trigger Type - ACTION 14
; Exporting: TRIGGER(270:0) for ACTION(35)
; <#> : ANIMATING3                 ID 35     in sector (4,1) of Room11
; <&> : Enemy. Kill <#>object in (E) way
; (E) : Remove immediatly (disappear any item)
; Values to add in script command: $5000, 35, $10E
It may sound strange now, but it will make a lot more sense later.

That's all the Action triggers we need, moving on to the Flipeffects:
Code:
; Set Trigger Type - FLIPEFFECT 80
; Exporting: TRIGGER(215:0) for FLIPEFFECT(80)
; <#> : Lara. (Animation) Force <&>Animation (256-512) of (E)slot for Lara
; <&> : 471 Animation
; (E) : SLOT_000 LARA
; Values to add in script command: $2000, 80, $D7
To clarify, the <&> value that you will use here is the animation slot number which you put the bar pulling animation into in WadMerger. I put it into the same slot as it was in the original wad.

We will also need:
Code:
; Set Trigger Type - FLIPEFFECT 127
; Exporting: TRIGGER(1:0) for FLIPEFFECT(127)
; <#> : Organizer. Enable <&>Organizer
; <&> : Organizer=     1
; (E) : 
; Values to add in script command: $2000, 127, $1
If you are already using an Organizer with ID 1, you must choose the next unused one, of course.

At last, it's time to export the third and final flipeffect:
Code:
; Set Trigger Type - FLIPEFFECT 48
; Exporting: TRIGGER(327:0) for FLIPEFFECT(48)
; <#> : Inventory-Item. Increase (+1) in (E)way the number of <&>inventory-item in inventory
; <&> : CROWBAR_ITEM                        Slot=246
; (E) :  Show animation of item (like it was picked up)
; Values to add in script command: $2000, 48, $147
It gives Lara an actual crowbar, which is what we are trying to accomplish as the final result.

Hopefully you kept on to all those triggers. Now we'll move onto the difficu… err… I mean fun part, scripting it.

Last edited by AkyV; 06-06-16 at 13:44.
Krystian is offline  
Old 09-05-14, 14:14   #3
Krystian
Explorer
 
Join Date: May 2010
Posts: 787
Default Scripting setup and explanations.

First of all, You will need to make an Animation script, which will serve as the activation point of the whole script sequence.
Code:
Animation= 1, KEY1_ACTION, IGNORE, FAN_ALIGN_TO_ENV_POS + FAN_PERFORM_TRIGGER_GROUP, >
ENV_MULT_CONDITION, 1, IGNORE, -103
I will explain the parts in red. Normally, if we just put a 1 in the anim index, it would mean that animation 1 would play (which happens to be the walking animation). I also highlighted one of the FAN flags in red as well. FAN_PERFORM_TRIGGER_GROUP indicates, that instead of performing animation 1, the script executes TriggerGroup 1. (There is also another FAN flag, which I will get to in a bit)
Now, as before, in case you are already using that ID for a TriggerGroup, change the 1 to something else.

Coming up next is the MultEnvCondition:
Code:
MultEnvCondition= 1, ENV_FREE_HANDS, IGNORE, IGNORE, ENV_ITEM_TEST_POSITION, 1, IGNORE
So, basically it means that the animation script will be triggered if Lara doesn't hold any weapons or torches, and that she meets the conditions within the TestPosition 1 script.

In case you have never used such as script, it allows you to mark out a certain field, from which Lara can interact with a specified object.
Furthermore, using the FAN_ALIGN_TO_ENV_POS flag for the animation script, Lara will align to the object (like she does with switches, pickups, etc) to be in the perfect position for interaction.
You can get additional information on this script, as well as what each field means, from the SCRIPT NEW section in the Reference panel of NG Center.

You can simply copy my script (adjusting necessary parameters), but, if you want to and feel experienced enough, you can try to make your own.
Code:
TestPosition= 1, IGNORE, ANIMATING3, -240-256, -240+256, >
-128, 128, 296-256, 296+216, -6000, 6000, -1000, 1000, -1000, 1000
Now we'll make the first TriggerGroup, which is activated from the Animation script.
Code:
TriggerGroup= 1, $2000, 80, $D7, $5000, 35, $2B, $2000, 127, $1
What it does is the following: forces Lara's bar pulling animation, triggers the bar object (so it immediately plays its animation) and activates Organizer 1.

So, we should make that Organizer, right?
Code:
Organizer= 1, FO_TICK_TIME, IGNORE, 183, 2
The FO_TICK_TIME flag indicates that the Organizer will measure the passing time in frames, not seconds (30 frames = 1 second). So, after 183 frames (approx. 6 seconds) of activating the Organizer, TriggerGroup 2 will be executed.
You may be wondering where I got this value from. Well, take a look at the bar pulling animation. The 183rd frame is about the time she puts the bar into her backpack.

And what is this TriggerGroup 2?
Code:
TriggerGroup= 2, $5000, 35, $10E, $2000, 48, $147
It will remove the bar object from the game, and add a real crowbar to Lara's inventory.

If we simply made the object invisible instead of removing, Lara could interact with it again, and we don't want that. Not only would there be no increase in crowbars (as you can have only 1 at all times), it also looks strange with no visible bar there anymore.

Finally, build the script and test it in game. If all went well, Lara should be able to pull the bar off and put it in her inventory!




Here is the script I promised for those who were too lazy to follow the tutorial.
Code:
Animation= 1, KEY1_ACTION, IGNORE, FAN_ALIGN_TO_ENV_POS + FAN_PERFORM_TRIGGER_GROUP, ENV_MULT_CONDITION, 1, IGNORE, -103

MultEnvCondition= 1, ENV_FREE_HANDS, IGNORE, IGNORE, ENV_ITEM_TEST_POSITION, 1, IGNORE

TestPosition= 1, IGNORE, ANIMATING3, -240-256, -240+256, -128, 128, 296-256, 296+216, -6000, 6000, -1000, 1000, -1000, 1000

TriggerGroup= 1, $2000, 80, $D7, $5000 + TGROUP_USE_FOUND_ITEM_INDEX, 31, $2B, $2000, 127, $1

Organizer= 1, FO_TICK_TIME, IGNORE, 183, 2

TriggerGroup= 2, $5000 + TGROUP_USE_FOUND_ITEM_INDEX, 31, $10E, $2000, 48, $147
It's fully functional and you don't need to change anything, maybe besides a different forced animation in TriggerGroup 1 and the slot of object in the TestPosition script. The use of TGROUP_USE_FOUND_ITEM_INDEX means that it will work for any object found by the TestPosition, which is any bar object you've placed in the level.


This concludes the tutorial. I hope you enjoyed it and found it helpful.
Happy Building!

Last edited by AkyV; 01-08-17 at 10:54.
Krystian 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:45.


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