View Single Post
Old 27-08-11, 07:45   #101
Raymond
Member
 
Joined: Nov 2007
Posts: 1,689
Default

Underwater puzzle use/key use/switch use:
With the trng-animation scripting underwater puzzle use, key use or switch use is possible.

I post the script for the puzzle use here:

Code:
Animation= 	58, KEY1_ACTION,IGNORE, FAN_PERFORM_TRIGGER_GROUP,ENV_MULT_CONDITION,12,IGNORE, -108
MultEnvCondition=12,ENV_ITEM_TEST_POSITION,4,IGNORE,ENV_CONDITION_TRIGGER_GROUP,60,IGNORE
TestPosition=	4,IGNORE,Puzzle_Hole3,-512,+512,-512-512,-512+512,108-512,108+512,-12000,12000,-12000,12000,-12000,12000

; Exporting: CONDITION(45:62) for PARAMETER(4)
; <#> : Global Byte Beta1
; <&> : Variables. The <#>Numeric Variable has the (E)Bit clear
; (E) : Bit  0  ($00000001 ; 1)
; Values to add in script command: $8000, 4, $2D

; Set Trigger Type - CONDITION 2
; Exporting: CONDITION(2:0) for PARAMETER(177)
; <#> : PUZZLE_ITEM3                    	Slot=177
; <&> : Inventory. Present <#>inventory_item.
; (E) : 
; Values to add in script command: $8000, 177, $2

Triggergroup= 	60,$8000, 4, $2D,$8000, 177, $2

; Set Trigger Type - FLIPEFFECT 306
; Exporting: TRIGGER(2:0) for FLIPEFFECT(306)
; <#> : Inventory-Item. Pop up inventory to select the <&>Item in (E)way
; <&> : PUZZLE_ITEM3                    	Slot=177
; (E) : Silent way
; Values to add in script command: $2000, 306, $2

; Set Trigger Type - FLIPEFFECT 234
; Exporting: TRIGGER(4:0) for FLIPEFFECT(234)
; <#> : Variables. Numeric. Set in <&>Variable the (E)bit
; <&> : Global Byte Beta1
; (E) : Bit  0  ($00000001 ; 1)
; Values to add in script command: $2000, 234, $4

Triggergroup=	58,$2000, 306, $2,$2000, 234, $4
The first part handles the pop up of the inventory, if Lara is in the right position (For this we use the TestPosition-command. The coordinate box is derived from the box, which is used for the uw-switch),is floating in the water (animation 108) and a certain bit in a variable is clear (this is a sign for the engine, that this puzzle wasn´t used yet). In the Animation-command we use the possibility to trigger a Tg instead of a animation with the help of the flag FAN_PERFORM_TRIGGER_GROUP.

Code:
Animation= 	59, IGNORE,IGNORE, FAN_ALIGN_TO_ENV_POS+FAN_PERFORM_TRIGGER_GROUP,ENV_MULT_CONDITION,13,IGNORE, -108
MultEnvCondition=13,ENV_ITEM_TEST_POSITION,4,IGNORE,ENV_CONDITION_TRIGGER_GROUP,56,IGNORE

; Exporting: CONDITION(44:62) for PARAMETER(4)
; <#> : Global Byte Beta1
; <&> : Variables. The <#>Numeric Variable has the (E)Bit set
; (E) : Bit  0  ($00000001 ; 1)
; Values to add in script command: $8000, 4, $2C

Triggergroup=	56,$8000, 4, $2C


; Exporting: TRIGGER(218:0) for FLIPEFFECT(80)
; <#> : Lara. (Animation) Force <&>Animation (256-512) of (E)slot for Lara
; <&> :  474 Animation
; (E) : SLOT_000 LARA
; Values to add in script command: $2000, 80, $DA

; Exporting: TRIGGER(5:0) for FLIPEFFECT(127)
; <#> : Organizer. Enable <&>Organizer
; <&> : Organizer=    5
; (E) : 
; Values to add in script command: $2000, 127, $5

Triggergroup=	59,$2000, 80, $DA,$2000, 127, $5
In the second part Lara is drawn to the ideal position, the insert-animation is triggered and a Organizer is triggered, which is used to delay all the triggers to the appropriate point. This delay can be achieved also by other methods like for instance exporting the triggers in a TG and exporting the execution of this TG as animcommand into the appropriate frame of the puzzle insert animation. Unfortunately I couldn´t supress Lara saying NO with the use of the puzzle item. Lara also wouldn´t say No, if she comes to the hole without a puzzle item. If Paolone expands the use of GT_USED_INVENTORY_ITEM on another animation than the standing animation, then you could create exactly the usual puzzle use routine.


Code:
Organizer=   5,FO_TICK_TIME,IGNORE,124,61

; Exporting: TRIGGER(5389:0) for ACTION(51)
; <#> : PUZZLE_HOLE3               ID:51     in sector:(3,2) of Room1
; <&> : Perform (E) flipeffect on <#>object
; (E) :  21: Hide object. Makes #ANIMATING invisible
; Values to add in script command: $5000, 51, $150D

; Exporting: TRIGGER(5645:0) for ACTION(49)
; <#> : PUZZLE_DONE3               ID:49     in sector:(3,2) of Room1
; <&> : Perform (E) flipeffect on <#>object
; (E) :  22: Show object. Makes #ANIMATING visible
; Values to add in script command: $5000, 49, $160D
; Exporting: TRIGGER(2:0) for FLIPEFFECT(49)
; <#> : Inventory-Item. Decrease (-1) number of <&>inventory-item in inventory
; <&> : PUZZLE_ITEM3                    	Slot=177
; (E) : 
; Values to add in script command: $2000, 49, $2
; Exporting: TRIGGER(43:0) for ACTION(26)
; <#> : FLAME_EMITTER              ID:26     in sector:(10,12) of Room0
; <&> : Trigger. (Moveable) Activate <#>Object with (E)Timer value
; (E) : Timer= +00
; Values to add in script command: $5000, 26, $2B
Triggergroup= 	61,$5000, 49, $160D,$5000, 51, $150D,$2000, 49, $2,$5000, 53, $2B
In the organizer you trigger all stuff, which has to be triggered: the puzzle done-object becomes visible, the puzzle item is removed from the inventory and finally the stuff you want to achieve is triggered, in this case a flame emitter.

The underwater key use follows exatly the same principles.
The underwater use of a push button is much easier. You only need one Animation-command to trigger Laras push button-animation and the Organizer (the second part above). In the Organizer you trigger the right animation for the push-button (should be usually animation 1) and the stuff you want to trigger.
Raymond is offline