Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tutorials and Resources

Closed Thread
Thread Tools
Old 12-08-10, 14:53   #1
Join Date: Nov 2007
Posts: 1,689
Default Raymondīs "features you could already have"-thread

In this thread I want to show some features, which are possible by effectively using the trng. I played around a lot with different things, but Iīm not up to build a complete level yet. I may do so, but I donīt want to hold back the features any more. So everybody is invited to use these features, if you are able to do so. As itīs the same like releasing objects I expect to be credited then.
I donīt give tuts here. You have to know the trng-basics already by studying, the NG_Center reference, Paolones tutorial projects, tuts here and on Skribblerz etc.

posted Features:
reusable puzzle item: post 4, page 1
horizontally moving platform: post 16, page 2
turnswitch: post 26, page 3 and also post 32-48 on pages 4/5 (especially post 45), see also 86-96, page 9/10
intelligent hints in game: post 53, page 6
animation commands: post 59, page 6
enemy HP-counter (similar to TREP-patch): post 60, page 6
Lara on retracting parallel bar: post 67, page 7
Using several switches in a certain order: page 10, post 98
Avoiding Magical Boboon death: page 10,post 99
underwater puzzle/key/switch: post 101, page 11
multiple Pressure Plates, which move down a half a click, as Lara steps on them and moves up again to the original position, if Lara leaves them: post 108, page 11
Object interaction via an inventory item: post 110, page 11

Last edited by Raymond; 08-10-11 at 13:27.
Raymond is offline  
Old 12-08-10, 15:09   #2
deskj's Avatar
Join Date: May 2005
Location: Sicily, Italy
Posts: 1,227

very nice and smart one, can't wait then
deskj is offline  
Old 12-08-10, 15:10   #3
Soul's Avatar
Join Date: Jan 2009
Location: Austria (NOT Australia!!!) Gender: Male
Posts: 6,653

Very nice idea, Raymond!
Soul is offline  
Old 12-08-10, 15:32   #4
Join Date: Nov 2007
Posts: 1,689

The reusable puzzle item

Letīs start with this. With the normal puzzle hole slot you can only insert a puzzle item and trigger things by it. But why you shouldnīt be able to take the puzzle item back and use again?
You wonīt be able to use the puzzlehole-slot to accomplish this, because the hardcoded stuff interferes with our idea. This also means, that you canīt use the usual trigger setup with the switch-trigger. So I place the puzzle hole/puzzle done-objects in "blank" animating mip-slots. Both objects area placed on the same square on the same place. The puzzle done-object is made invisible with the action trigger "Perform (E) flipeffect on <#>object; (E) : 21: Hide object. Makes #ANIMATING invisible" before Lara approaches the puzzle hole.
So what we have to do, so that Lara does the same stuff, as she would do on a normal puzzle hole: First on pressing action in front of it, the inventory pops up at the puzzle item, she aligns itself to an ideal position and the inserting animation is played? Then second at the appropriate frame all, what has to be triggered, is triggered: the puzzle-done object appears, the puzzle item is removed from the inventory, doors are opened or whatever else you want to trigger. You have to study especially Paolones animation tutorial project to understand all of this. The Animation-script command together with TestPosition-command is needed to accomplish the first part, and the use of an animcommand gives us the means to accomplish the triggering. There are always more than one solution to a problem, but this solution is relatively effective and works for sure.

And now the script entries. Iīll add later on more and more explanations!

;reusable puzzle item

;1.part: Inserting the Puzzleitem

Very important to understand the Animation-command above is, that I use the Fan-flag FAN_PERFORM_TRIGGER_GROUP. So the first argument 59 isnīt a number of an animation here, but itīs the number of a triggergroup (TG). This TG will be executed under the conditions given in the Animation command. First you have to press the Action-key. Some more conditions are given in the multiple environmental condition with the number 12 (see below). The last condition given by the last argument is, that Lara has stateID 2 (standing).
The Fan-flag FAN_ALIGN_TO_ENV_POS causes the alignment of Lara in front of the puzzle hole to an ideal position, in which she can execute the animation.

Triggergroup= 59,$2000, 306, $101,$2000, 77, $86;pop up inventory on puzzleitem2, perform animation 134
This is the TG, which is exexcuted under the conditions given in the Animation-command. It causes the popup of the inventoy at the puzzle item and the execution of the animation.

Used triggers:
Inventory-Item. Pop up inventory to select the <&>Item in (E)way
; <&> : PUZZLE_ITEM2 Slot=176
; (E) : If item si missing play LARA_SAY_NO sound

Lara. (Animation) Force <&>Animation (0-255) of (E)slot for Lara
; <&> : 134 Animation
; (E) : SLOT_000 LARA

This is the multiple environmental condition used in the Animation-command. It consist of three part: first, that Lara is in a position given by TestPosition-command 4 (see below), second that she has free hands and third that she fulfills some more conditions, stored in the Condition-TG 60.

TestPosition= 4, IGNORE, Animating8_Mip,-300,+300,-100,+100,200-200,200+200,-$1000,$1000,-$1000,$1000,-$1000,$1000
In this command the position of Lara relative to the puzzle hole in the Animating8_Mip-slot is defined. It conatains three room-coordinates and three facing-coordinates. Basically it defines a box of possible positions in the room, fromwhere lara is aligned to the ideal position and then the animation (or here the TG 59) is then executed. The given coordinates can be used for every puzzle hole-situation.

Triggergroup= 60,$8000, 0, $2D,$8000, 176, $2; GBA1 bit0 clear?,puzzleitem2 present?
In this condition-TG there are two conditions stored, which are used in the MultEnvCondition 12 above. In the first condition it checks, if in variable GlobalByteAlpha1 the bit0 is clear. This is a sign for the engine, that the puzzle hole is currently unused. In the second condition is checks, if the Puzzle Item2 is present in the inventory.

Used triggers:
Global Byte Alfa1
; <&> : Variables. The <#>Numeric Variable has the (E)Bit clear

; (E) : Bit 0 ($00000001 ; 1)
; <&> : Inventory. Present <#>inventory_item.

Triggergroup= 62,$9000, 117, $236,$5000, 116, $160D,$5000, 117, $150D,$2000, 234, $0,$2000, 47, $1, ....
; TG 62 (exported Animcommandtrigger): animating8mip 117 closer then 2 clicks?,116 visible, 117 invisible,set gba1 bit 0, remove puzzleitem2 from inventory...- add the exported triggers for the stuff you want to trigger

The execution of TG 62 is exported as an animcommand to frame 76 of animation 134:
Add a SetPosition anim command with following values:

Set Position [-24500] [118] [62]

Infos about exported trigger
Exporting: TRIGGER(62:0) for FLIPEFFECT(118)
<#> : TriggerGroup. Perform <&>TriggerGroup from script.dat in (E)way
<&> : TriggerGroup= 62
(E) : Mutiple performing (to use when in TriggerGroup there is some condition)

AnimCommand: Frame=76
You go then to wadmerger, open animation 134 of Lara in the AnimationEditor in insert the Animcommand Set Position [-24500] [118] [62] to this animation of Lara, which is the puzzle-insert-animation.

The TG 62 contains the following triggers:
The first one is a condition which checks for the distance of Lara relative to the puzzle hole. So we are sure, that the triggers are only executed in front of this puzzle hole and not at other times, if Lara executes the animation.
Lara. Distance. Lara is distant by <#>Moveable less or even than (E)Clicks
; (E) : Value= 2

The next to triggers make the puzzle hole invisible and the puzzle done visible.
Perform (E) flipeffect on <#>object
; (E) : 21: Hide object. Makes #ANIMATING invisible

Perform (E) flipeffect on <#>object
; (E) : 22: Show object. Makes #ANIMATING visible

Then we have the flipeffect Variables. Numeric. Set in <&>Variable the (E)bit; <&> : Global Byte Alfa1; (E) : Bit 0 ($00000001 ; 1). This bit is set to give the engine a sign, that the puzzle hole is currently used.

We have to remove the puzzle item from the inventory, too:
Inventory-Item. Remove <&>inventory-item from inventory
; <&> : PUZZLE_ITEM2 Slot=176

Finally you would add your exported triggers for the things, which you want to achieve by all the action, like opening doors etc..

;2.part: Getting back the puzzle item


This time the animation command trigges animation 469, the puzzle item take away-animation. I only mirrored animation 134 to create this one. It works good enough.


In this case we use three environmental conditions, which are stored in this MultEnvCondition-command as conditions, inder which animations 469 should be executed. Again we have another condition-TG 58, which contains the condition, if the bit in GlobalByteAlpha1 is set as a sign, that the puzzle item is inserted and can be taken out (see also below). As second condition we have again the TestPosition. Itīs the same as above for the inserting of the puzzle item, of course. As third condition Lara mus have free hands.

Triggergroup= 58,$8000, 0, $2C; gba1 bit0 set?

see above

Triggergroup= 61,$9000, 117, $236,$2000, 48, $101,$5000, 116, $150D,$5000, 117, $160D,$2000, 235, $0, ...
; TG 61 (exported Animcommandtrigger): animating8mip 117 closer then 2 clicks?, Add puzzleitem2 to inventory,116 invisible, 117 visible,clear gba1 bit 0,...- add the exported trigger, if you want to trigger something

The execution of this TG is exorted as animcommand (Set Position -24552,118,61) into animation 469, frame 32.
In this TG we have triggers to add puzzle item2 to the inventory again, making puzzle done invisble and puzzle hole visible, clearing bit 0 in the variable GlobalByteAlpha1 as a sign for the engine, that we have a free puzzle hole again and then you should add your triggers for what you want to achieve like closing the door again or whatever else.

Last edited by Raymond; 12-08-10 at 19:26.
Raymond is offline  
Old 12-08-10, 16:23   #5
Titak's Avatar
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 32,824

Great idea Raymond!
If it walks like a duck and if it quacks like a duck, it is a duck.
Titak is offline  
Old 12-08-10, 16:27   #6
Relic Hunter
-Roli-'s Avatar
Join Date: Jul 2007
Posts: 5,486

Thank you for this thread, Raymond
-Roli- is offline  
Old 12-08-10, 19:28   #7
Join Date: Nov 2007
Posts: 1,689

The posting for the reusable puzzle item should be finished!
Raymond is offline  
Old 12-08-10, 19:32   #8
mudkip25's Avatar
Join Date: Apr 2009
Location: Salem, Oregon
Posts: 3,766

Thanks Raymond! Gonna watch this thread now!
If it walks like a quack and if it ducks like a quack, it is a quack.
mudkip25 is offline  
Old 12-08-10, 21:27   #9
Level NextGen
Level NextGen's Avatar
Join Date: Mar 2009
Location: France, Paris
Posts: 1,476

Oh thank you Raymond!
I'm planning to use a puzzle like that and I tried some things with NGLE but I didn't search to much (thinking of makin' it latter )... but you did it. For sure I'll credit you (because you avoid me some headache ).
Btw, I though about some condition triggers with global triggers associated to flipmaps and so on : a real mess ! I'm not good at scripting
"You nailed it!"
Level NextGen is offline  
Old 13-08-10, 00:23   #10
Richard_trle's Avatar
Join Date: Aug 2003
Location: Brazil
Posts: 546

Great Idea Raymond this is very useful, pretty much like the TREP flipcodes

I'm planning on using such a puzzle system, however I'd like to ask if someone knows how to make Lara's scream mesh works through script since I've done everything, but the model does not support the scream object.
Richard_trle is online now  
Closed Thread

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 14:29.

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