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, 07:59   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default TRNG - Pickups - Advanced

Made using TRNG 1.2.2.6

Download a project file illustrating this tutorial

When you want Lara to pick up an item then you place the item in one of the ways below:


- directly on the ground - Lara is standing/crouching on the ground or floating in deep water, and reaching for the item.
- on a pedestal - Lara is standing on the ground, and reaching for the item.
- tightly against a wall – Lara is standing on the ground, and getting the item using crowbar.
- into a hole in a wall - Lara is standing on the ground, and reaching into the hole for the item.

See more about those methods in this tutorial on TRF: Pickups - the Basics.

But there are other specific places where you can place an item so that Lara will pick it up from them:

a, sarcophagus
b, box
c, drawer
d, cupboard
e, shelves

None of these specific methods requires special OCB-numbers

Last edited by AkyV; 13-08-15 at 08:18.
AkyV is offline  
Old 13-08-15, 08:01   #2
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default

Sarcophagus

The method of the sarcophagus is the only one of methods from a to e that you encounter in the original TR4 game and Level Editor.

See this example in cleopal.prj Room111:

Lara goes to the sarcophagus. The player hits CTRL thereupon the sarcophagus-using animation (439) starts: Lara pushes the lid of the sarcophagus, leans in the sarcophagus and takes a small medipack out of it:






The setup is easy:

Place the items Lara will get from the sarcophagus, on a square. Then place the sarcophagus (it’s FURNITURE5 in cleopal.prj) on the same square to cover the pickable items. After that, place the sarcophagus lid (you can find this object as SARCOPHAGUS) on the sarcophagus. – Be aware: that side of the lid will be pushed by Lara where you can see the two black patches.

(You can open each sarcophagus only once, because the opened lid remains open “forever”. – And be careful: Lara puts something into her backpack at the end of her animation. So, if you want to use non-empty and/or empty sarcophagi on a level then you must re-edit the animation to make it useable for the empty ones as well.

For example, do that re-edition with a move - replacing the “putting into the backpack” part by that - that seems ambiguous: “Has Lara put anything into her backpack or has she just been scratching?”

Or you activate some special camera just in time so the player won’t see the backpack part of the animation when the sarcophagus is empty.)
AkyV is offline  
Old 13-08-15, 08:03   #3
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default

Box

B, c, d and e methods are all from TR5. So, if you want to use them in TRNG then you must make them compatible with TRNG.

The compatibility-adjusting operation is easy: put the container object into SARCOPHAGUS slot, then replace the sarcophagus-using animation by the animation that’s for using that container, in #439 animation slot of LARA object.

For example, if you want Lara to pick up the item from a box, then put a proper box object into SARCOPHAGUS slot, then replace Lara’s sarcophagus-using animation by her box-using animation, in #439 animation slot.

Attention!
Check it: every special animation of Lara that this tutorial cares about must always have Animation11 as Next Animation.

You can find “a proper box” for example in the WAD of TR5 Level “Escape with the Iris”. – After you’ve copied it into your WAD, don’t forget to adjust its own animation to work properly in TRNG:

a, The animation be must be in Animation#0 slot. If it’s not, then copy it there.
b, Check the values: StateID/Next Animation/Speed/Accel=0, Next Frame=the last frame of this animation.
c, State Change Editor must be empty.
d, Check AnimCommands: only the required sound commands could be placed there. “Die” and other special commands must be deleted.

Lara’s box-using TR5 animation is Animation472. – But you don’t need to do the “usual replacing” by Animation Editor of WADMerger. (However, you can find the animation in the above-mentioned TR5 WAD, for example.)
Instead of that, open Switch Manager of WADMerger. See the small SACROPHAGUS (!) window there. Choose “Suitcase” entry then click on “Save” to close the panel of Switch Manager. – Now you can see: the box-using animation has been put into Lara’s Animation439 slot of your WAD.

Every time when you open WADMerger, the values of Switch Manager will be goes back into their default states.

So, if you open WADMerger, and then open Switch Manager to adjust something else there, then you also adjust “Suitcase” again there everyway or else the box won’t work properly if you close the Switch Manager with clicking on Save.

So the box is in your WAD, with its and Lara’s proper animations. Save the WAD and refresh it in your project.

The setup is easy:

Place the items Lara will get from the box, on a square. Then place the box (SARCOPHAGUS) on the same square to cover the pickable items.

And that will happen in the game:

Lara goes to the box. The player hits CTRL thereupon the box-using animation (439) starts: Lara kneels to the box, opens it, takes the item(s) out of it, then closes the box and stands up.

(You can open/close each box only once. - And be careful: Lara puts something into her backpack at the end of her animation. So, if you want to use non-empty and/or empty boxes on a level then you must re-edit the animation to make it useable for the empty ones as well.)



AkyV is offline  
Old 13-08-15, 08:06   #4
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default

Drawer

So you need a proper object in SARCOPHAGUS slot. This object is a drawer now – you can find one for example in the WAD of TR5 Level “The Submarine”. (You also have to find here a chest for the drawer. Place it into your WAD as well.) – Don’t forget to adjust Animation0 of the drawer, the same way as you would do with the animation of the box above.

Lara’s drawer-using TR5 animation is Animation465. Open Switch Manager of WADMerger. See the small SACROPHAGUS window there. Choose “Cupboard drawer” entry then click on “Save” to close the panel of Switch Manager. – Now you can see: the drawer-using animation has been put into Lara’s Animation439 slot of your WAD.

So the drawer is in your WAD, with the chest and its and Lara’s proper animations. (In “The Submarine” the chest is a Moveable so you had to put it into an – any – ANIMATING slot of your WAD. In other source WADs the chest could be a Static, so you should put it into a – any – non-shatter Static slot of your WAD.)
Save the WAD and refresh it in your project.

The setup seems easy:

Place the items Lara will get from the drawer, on a square. Then place the chest on the same square. After that, place the drawer (SARCOPHAGUS) “into the chest”.

But you’ll discover a problem: the chest is thin so it won’t cover the pickable items on the middle of the square. And, if Lara goes to the drawer, then she’ll reach down for the items to pick them up directly, and won’t pull the drawer out.
That’s why you make these pickable items invisible in their OCB panel.

But the setup still won’t work: if Lara goes to the drawer, she won’t pull it out.
The problem is preventable if Lara steps back now one step and the player uses CTRL after that.

But it’s nonsense: requiring the stepping-back of the player so that the pulling-out will work properly?

To really prevent the problem, adjust the collision box of the chest (using Fexanim for the ANIMATING chest or StrPix for the Static chest) to make (increase) its length half-square (512 units) sized (approximately).

-In this case, Lara can’t step to the chest because its collision box will prevent her from doing this. But now Lara will be able to pull out the drawer when she’s been just stopped by the collision. She takes the item(s) out of the drawer, then pushes it back. (You can push out/pull back each drawer only once.

- But this time you don’t need to be careful: Lara doesn’t put anything into her backpack at the end of her animation. So, this animation is usable for both non-empty and empty drawers.) No, it still isn’t okay – the gap between Lara and the chest is too big. It’s ugly – it seems as if Lara were rummaging not the drawer but the air before the drawer.

- Of course, if you’re not using a special camera then the chance only is little that the player will notice that small bug:






Maybe you think it’s a good prevention for the problem if you choose new coordinates for the chest and the SARCOPHAGUS drawer on that square (for example, by “Move. Move … <#>animating for (E)units (one sector = 1024)” ACTION triggers). Forget it. It’s just a time-wasting.

Okay, I tell: the real reason for the problem must be (I think, at least...) that the drawer doesn’t have the proper pivot to be a proper SARCOPHAGUS object. Because – as opposed to the drawer – the efficient sarcophagus lid/box has its pivot in the middle of the object:






So, if you want, then edit (or get) a drawer having a proper pivot. (Or you can search special solutions, for example, on TRSearch.) – That’s not what I did.
Instead of that I decided I would search for a new solution.
And why is it worth forcing a new method? Just think about it: for example, you can use a box AND (!) a drawer in the same level – the box will be used as SARCOPHAGUS and the drawer will be used by the new method. (If you force SARCOPHAGUS method for the drawer then you can’t use the box as SARCOPHAGUS. But you can use the box by the new method…)

So, this is the new method for the drawer:

- Put the drawer-using TR5 Lara animation (465) into a new animation slot of your WAD (for example, Animation480). (Maybe after you’ve put it into Animation439 slot by Switch Manager. - However, you can find the animation in the above-mentioned TR5 WAD, for example.)

- Put the Moveable chest into an – any – ANIMATING slot of your WAD (for example, ANIMATING1) or the Static chest into a – any – non-shatter Static slot of your WAD (for example, PLANT0).

- Put the drawer itself into an – any – ANIMATING slot (for example, ANIMATING2). (Adjusted its Animation0 as if it were in SARCOPHAGUS slot. – Except: this time the Next Frame must be 0!)

- Place the chest and the drawer on a square – but don’t place any pickable item there!

- Don’t change any default collision now.

- Use the proper commands in Script. – See this example for them (let’s call it Setup X):

Animation= 480, KEY1_ACTION, IGNORE, IGNORE, ENV_MULT_CONDITION, 1, IGNORE, -103
MultEnvCondition= 1, ENV_ITEM_TEST_POSITION, 1, IGNORE, ENV_FREE_HANDS, IGNORE, IGNORE
TestPosition= 1, IGNORE, ANIMATING2, -100, 100, -100, 100, -100, 100, -1000, 1000, -200, 200, -200, 200
GlobalTrigger= 1, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 1, 2, IGNORE
GlobalTrigger= 2, IGNORE, GT_CONDITION_GROUP, IGNORE, 1, 5, 6
TriggerGroup= 1, $8000, 480, $1E
TriggerGroup= 2, $2000, 127, $1
TriggerGroup= 3, $5000, 65, $2B
TriggerGroup= 4, $2000+TGROUP_SINGLE_SHOT, 48, $15F, $2000, 48, $110
TriggerGroup= 5, $2000, 51, $0
TriggerGroup= 6, $2000, 52, $0
Organizer= 1, IGNORE, IGNORE, 0, 3, 3, 4

(See more about these Script commands in NG Center\Reference.)

These things will happen in the game with Setup X:

Lara goes to the drawer. The player hits CTRL thereupon the drawer-using animation (480) starts: Lara pulls out the drawer, takes the item(s) out of it, then pushes it back. (You can push out/pull back each drawer ANY TIME YOU WANT, again and again! – even if Lara has taken the items out or if the drawer was empty in the first place.)

Why? Well, let’s see the operation step by step:

1. All the conditions – defined in Animation=480 command - must be true so that that (the drawer-using) animation will start:

a, The player must hit CTRL. (See: KEY1_ACTION – the constant for CTRL.)

b, Lara must be standing and still. (See: -103 – i.e. Animation103, the “standing still” animation.)

c, All the conditions in MultEnvCondition=1 command must be true. (See: ENV_MULT_CONDITION, 1.)

These are the conditions in MultEnvCondition=1 command:

a, Lara is in a given position – defined in TestPosition=1 command -, compared to the drawer. (See: ENV_ITEM_TEST_POSITION, 1.)

b, Lara’s hands are empty. (See: ENV_FREE_HANDS.) – This is the way to prevent Lara from pulling out the drawer with a weapon or something else (except a flare) in her hands. (The animation is obviously ugly without empty hands.)

(By the way, if she’s pulling the drawer out with a flare in her hand then maybe it disturbs the flare-using operation, a bit later, once. – I.e., for example, Lara raises her left, empty hand as if there were a flare in it. It’s easy to fix it if you draw a weapon after that.)

TestPosition=1 command defines a position where Lara is very close to the drawer and – more or less – facing exactly that.

2. So the conditions for Lara are true and the player has just hit CTRL, causing the start of Animation480. – In this case the condition (in TriggerGroup#1) for GlobalTrigger#1 is true:

; Set Trigger Type - CONDITION 30
; Exporting: CONDITION(30:0) for PARAMETER(480)
; <#> : Animation= 480
; <&> : Lara. (Animation) Lara is performing <#>animation
; (E) :
; Values to add in script command: $8000, 480, $1E

3. If the condition of GlobalTrigger#1 is true it means TriggerGroup#2 will happen, starting Organizer#1:

; 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

4. Organizer#1 works this way:

a, it starts TriggerGroup#3 at once (see: 0, 3),
b, and, after 3 seconds it starts TriggerGroup#4 (see: 3, 4).

5. So TriggerGroup#3 starts just when Animation#480 starts.
In TriggerGroup#3 you can find this trigger:

; Set Trigger Type - ACTION 43
; Exporting: TRIGGER(43:0) for ACTION(65)
; <#> : ANIMATING2 ID 65
; <&> : Trigger. (Moveable) Activate <#>Object with (E)Timer value
; (E) : Timer= +00
; Values to add in script command: $5000, 65, $2B

It means the animation (the “pulling-pushing”) of ANIMATING2 (the drawer) starts just when Lara’s drawer-pulling/pushing animation starts.

6. So 3 seconds after the pulling has started TriggerGroup#4 will be executed, with these triggers in it:

; Set Trigger Type - FLIPEFFECT 48
; Exporting: TRIGGER(351:0) for FLIPEFFECT(48)
; <#> : Inventory-Item. Increase (+1) in (E)way the number of <&>inventory-item in inventory
; <&> : UZI_AMMO_ITEM Slot=352
; (E) : Show animation of item (like it was picked up)
; Values to add in script command: $2000, 48, $15F

; Set Trigger Type - FLIPEFFECT 48
; Exporting: TRIGGER(272:0) for FLIPEFFECT(48)
; <#> : Inventory-Item. Increase (+1) in (E)way the number of <&>inventory-item in inventory
; <&> : PUZZLE_ITEM3_COMBO1 Slot=191
; (E) : Show animation of item (like it was picked up)
; Values to add in script command: $2000, 48, $110

In the third second of Animation480 Lara’s just rummaging the drawer. It means a clip of Uzi ammo and (after that) a PUZZLE_ITEM3_COMBO1 will be added to inventory when Lara s just rummaging the drawer “to find something”.

When a pickable item “has just been found in the drawer” (it happens in the third second now, as you see), you’ll see the item for some moments in the lower right corner of the screen, indicating: “I’m just rummaging this drawer and look what I’ve found!”





7. Maybe the player forgets (s)he’s opened that drawer before so (s)he opens it again (and again) sooner or later.

(S)he’s able to do that because of these things:

First of all, the Next Frame value for the Animation0 of the drawer is 0 now. – But what is it supposed to mean?

Well, it means if the pulling-pushing animation of the drawer has just ended then it won’t stop: the drawer will be pulled out then pushed back again and again, in loop mode.

So it’s doing that continuously even when Lara’s not doing pulling animation. Of course, it’s not good for us. But don’t worry: we’ll use some tools to regulate that uncontrolled move.

I mean, first of all, you need to export a trigger as an AnimCommand into the last frame of Animation0 of the drawer. (Because of technical reasons it’s the frame just before the last one, actually.) This trigger is to stop the actual animation (of course, it’s Animation0) of the drawer just when that has just been ended exactly:

; Set Trigger Type - ACTION 44
; Exporting: TRIGGER(44:0) for ACTION(65)
; <#> : ANIMATING2 ID 65
; <&> : Trigger. (Moveable) Untrigger <#>Object with (E)Timer value
; (E) : Timer= +00
; Values to add in script command: $5000, 65, $2C

(When exporting, click on “No” on “What object” pop-up panel.)

As Animation0 of the drawer and Lara’s Animation480 have the same length (see the amount of frames) it means Animation0 will be stopped in the proper moment: just when Lara’s animation has ended.

And, if Lara starts pulling out that drawer again, she starts the animation of the drawer again - from its first frame exactly -, activating TriggerGroup#3 again.

Notes for the new method:

1. You need a FGT_SINGLE_SHOT_RESUMED flag for Animation=480 command, or else the 3 second counter will start only if the Animation480 has just been ended.
(Not FGT_SINGLE_SHOT flag! If you use that then the drawer won’t be being pulled again when Lara’s performing Animation480 again at that drawer.)

2. TGROUP_SINGLE_SHOT constant in TriggerGroup#4 is necessary or else Lara would get the pickable items at every pull of the drawer again and again.

3. The condition in GlobalTrigger#2 is "when Lara’s performing Animation#480". It means the GlobalTrigger disables all the key commands (see TriggerGroup#5: $2000, 51, $0) when Lara’s pulling/pushing a drawer, then enables them again (see TriggerGroup#6: $2000, 52, $0), if she’s just pushed the drawer back.

; Set Trigger Type - FLIPEFFECT 51
; Exporting: TRIGGER(0:0) for FLIPEFFECT(51)
; <#> : Keyboard. Disable <&>keyboard command for (E) time
; <&> : All keyboard commands
; (E) : Forever (use other action/effect to disable it)
; Values to add in script command: $2000, 51, $0

; Set Trigger Type - FLIPEFFECT 52
; Exporting: TRIGGER(0:0) for FLIPEFFECT(52)
; <#> : Keyboard. Enable newly <&>keyboard command
; <&> : All keyboard commands
; (E) :
; Values to add in script command: $2000, 52, $0

Why? Because, in spite of ENV_FREE_HANDS constant, the player could hit SPACE to draw a weapon and CTRL to shoot with it, while Lara’s performing that animation, if you don’t use that GlobalTrigger.
(Feel free to make the GlobalTrigger more precise, so that it will work only on SPACE and CTRL, if you want. – Practically, it doesn’t necessary, I think. You don’t need to do that, except if you want something special during Animation480 – for example, to abort a special camera view by hitting the Look key.)

4. If you want the drawer to be empty at the first pull then form Setup X this way:

a, You don’t need TriggerGroup#3, #4 and Organizer#1.
b, Write the same thing to TriggerGroup#2 (instead of $2000, 127, $1) what you should write to TriggerGroup#3 ($5000, 65, $2B).

5. Maybe you want to use more drawers – used by the new method – in your level. Taking the example where there are two non-empty drawers (both ANIMATING2) in the level, do all these things, forming Setup X.

a, Not GlobalTrigger#1, but another GlobalTrigger (#3) will work for the other drawer (or else, the items she should find in the first drawer could go to her when Lara’s rummaging the second drawer first, and vice versa.). It means you have to use “GlobalTriggers. <&>Enable/Disable the (E)GlobalTrigger” FLIPEFFECT triggers to locate the area where a Globaltrigger of a drawer works, and each drawer must be in the area where its GlobalTrigger is enabled. – Those areas are not allowed to be overlapped with each other!
(GlobalTrigger#2 of the weapons mustn’t be located, it’s a general GlobalTrigger.)

b, GlobalTrigger#3 will also use TriggerGroup#1 as a condition but use TriggerGroup#7 as the executable trigger. In TriggerGroup#7 you will place a trigger that enables Organizer#2:

GlobalTrigger= 3, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 1, 7, IGNORE
TriggerGroup= 7, $2000, 127, $2

c, Attach “TGROUP_USE_FOUND_ITEM_INDEX” to the trigger of TriggerGroup#3. It means $5000, 65, $2B trigger will start both the first drawer (when Lara’s standing in front of that drawer) and the second drawer (when Lara’s standing in front of that drawer):

TriggerGroup= 3, $5000+TGROUP_USE_FOUND_ITEM_INDEX, 65, $2B

(The condition that makes the object index of the second drawer to become “the found index” must be the TestPosition.)

d, Define the content of the second drawer with another “Inventory-Item. Increase (+1) in (E)way the number of <&>inventory-item in inventory” FLIPPEFFECT, in a new (#8) TriggerGroup – for example, a crossbow now:

TriggerGroup= 8, $2000+TGROUP_SINGLE_SHOT, 48, $163

e, Now you can define Organizer#2:

Organizer= 2, IGNORE, IGNORE, 0, 3, 3, 8

f, When you export an AnimCommand, and that is an ACTION trigger, then a panel will pop up (named “what object”), asking you to click on Yes or No. If you click on Yes, then the AnimCommand will work as if we had attached a TGROUP_USE_FOUND_ITEM_INDEX constant to that.
And now, we want Yes, because we want the stopping to work on not only the first drawer but also the second one.
So delete the formerly exported AnimCommand from Animation0 and export the trigger again, clicking on Yes this time.

(If all of your drawers are empty, then the setup in Note#4 is just perfect – except: TriggerGroup#3 must have a TGROUP_FOUND_ITEM_INDEX flag.
But, for example, what if the first drawer is non-empty but second one is empty? – In that case you must use Setup X, changing that this way:

First, copy GlobalTrigger#1, giving a new ID to that.
In that new GlobalTrigger:

- delete RESUMED flag, and
- replace the ID of TriggerGroup#2 by the ID of TriggerGroup#3.

But don’t forget:

- TriggerGroup#3 must have a TGROUP_FOUND_ITEM_INDEX flag.
- You have to use the proper GlobalTrigger areas for the two drawers.

The GlobalTrigger area of this empty drawer will work on all the empty drawers of ANIMATING2.
So you don’t need another setup if you use more empty drawers now.)

6. If the setup doesn’t work then check the TestPosition values:

a, because the TestPosition values in the example above just examples, and/or
b, because I experienced sometimes (because of the position of the pivot?) the XDistanceMin/Max and the ZDistanceMin/Max couples must be reversed with each other (so, if you detect X values in the game then type them in Z fields of TestPosition, and if you detect Z values in the game then type them in X fields of TestPosition), and/or
c, because the difference between X and Z values is (relatively) too big, and that maybe matters.

7. Maybe you want to use more drawers – used by the new method – in your level. Taking the example where there are three non-empty drawers (with different looks, two in ANIMATING2, one in, for example, ANIMATING3 slot) in the level, use Setup X modified in Note#5 – except these things:

You need its own TestPosition (for example, #2) for ANIMATING3.
It means you can’t use MultEnvCondition#1 for ANIMATING3, because you must define a MultEnvCondition#2 with TestPosition#2.
You need to create TriggerGroup#9. It contains two conditions: “either all the conditions in MultEnvCondition#1 are true (TestPosition#1+free hand: $8000, 1, $10), or all the conditions in MultEnvCondition#2 are true (TestPosition#2+free hand: $8000, 2, $10)”:

TriggerGroup= 9, $8000, 1, $10, $8000+TGROUP_OR, 2, $10

; Set Trigger Type - CONDITION 16
; Exporting: CONDITION(16:62) for PARAMETER(1)
; <#> : MultEnvCondition= 1
; <&> : Multiple condition of <#>MultEnvCondition script command in (E)way
; (E) : In AND way. (All ENV conditions have to be true)
; Values to add in script command: $8000, 1, $10

; Set Trigger Type - CONDITION 16
; Exporting: CONDITION(16:62) for PARAMETER(2)
; <#> : MultEnvCondition= 2
; <&> : Multiple condition of <#>MultEnvCondition script command in (E)way
; (E) : In AND way. (All ENV conditions have to be true)
; Values to add in script command: $8000, 2, $10

Then, you have to change Animation=480 command:

Animation= 480, KEY1_ACTION, IGNORE, IGNORE, ENV_CONDITION_TRIGGER_GROUP, 9, IGNORE, -103

So, we’ve deleted MultEnvCondition=2 condition from Animation=480. The new condition instead of that is if the conditions in TriggerGroup#9 are true. So Animation480 will start either if Lara’s standing in front of an ANIMATING2 drawer, with free hands, or if she’s standing in front of an ANIMATING3 drawer, with free hands.

And, lastly, use that “Yes type” AnimCommand at both ANIMATING drawers, not only ANIMATING2. (The operation is the same – i.e. stopping a Moveable object-, so if ANIMATING3 will use that AnimCommand of ANIMATING2, it doesn’t matter, because the object ID of ANIMATING3 will be the “found index” when Lara wants to open an ANIMATING3 drawer.
And the “Yes” is useful because of other reasons as well: i.e. don’t forget about the cases when you use more ANIMATING2 and/or ANIMATING3 drawers.)

AkyV is offline  
Old 13-08-15, 08:12   #5
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default

Cupboard

So you need a proper object in SARCOPHAGUS slot. This object is a cupboard now – you can find one for example in the WAD of TR5 Level “Escape with the Iris”. – Don’t forget adjust Animation0 of the cupboard, the same way as you would do with the animation of the box above.

Lara’s cupboard-using TR5 animation is Animation464. Open Switch Manager of WADMerger. See the small SACROPHAGUS window there. Choose “Cupboard big doors” entry then click on “Save” to close the panel of Switch Manager. – Now you can see: the cupboard-using animation has been put into Lara’s Animation439 slot of your WAD.

So the cupboard is in your WAD, with its and Lara’s proper animations.
Save the WAD and refresh it in your project.

The setup seems easy:

Place the items Lara will get from the cupboard, on a square. Then place the cupboard (SARCOPHAGUS) on the same square.

But now you can discover the same problems just as you do at the drawer: the items must be Invisible, Lara must take a step back, you must increase the collision box of the cupboard. – And all of this again because of the bad pivot. (This time Lara doesn’t put anything into her backpack at the end of her animation. So, this animation is usable for both non-empty and empty cupboards.)
So, what shall you do?

Well, I recommend you again a good pivot, this time for the cupboard, of course – or see that new method, customized for the cupboard this time:

- Put the cupboard-using TR5 Lara animation (464) into a new animation slot of your WAD (for example, Animation481). (Maybe after you’ve put it into Animation439 slot by Switch Manager. - However, you can find the animation in the above-mentioned TR5 WAD, for example.)

- Put the cupboard itself into an – any – ANIMATING slot (for example, ANIMATING4). (Adjusted its Animation0 as if it were in SARCOPHAGUS slot. – Except: this time the Next Frame must be 0!)

- Place the cupboard on a square – but don’t place any pickable item there!

- Don’t change any default collision now.

- Use the proper commands in Script. - See this example for them (it’s very similar to the script of a drawer, but there is some difference, as you’ll see):

Animation= 481, KEY1_ACTION, IGNORE, IGNORE, ENV_MULT_CONDITION, 3, IGNORE, -103
MultEnvCondition= 3, ENV_ITEM_TEST_POSITION, 3, IGNORE, ENV_FREE_HANDS, IGNORE, IGNORE
TestPosition= 3, IGNORE, ANIMATING4, -100, 100, -100, 100, -100, 100, -1000, 1000, -200, 200, -200, 200
GlobalTrigger= 4, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 10, 11, IGNORE
GlobalTrigger= 5, IGNORE, GT_CONDITION_GROUP, IGNORE, 10, 5, 6
GlobalTrigger= 6, IGNORE, GT_CONDITION_GROUP, IGNORE, 14, 15, IGNORE
TriggerGroup= 5, $2000, 51, $0
TriggerGroup= 6, $2000, 52, $0
TriggerGroup= 10, $8000, 481, $1E
TriggerGroup= 11, $2000, 127, $3
TriggerGroup= 12, $5000, 36, $2B
TriggerGroup= 13, $2000+TGROUP_SINGLE_SHOT, 48, $105
TriggerGroup= 14, $8000, 11, $1E
TriggerGroup= 15, $5000, 36, $2C
Organizer= 3, IGNORE, IGNORE, 0, 12, 7, 13


These things will happen in the game with the setup just above:
Lara goes to the cupboard. The player hits CTRL thereupon the cupboard-using animation (481) starts: Lara open the door wings of the cupboard, takes the item(s) out of it, then shuts the doors back. (You can open/shut each cupboard any times. – So even if Lara has taken the items out of that yet or if the cupboard was empty at the first use.)





I mean, Lara stands close to a cupboard (having object index 36 now), facing that, according to TestPosition#3. She’s still and doesn’t have anything (a flare, at most) in her hands. The player hits CTRL so that Animation481 of hers (“looking through the cupboard”) will start. Synchronized with that (see Organizer#3, started by TriggerGroup#11), Animation0 of the cupboard (“doors open then shut”) starts (see TriggerGroup#12), too. After seven seconds (see Organizer#3), when Lara’s just examining the shelves of the cupboard, she “finds” a PUZZLE_ITEM6 in the cupboard, thanks to TriggerGroup#13. (GlobalTrigger#5 uses TriggerGroup#5 and #6 to prevent Lara’s weapon-using during the picking-up animation, using TriggerGroup#10 – “when Lara’s performing Animation481” - as a condition.)

And now let me speak about that part of the setup that differs from the drawer:

It seems some exported AnimCommands – just as the one, for example, we wanted to use to stop the animation of the cupboard – don’t work well if you attached them to a frame having bigger ID than 255. While the cupboard animation is 312 frames length, and that’s why we want to use Frame#311 now.
That’s why we won’t export AnimCommand now, but put that (Animation0-stopping) trigger into TriggerGroup#15, and put the TriggerGroup into GlobalTrigger#6. And, if Lara’s just performing Animation11 (see TriggerGroup#14) then the GlobalTrigger activates TriggerGroup#15, stopping Animation0.
Why? Well, the animation that follows Animation481 is (see: Animation Editor of WADMerger) Animation11. So, if Lara has just ended Animation481 and started Animation11 then Animation0 of the cupboard will stop. – And, if Lara starts opening the cupboard doors again, she starts the animation of the cupboard again - from its beginning -, activating TriggerGroup#12 again.

But, read carefully: the animation of the cupboard won’t start from its first frame exactly but “only” from its beginning.

It’s because Animation0 stops JUST AFTER Animation481 has ended, i.e. when Animation11 is just being performed. That’s why the synchronization between Lara’s Animation481 and Animation0 of the cupboard isn’t perfect, there is one (?) frame slip. (No, ENV_ANIM_COMPLETE wouldn’t help: the result is the same. Moreover, the slip seems a bit bigger with that tool.)

But it’s only important when Lara opens and shuts the doors again and again, because much performance means “many times one”, i.e. many frames slip. – But why would she do that?

(Many frames slip means not only evident asynchronization between the animations but ugly stop as well, of course. For example, Animation0 will stop not at the end but in the middle: so you will see half-shut doors when Animation481 has just been ended.)

Notes for the new method:

1. Lara’s cupboard-using animation starts with her trying to open the drawer under the cupboard doors. She opens the doors only after that.

It’s a bit lame if she’s performing the animation again: she tries the drawer before opening the doors. But now she should know the drawer won’t open, right? – This little imperfection could be skipped easily with some imagination. For example, “Lara’s very self-willed that’s why she tries and tries again: she hopes the drawer will open sooner or later”.

It’s more interesting when she opens bigger cupboard doors, without a drawer.





Because Lara uses the same animation. It means her “trying the drawer” deed is “trying the lower part of the door” deed in this case. So it looks this way again and again: “she tries the lower part of the doors before she opens the doors at their middle parts successfully”.

Re-edit Lara’s animation if it bothers you.

2. Lara performs Animation11 in a lot of other cases, not only after Animation481. But it doesn’t matter now.

3. If you read the similar parts in the section of the drawer carefully then you should be able to adjust the similar setup for the cupboard in the cases below:

- empty cupboard
- more cupboards
- different cupboards

4. You can mix objects with new methods in your level. Practically, it means you can use both drawer and cupboard in your level with that method, if you want. (Naturally, that’s not the drawer of the cupboard that I’m talking about now.) – The two setups (drawer+cupboard) are compatible with each other, if you use them simultaneously, but consider these things:

- For example, if you use one drawer and one cupboard, then you don’t need FLIPEFFECT triggers to locate the areas of the GlobalTriggers, because both objects will use different Lara animations, i.e. the conditions of the GlobalTriggers are not the same.
So the areas can be overlapped now, if you want.
- You must use one GlobalTrigger to disable/enable weapon-using for both cases. So the condition of the GlobalTrigger is “when Lara’s performing Animation480 OR Animation481”:

$8000, 480, $1E, $8000+TGROUP_OR, 481, $1E

- You can’t use “found index” for stopping the objects if you use both AnimCommand (for the drawer) and TriggerGroup (for the cupboard). You have to choose:

a, You will use AnimCommand and TriggerGroup, but you use “found index” nowhere for the stops.

For example: you use one drawer from ANIMATING2 slot, two drawers from ANIMATING3 slot and two cupboards from ANIMATING4 slot. In this case you have to export an AnimCommand (with “No”) of that ANIMANTING2 drawer to the Animation0 of ANIMATING2, one AnimCommand (with “No”) of each ANIMATING3 drawer to the Animation0 of ANIMATING3, deleting the stopping AnimCommands with “Yes” from those animations.

Then – see TriggerGroup#12 above – you can’t use TGROUP_USE_FOUND_ITEM_INDEX constant for the two cupboards. – So, if you have those two cupboards with object ID 27 and 36, then you can’t use this:

$5000+TGROUP_USE_FOUND_ITEM_INDEX, 36, $2B

Instead of that, you have to give both stopping triggers:

$5000, 36, $2B, $5000, 27, $2B

b, You use the original version of TriggerGroup#12 (with one trigger and TGROUP_USE_FOUND_ITEM_INDEX), but you don’t use either “Yes” or “No” stopping AnimCommands at all.
It seems the easier version but in this case you will notice that slip problem at all the drawers.

Using TGROUP_USE_FOUND_ITEM_INDEX at the starter TriggerGroups (see #3, #12) couldn’t be problematic now.

5. Feel free to develop a method where you always stop the animation of the cupboard exactly at the last frame, using an Organizer, to fix the slip. – As Lara won’t open the same cupboard a million times, then I think this experiment would be only waste of your time.

AkyV is offline  
Old 13-08-15, 08:14   #6
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default

Shelves

In fact, there is no way to use shelves with SARCOPHAGUS method. (Naturally, that’s not the shelves of a cupboard that I’m talking about now.) I.e. we have to create a brand new method everyway if we want to use this TR5 feature in our levels:

- Put the shelf-using TR5 Lara animation (466, see, in the WAD of TR5 level “Streets of Rome”) into a new animation slot of your WAD (for example, Animation482).

- Put the shelf object (i.e. a rack of shelves, you can find one, for example, in the above-mentioned WAD) itself into an – any – ANIMATING slot (for example, ANIMATING5). – It doesn’t have any animation so you don’t have to adjust anything in that now.

- Place the rack on a square, then place the item(s) Lara will get from the shelves, “on a shelf”. (You can place and move the items – by Room Editor buttons - in such a way that they will appear in different shelves in the rack in the game, if you want.)





- Use the proper commands in Script. – It’s almost the same as the setup of the drawer or the cupboard. But this time the Organizer won’t start an animation for the shelves, so there isn’t TriggerGroup/AnimCommand to stop the shelf-animation either.

But now you can see something plus, about the pickable items. - See this example:

Animation= 482, KEY1_ACTION, IGNORE, IGNORE, ENV_MULT_CONDITION, 4, IGNORE, -103
MultEnvCondition= 4, ENV_ITEM_TEST_POSITION, 4, IGNORE, ENV_FREE_HANDS, IGNORE, IGNORE
TestPosition= 4, TPOS_FOUR_HORIENT, ANIMATING5, -100, 100, -100, 100, -650, -550, -1000, 1000, -200, 200, -200, 200
GlobalTrigger= 7, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 16, 17, IGNORE
GlobalTrigger= 8, IGNORE, GT_CONDITION_GROUP, IGNORE, 16, 5, 6
TriggerGroup= 5, $2000, 51, $0
TriggerGroup= 6, $2000, 52, $0
TriggerGroup= 16, $8000, 482, $1E
TriggerGroup= 17, $2000, 127, $4
Organizer= 4, IGNORE, IGNORE, 2, 18, 1, 19
TriggerGroup= 18, $5000+TGROUP_SINGLE_SHOT, 6, $150D, $2000, 48, $16D
TriggerGroup= 19, $5000+TGROUP_SINGLE_SHOT, 4, $150D, $2000, 48, $16B

These things will happen in the game with the setup just above:
Lara goes to the shelves. The player hits CTRL thereupon the shelf-using animation (482) starts: Lara looks through the shelves and takes the item(s) off them. (You can look through each rack any times. – So even if Lara has taken the items off that yet or if the rack was empty at the first use.)

I mean, Lara stands close to a rack of shelves, facing that, according to TestPosition#4. She’s still and doesn’t have anything (a flare, at most) in her hands. The player hits CTRL so that Animation482 of hers (“looking through the shelves”) will start. After two seconds (see Organizer#4), when Lara’s just examining the middle shelf, she finds a big medipack there, thanks to TriggerGroup#18. After newer one second (see Organizer#4), when Lara’s just examining the lower shelf, she finds a revolver there, thanks to TriggerGroup#19. – After that she also looks through the upper part.





But how will she get the items off the shelves?
Well, both TriggerGroup#18 and #19 contains one trigger to make the items in them invisible just when Lara’s looking through that shelf:

; Set Trigger Type - ACTION 13
; Exporting: TRIGGER(5389:0) for ACTION(6)
; <#> : BIGMEDI_ITEM ID 6
; <&> : Perform (E) flipeffect on <#>object
; (E) : 21: Hide object. Makes #ANIMATING invisible
; Values to add in script command: $5000, 6, $150D

; Set Trigger Type - ACTION 13
; Exporting: TRIGGER(5389:0) for ACTION(4)
; <#> : SIXSHOOTER_ITEM ID 4
; <&> : Perform (E) flipeffect on <#>object
; (E) : 21: Hide object. Makes #ANIMATING invisible
; Values to add in script command: $5000, 4, $150D

So, for example, when Lara’s looking through the lower shelf then the “One Shot” type TriggerGroup#19 will be activated. It means $5000, 4, $150D trigger makes the revolver invisible then $2000, 48, $16B trigger puts the revolver into the inventory – just as if Lara had been getting that off the shelf.

Notes:

1. There isn’t reaching into the backpack at the end of the animation.

2. The pickable item, after it’s become invisible, still has its collision, but it doesn’t matter now.

3. TPOS_FOUR_HORIENT makes possible that Lara can look through an equilateral (i.e. square-based) rack at all the sides, and not only at the side where the TestPosition is adjusted to. (It doesn’t work for non-equilateral racks. TPOS_DOUBLE_HORIENT – maybe because of the pivot? - either.)

4. The placed pickable item will appear in the middle of its square. You don’t need to accept it, use “Move. Move … <#>animating for (E)units (one sector = 1024)” ACTION triggers to move them to the required place. (So Lara will find it “in the corner of the shelf”, for example.)
Anyway, you have to use those ACTION triggers, for example, if you use a non-equilateral rack that is placed at the side of its square. – In the example just below Lara will get a normal shotgun ammo pack off a rack like that:





5. If you want Lara to see the item she’s just getting from the cupboard, then place the item in one of the cupboard shelves, and use a $5000, X, $150D trigger in TriggerGroup#13 (see above).
Or, if you don’t want Lara to see the item she’s just getting off the rack, then don’t place any item there, and don’t use $5000, X, $150D triggers in the setup of the rack.

6. Making the script for an empty rack is very easy – just delete some entries from the script above. That’s what remains now:

Animation= 482, KEY1_ACTION, IGNORE, IGNORE, ENV_MULT_CONDITION, 4, IGNORE, -103
MultEnvCondition= 4, ENV_ITEM_TEST_POSITION, 4, IGNORE, ENV_FREE_HANDS, IGNORE, IGNORE
TestPosition= 4, TPOS_FOUR_HORIENT, ANIMATING5, -100, 100, -100, 100, -650, -550, -1000, 1000, -200, 200, -200, 200
GlobalTrigger= 8, IGNORE, GT_CONDITION_GROUP, IGNORE, 16, 5, 6
TriggerGroup= 5, $2000, 51, $0
TriggerGroup= 6, $2000, 52, $0
TriggerGroup= 16, $8000, 482, $1E

So there are no GlobalTrigger areas if you use more empty racks. (GlobalTrigger#8 is not a GlobalTrigger of a rack, it’s a general GlobalTrigger for the weapons.) But if you use, for example, one empty and one non-empty rack then you must locate the area of the non-empty rack so that it won’t be overlapped with the area of the empty rack.

Seeing the script of the drawer, you should find out the script for more or different racks.
And the script of the cupboard will tell you about mixing the objects, if you want to use a rack, and a drawer/cupboard.

AkyV is offline  
Old 13-08-15, 08:15   #7
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default

Addition by Krystian:

Quote:
Hello AkyV!

I recently re-read your tutorial on advanced pickups.

I was tinkering with it, and came across an interesting idea, using a little variable magic.
I modified the script slightly...

Code:
Animation= 480, KEY1_ACTION, IGNORE, IGNORE, ENV_MULT_CONDITION, 1, IGNORE, -103
MultEnvCondition= 1, ENV_ITEM_TEST_POSITION, 1, IGNORE, ENV_FREE_HANDS, IGNORE, IGNORE
TestPosition= 1, IGNORE, ANIMATING2, -100, 100, -100, 100, -100, 100, -1000, 1000, -200, 200, -200, 200
GlobalTrigger= 1, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 1, 2, IGNORE
GlobalTrigger= 2, IGNORE, GT_CONDITION_GROUP, IGNORE, 1, 6, 7
TriggerGroup= 1, $8000, 480, $1E
TriggerGroup= 2, $2000, 127, $1
TriggerGroup= 3, $5000 + TGROUP_USE_FOUND_ITEM_INDEX, 65, $2B
TriggerGroup= 4, $5000 + TGROUP_USE_FOUND_ITEM_INDEX, 29, $36, $2000, 256, $1140, $8000, 64, $12B, $2000, 48, $16E, $8000 + TGROUP_ELSE, 64, $22B, $2000, 48, $16D, >
$8000 + TGROUP_ELSE, 64, $32B, $2000, 48, $161, $8000 + TGROUP_ELSE, 64, $42B, $2000, 48, $11C, $8000 + TGROUP_ELSE, 64, $52B, $2000, 48, $139
TriggerGroup= 5, $2000, 255, $11
TriggerGroup= 6, $2000, 51, $0
TriggerGroup= 7, $2000, 52, $0
Organizer= 1, IGNORE, IGNORE, 0, 3, 3, 4, 1, 5
What the changes do, is that you can set an OCB number for the drawer that corresponds to a specific pickup(s) - so you don't need to replicate the script, and use another slot with the same object to make an empty drawer (this effect is achieved with ocb 0) or one with a different pickup - one script works for all drawers.

What's even better, is that these same TG's (4 and 5) can be used for different objects too (cupboards, shelves, etc.) without needing to duplicate them for each of the scripts.
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 04:26.


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