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 13-08-15, 10:48   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,505
Default TRNG - Removing Hardcoded Audio

When you’re using an object in the game, sometimes you will hear an unwanted (hardcoded) audio file.
Let’s see some examples when you encounter that problem:

a, Lara gets into the jeep. The background audio stops on channel1 automatically, and ID 098 audio starts there (in loop mode).
b, Lara gets off the jeep. 098.wav stops on channel1 automatically, and ID 110 audio starts there (in loop mode).
c, Lara gets into the motorboat or the rubberboat. ID 012 audio starts on channel2 (in single mode), automatically.

For instance, let’s take the case of the jeep:
I’ll show you now how to prevent the problem, using scripting.
Using this “scripting solution”, you won’t sense any change, actually, when Lara gets in and then gets off, i.e. the audio will remain the same on channel1. (See Note#1 below to understand what “actually” means.)

All you have to do is place some entries in your Script:

GlobalTrigger= 1, IGNORE, GT_LARA_HOLDS_ITEM, HOLD_JEEP, IGNORE, 1, 1
TriggerGroup= 1, $2000, 68, $16B

; Set Trigger Type - FLIPEFFECT 68
; Exporting: TRIGGER(363:0) for FLIPEFFECT(68)
; <#> : Sound. (CD) Play <&>CD track in (E) way on channel1
; <&> : AUDIO\107
; (E) : Looped playback
; Values to add in script command: $2000, 68, $16B

So:
Let’s say the level has 107.wav on channel1 in loop mode as a background audio when Lara gets into the jeep. 098.wav would start at once but the condition in GlobalTrigger#1 is true, because the item that Lara’s just “holding” is the jeep. That’s why TriggerGroup#1 starts, starting again 107.wav, not letting 098.wav start.
See the third 1 in GlobalTrigger#1: if Lara doesn’t “hold” the jeep, the situation also starts 107.wav. – It means if Lara has just got off the jeep then 110.wav won’t start, but 107.wav will.

Notes:

1. In fact, the GlobalTrigger can’t prevent 098.wav or 110.wav from starting, but stops them at once:

- When Lara’s just got into the jeep, 098.wav starts but stops at once, because of GlobalTrigger#1. And, if the GlobalTrigger starts 107.wav now, it starts it from its beginning, so it won’t start it from the point where the start of 098.wav interrupted that.
- When Lara’s just got off the jeep, 110.wav starts but stops at once, because of GlobalTrigger#1. And, if the GlobalTrigger starts 107.wav now, it starts it from its beginning, so it won’t start it from the point where the start of 110.wav interrupted that.

2. Whether you use your own audio files in ID 098/110 audio slots or the original ones, it’s advisable to use the files in those slots that start with low volume.
I say that because when 098 and 110.wav is playing for a very-very short moment (see just above), then it seems obvious for the player that the setup is not perfect, if the WAVs are loud. I.e. you’ll hear the loud 098 and 110.wav for a short moment. But if they have low volume at their starts, then I’m sure you won’t notice they have been started for a moment.

3. “If Lara doesn’t hold the jeep” is also true when Lara’s just doing anything in the level that has nothing to do with the jeep. But, because the background audio is just 107.wav, and the game doesn’t want to start 110.wav automatically in those cases, then GlobalTrigger#1 has not any task.
But you have problems with that, if you want to use more than one background audio on channel1 in the level. Because, if you want to change your background audio, for example, into 111.wav, then GlobalTrigger#1 won’t let you do that, starting 107.wav again and again, because “Lara’s just not holding the jeep”.
To prevent that, you have to make the setup more complicated a bit:

GlobalTrigger= 1, IGNORE, GT_LARA_HOLDS_ITEM, HOLD_JEEP, IGNORE, 1, 1
GlobalTrigger= 2, FGT_DISABLED, GT_LARA_HOLDS_ITEM, HOLD_JEEP, IGNORE, 2, 2
TriggerGroup= 1, $2000, 68, $16B
TriggerGroup= 2, $2000, 68, $16F

; Set Trigger Type - FLIPEFFECT 68
; Exporting: TRIGGER(367:0) for FLIPEFFECT(68)
; <#> : Sound. (CD) Play <&>CD track in (E) way on channel1
; <&> : AUDIO\111
; (E) : Looped playback
; Values to add in script command: $2000, 68, $16F



So:
When the level starts, GlobalTrigger#2 is disabled (see: FGT_DISABLED flag), that’s why the game won’t try to start 111.wav.
Lara gets into the jeep to get from the left part of the room to the right part of the room.
She drives over “A” FLIPEFFECTs. Nothing will happen, because GlobalTrigger#2 is just disabled, GlobalTrigger#1 is just enabled and ID 107 audio is just playing.
Then Lara drives over “B” FLIPEFFECTs. ID 111 audio will start instead of ID 107. And GlobalTrigger#1 won’t prevent that, because one of the FLIPEFFECTs disables that GlobalTrigger.
When Lara gets off the jeep in the right part of the room then not 107 or 110.wav but 111.wav will play, thanks to GlobalTrigger#2 that has been activated by one of the “B” FLIPEFFECTs.
And when Lara gets back into the jeep there, then not 107 or 098.wav but 111.wav will play, thanks again to GlobalTrigger#2.

After that, you can figure out easily what will happen if Lara drives back from the right part of the room to the left part.

4. Modify the setup if that’s not exactly what you want. For example, if you want to start a single audio on channel2 when Lara gets into the jeep.
Here’s an example:

GlobalTrigger= 1, IGNORE, GT_LARA_HOLDS_ITEM, HOLD_JEEP, IGNORE, 1, 2
TriggerGroup= 1, $2000+TGROUP_SINGLE_SHOT, 68, $16B, $2000, 129, $2
TriggerGroup= 2, $2000, 68, $16B, $2000, 345, $1

; Set Trigger Type - FLIPEFFECT 129
; Exporting: TRIGGER(2:0) for FLIPEFFECT(129)
; <#> : Sound. (CD) Play <&>CD track in (E) way on channel2
; <&> : AUDIO\002
; (E) : Single playback
; Values to add in script command: $2000, 129, $2

; Set Trigger Type - FLIPEFFECT 345
; Exporting: TRIGGER(1:0) for FLIPEFFECT(345)
; <#> : TriggerGroup. Enable newly the one-shot <&>TriggerGroup already performed
; <&> : TriggerGroup= 1
; (E) :
; Values to add in script command: $2000, 345, $1

So I want to start 107.wav in loop mode and 002.wav in single mode when Lara gets into the jeep (TriggerGroup#1) and I want to start only 107.wav in loop mode when she gets off (TriggerGroup#2).
TGROUP_SINGLE_SHOT is necessary or else 002.wav wants to get started in every moment when Lara is in the jeep.
$2000, 345, $1 trigger cancels the effect of that TGROUP_SINGLE_SHOT flag, so when Lara gets into the jeep next time, TriggerGroup#1 will be activated again.

5. After reading what I wrote above I think it’s not complicated to find out the setup in the cases of the boats and other things.

6. This setup might contain some possible bugs. So, if the setup won’t work, then try this:

- Type IGNORE instead of FGT_DISABLED flag, and place a GlobalTrigger#2-disabling FLIPEFFECT trigger on the square of LARA object. (It's a bug of that flag.)
- Don’t let “A” FLIPEFFECT triggers be adjacent directly with “B” FLIPEFFECT triggers. I mean, leave at least one square space between them. (It's a bug of the missing space.)

(When I say “possible bugs” I mean those bugs are confirmed at some other cases of TRNG, but they are NOT confirmed now.
However, I can’t pronounce undoubtedly you won’t encounter those bugs now. – Fixed in TRNG 1.2.2.7.)


Made using TRNG 1.2.2.6
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 00:13.


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