Hanging Strength for Lara as TR6
by AkyV
Download a project file illustrating this tutorial

From TR1 to TR5, Lara always has endless strength when she is hanging. But in TR6, she will get tired if she's hanging too long. - There is a yellow strength bar just under her red life energy bar. It is decreasing continuously while Lara is hanging. When the bar reaches 0, Lara releases the 'handle' (ledge etc.) automatically, indicating she has got tired, her hanging strength has just run out.

In this tutorial I will show you how to use a similar hanging strength bar in NGLE:

1. The definition of 'hanging strength'

Lara's strength to hang will decrease if she's just hanging on:

- ledges or
- ladders or
- monkey bars or
- ropes or
- poleropes or
- ziplines or
- parallel (swing) bars.

The setup is calculated and tested only on

- the original and (definitely) used TR4 hanging animations and on
- the TR5 parallel bar hanging animation imported into NGLE by Paolone.

So you have to re-edit the setup, if you want to use further hanging animations in it. - See, for example, the shelf-climbing Lara animation in TR5: Animation466.

2. Extra strength

Sometimes there are too long ledges, too high ladders etc. that Lara can never shimmy, climb etc. all the way on, because all of her strength is too little for that. In those cases she will eat a chocolate bar that gives her some extra hanging strength. - It works like a medipack with the health points: if Lara's health is low, then a medipack will give her new health points.
(Okay, I admit, this is a thing you couldn't find in TR6. This is new. So it has nothing to do with the permanent strength-getting of TR6, when Lara says: 'I feel stronger'.)

Notes:

1. Each chocolate bar is a pickable object. I use chocolate bars in PUZZLE_ITEM4 slot now. (Without puzzle holes.)
You can find chocolate pickable objects, for example, on TRSearch. - In TRSearch Item#1335 you can find the TR6 chocolate by Trinity:

2. There is no animation for 'Lara puts the chocolate bar into her mouth - while hanging only by one hand - and eats that'. Use your illusion - or create the proper animations.
(So 'eating a bar' means only 'minus one chocolate bar from the inventory and giving some extra strength' now.)

3. Don't let Lara have too many chocolate bars in the inventory at the same time, or else you make the player's thing too easy to get through the harder hanging operations.

3. The strength bar

The strength bar will be set exactly below the damage bar (including the name of the damage bar written with little font below the damage bar). You use the first custom bar (see the setup below: BAR_CUSTOM1) as the strength bar now. You use an FBAR_SHOW_BAR_NAME constant in the setup that means the custom bar has a name now.
You must always type the name of the first custom bar in ExtraNG#301 string (so this place is hardcoded). Now the strength type and the amount of chocolate bars will be used as a bar name in that string:

Hanging Strength\nChocolate Bars: #0000

'\n' means 'I hit ENTER' and #0000 is the actual value of Global Byte Alfa1 variable (i.e. the actual amount of the chocolate bars in the inventory) so that is the name you'll see on the screen now:

Hanging Strength
Chocolate Bars: X

In which 'X' is the actual amount of the chocolate bars.

That bar-position on the screen is a constant place for the strength bar (according to this tutorial, at least), so the bar will be in that position even if Lara isn't in a damage room:

The strength bar shows up if Lara starts hanging.
The strength bar starts decreasing continuously from 100 % strength while Lara's hanging. If the bar reaches 0 (i.e. if her strength has just been run out) then she will release the ledge/ladder/monkey bar/rope/polerope/zipline/parallel bar automatically. (If the player releases CTRL before the bar reaches 0, making Lara release the ledge etc., then the decreasing of the strength bar will stop at once, of course.)
The strength bar won't disappear when Lara falls down, releasing the ledge etc. Instead of that, the bar starts increasing continuously ('Lara's strength is increasing, because her arm-muscles are just resting, because Lara's not using them'), and it will disappear only if it reaches 100 %. (Of course, Lara can start hanging again before the strength bar reaches 100 %. But in this case the increasing of the bar stops and it starts decreasing at once.)

Notes:

1. See more about variables in Paolone's Variables demo project and in NG Center\Reference\Variable Placefolders.

2. In TR6 the bar has full strength again just after finishing the hanging. So there's no 'increasing strength' there. - But I think this tutorial shows you more natural event with the increasing strength. And more exciting.

3. Eating a chocolate bar gives Lara 50 % of her full hanging strength - I mean, of course, she will get less if she would step over 100 % with that plus 50 %.

4. Feel free to use the name you want in ExtraNG#301.

So, for example, type only 'Hanging Strength':

Or type only 'Chocolate Bars: #0000':

Or don't type any name (in this case write IGNORE in the setup instead of FBAR_SHOW_BAR_NAME):

Or type any other name.

4. The cases

Case A - Lara uses only arms, hanging on ledges, ladders, monkey bars, ropes, poleropes, ziplines or parallel bars.
In Case A Lara loses 4 % of her strength in every second. - So, if she starts hanging with her full strength then she is able to hang (without eating chocolates) maximum for 100/4=25 seconds before she falls down.

Case B - Lara uses arms, also locking her legs around ropes or poleropes.
In Case B Lara loses 2 % of her strength in every second. - So, if she starts hanging with her full strength then she is able to hang (without eating chocolates) maximum for 100/2=50 seconds before she falls down.

Case C - Lara uses arms, also putting her feet on the ladder.
In Case C Lara loses 1 % of her strength in every second. - So, if she starts hanging with her full strength then she is able to hang (without eating chocolates) maximum for 100/1=100 seconds before she falls down.

The speed of increasing the strength is 3 % in every second, in all the cases. - So, if she falls down because her strength has just become 0 then it will take 100/3=33-34 seconds (without eating chocolates) for the strength to reach 100 % strength after that.
(Of course, only if she doesn't start hanging again before reaching 100%, because if she does, then it will take much time to reach 100 % from 0.)

Modify the setup if you want to use other percent values.

Notes:

1. Of course, there are connections among the cases. So, for example, if Lara is hanging on a ladder without feet on it, then she loses 4 % strength in every second. But when she puts the feet on it, the decreasing reduces, it's only 1 % strength-losing in every second after that.

2. As you see, you can eat chocolates not only in the decreasing phase, when Lara needs that extra strength to prevent her from falling down. But also in the increasing phase, so you will get 100 % strength sooner.

3. To make the things less complicated, I skipped some factors in the setup, making that become a bit subjective, incorrect.
So, for example, if Lara climbs down a ladder, that is exactly as just hard to her as climbing up there - because I skipped the gravitation factor in this case.

5. How it works

If you use the setup of the strength bar (see below) then that's what will happen in the game:

The setup uses two crucial variables:

- Local Byte Alfa1: here you calculate numbers, from 0 to 100. These numbers are the percent values of the strength, from 0 % to 100 %. (The lowest number a custom bar shows is always 0 and the highest number a custom bar shows is always 100, that's why the 0 % strength is always mean a totally empty bar and the 100 % strength is always mean a totally full bar - and that is just perfect now, of course.)
- Local Byte Alfa2: you count in this variable how long Lara will be hanging. (No, we can't use an Organizer now. - I'd rather skip the details why.)

You have to place this FLIPEFFECT on the square where LARA object is - so the game defines a 100 % starting value for the hanging strength of Lara when the level starts:

; Set Trigger Type - FLIPEFFECT 232
; Exporting: TRIGGER(25664:1) for FLIPEFFECT(232)
; <#> : Variables. Numeric. Set <&>Variable with (E)value
; <&> : Local Byte Alfa1
; (E) : Value 100
; Values to add in script command: $2000, 232, $6440

The trigger must be 'One Shot' to prevent Lara from giving the starting value to the strength again, later in the level, accidentally.

(We don't define a starting value for Local Byte Alfa2, so that will have the default starting value: 0.)

If Lara starts performing one of the hanging animations, then the strength bar will appear on the screen, and Local Byte Alfa2 starts counting the frames - because number 1 will be added at each frame to Local Byte Alfa2.
Remember: we want to decrease the strength after 1 second by 4, 2 or 1 %. 30 frames mean 1 second in the game, so if Local Byte Alfa2 reaches 30, the game will subtract 4 % (performing a Case A animation), 2 % (performing a Case B animation) or 1 % (performing a Case C animation) from the 100 % starting value of the strength (i.e. from Local Byte Alfa1).
Local Byte Alfa2 becomes 0 now, but starts increasing at once again, and if it reaches 30 again, the game subtracts 4/2/1 % from the actual value of the strength.
After that, Local Byte Alfa2 continues decreasing Local Byte Alfa1 until Lara releases her grab. (Minus 4/2/1 % per second, again and again.)

'Lara releases her grab' means the player releases CTRL or the game disables CTRL for a short moment when the strength reaches 0. (So, as you see, we won't create 'real hanging strength', using this setup, actually. I mean we create percent numbers in a 0-100 interval, showing the values in a bar, and when the value is 0, then we will disable CTRL for a short while, making Lara fall down.)

If Lara has just released her grab then the game will continue adding number 1 to Local Byte Alfa2 at each frame. After every second (i.e. after every 30 frames) 3 % will be added to the strength (i.e. to Local Byte Alfa1) - because, as I said above, if the strength is not maximal (i.e. not 100 %), the strength will be increased by 3 % in each second.
If Local Byte Alfa1 reaches 100 % (i.e. the maximal strength), then the game will stop adding number 1 to Local Byte Alfa2 (that has its starting value 0 again from now on) and removes the bar off the screen.

Additional features (calculated in the setup):

- The chocolate bar (as I said above).
- A sound signal (a short 'beep') is heard in every second when the strength is too low, warning the player of Lara's fall-down is coming. (This 'beep' is the same beep that damage bars use: sound slot #112, called TICK_TOCK, that uses the original tick.wav.)

6. The setup

You don't need to understand the setup below. (I must admit it's complicated.) So, if you want, just copy it, then paste it into the [Level] block of your level - and enjoy the result!
But don't forget about these things:

- Your LARA object must have the hanging animations the abovementioned tools/situations (ledge/ladder/monkey bar/rope/polerope/zipline/parallel bar) use.
- If you want, hit key C to eat a chocolate bar, any time when Lara's strength is not full.
- Type 'Chocolate Bar' in [Strings].
- Place chocolate bars as PUZZLE_ITEM4 pickable items in your level. So after Lara picked them up she can eat them. (Using our setup, your game starts with 5 bars in the inventory.)
- Decide if you want to use a name for the bar. (See above how to create a name for the bar.)
- Local Byte Alfa1, Local Byte Alfa2 and Global Byte Alfa1 are variables that our setup uses now. So you can't use these variables for other purposes in your level.
- Place that FLIPEFFECT - I mentioned above - on LARA's square.
- You must have the TICK_TOCK sound slot (having the original tick.wav) in your WAD.

If you want to change the setup, you must read the description following that to understand that.
(See more about Script commands and constants in NG Center\Reference.)

So, this is the setup:

TriggerGroup= 1, $8000, 12, $5, $8000+TGROUP_OR, 18, $5, $8000+TGROUP_OR, 215, $1E, >
$8000+TGROUP_OR, 331, $1E, $8000+TGROUP_OR, 337, $1E, >
$8000+TGROUP_OR, 355, $1E, $8000+TGROUP_OR, 356, $1E, >
$8000+TGROUP_OR, 357, $1E, $8000+TGROUP_OR, 358, $1E, $8000+TGROUP_OR, 359, $1E, >
$8000+TGROUP_OR, 360, $1E, $8000+TGROUP_OR, 361, $1E, $8000+TGROUP_OR, 362, $1E, >
$8000+TGROUP_OR, 373, $1E, $8000+TGROUP_OR, 384, $1E, $8000+TGROUP_OR, 394, $1E, >
$8000+TGROUP_OR, 462, $1E
TriggerGroup= 2, $8000, 100, $1F, $8000+TGROUP_OR, 101, $1F, >
$8000+TGROUP_OR, 102, $1F, $8000+TGROUP_OR, 103, $1F, >
$8000+TGROUP_OR, 327, $1E, $8000+TGROUP_OR, 328, $1E, >
$8000+TGROUP_OR, 374, $1E, $8000+TGROUP_OR, 375, $1E, >
$8000+TGROUP_OR, 376, $1E, $8000+TGROUP_OR, 385, $1E, >
$8000+TGROUP_OR, 387, $1E, $8000+TGROUP_OR, 392, $1E, $8000+TGROUP_OR, 393, $1E
TriggerGroup= 3, $8000, 0, $5, $8000+TGROUP_OR, 363, $1E, $8000+TGROUP_OR, 364, $1E, >
$8000+TGROUP_OR, 365, $1E, $8000+TGROUP_OR, 366, $1E, $8000+TGROUP_OR, 367, $1E, >
$8000+TGROUP_OR, 368, $1E, $8000+TGROUP_OR, 369, $1E, $8000+TGROUP_OR, 370, $1E
ColorRGB= 1, 0, 0, 0
ColorRGB= 2, 250, 211, 97
Customize= CUST_BAR, BAR_CUSTOM1, FBAR_SHOW_BAR_NAME, 6, 65, 150, 12, 1, 2, #0040
GlobalTrigger= 1, IGNORE, GT_CONDITION_GROUP, IGNORE, 4, 5, IGNORE
TriggerGroup= 4, $8000, 1, $F, $8000+TGROUP_OR, 2, $F, $8000+TGROUP_OR, 3, $F
TriggerGroup= 5, $2000, 231, $141, $2000, 331, $4
GlobalTrigger= 2, IGNORE, GT_CONDITION_GROUP, IGNORE, 6, 7, 8
TriggerGroup= 6, $8000, 64, $2B
TriggerGroup= 7, $2000, 51, $9, $8000, 376, $1E, $2000, 80, $76
TriggerGroup= 8, $2000, 52, $9
Parameters= PARAM_BIG_NUMBERS, 100, 98, 51
GlobalTrigger= 3, IGNORE, GT_CONDITION_GROUP, IGNORE, 1, 9, 10
TriggerGroup= 9, $8000, 65, $1E2B, $8000, 64, $429, $2000, 233, $440, $2000, 232, $41, >
$8000+TGROUP_ELSE, 65, $1E2B, $8000, 64, $42A, $2000, 232, $40, $2000, 232, $41
TriggerGroup= 10, $8000, 65, $1E2B, $8000, 64, $127, $8000+TGROUP_NOT, 2, $F, >
$8000+TGROUP_NOT, 3, $F, $2000, 231, $340, $2000, 232, $41, >
$8000+TGROUP_ELSE, 65, $1E2B, $8000, 64, $126, $8000+TGROUP_NOT, 2, $F, >
$8000+TGROUP_NOT, 3, $F, $2000, 232, $6440, $2000, 232, $41
GlobalTrigger= 4, IGNORE, GT_CONDITION_GROUP, IGNORE, 2, 11, IGNORE
TriggerGroup= 11, $8000, 65, $1E2B, $8000, 64, $229, $2000, 233, $240, $2000, 232, $41, >
$8000+TGROUP_ELSE, 65, $1E2B, $8000, 64, $12B, $2000, 232, $40, $2000, 232, $41
GlobalTrigger= 5, IGNORE, GT_CONDITION_GROUP, IGNORE, 3, 12, IGNORE
TriggerGroup= 12, $8000, 65, $1E2B, $2000, 233, $140, $2000, 232, $41
GlobalTrigger= 6, IGNORE, GT_CONDITION_GROUP, IGNORE, 13, 14, IGNORE
TriggerGroup= 13, $8000, 15, $F, $8000+TGROUP_OR, 16, $F
TriggerGroup= 14, $2000, 231, $141
TriggerGroup= 15, $8000, 64, $27, $8000+TGROUP_NOT, 1, $F, >
$8000+TGROUP_NOT, 2, $F, $8000+TGROUP_NOT, 3, $F
TriggerGroup= 16, $8000, 64, $28, $8000+TGROUP_NOT, 65, $2B, >
$8000+TGROUP_NOT, 1, $F, $8000+TGROUP_NOT, 2, $F, $8000+TGROUP_NOT, 3, $F
GlobalTrigger= 7, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 17, 18, IGNORE
TriggerGroup= 17, $8000, 64, $28, $8000, 65, $2B
TriggerGroup= 18, $2000, 127, $1
Organizer= 1, IGNORE, IGNORE, 1, 19
TriggerGroup= 19, $2000, 332, $4
GlobalTrigger= 8, IGNORE, GT_CONDITION_GROUP, IGNORE, 20, 21, IGNORE
TriggerGroup= 20, $8000, 65, $F2B, $8000, 22, $F, $8000+TGROUP_OR, 23, $F, $8000+TGROUP_OR, 24, $F
TriggerGroup= 21, $2000, 70, $1F70
TriggerGroup= 22, $8000, 64, $142A, $8000, 1, $F
TriggerGroup= 23, $8000, 64, $A2A, $8000, 2, $F
TriggerGroup= 24, $8000, 64, $52A, $8000, 3, $F
Equipment= PUZZLE_ITEM4, 5
Puzzle= 4, Chocolate Bar, $0009, $0300, $0000, $0000, $0000, $0002
GlobalTrigger= 9, IGNORE, GT_ALWAYS, IGNORE, IGNORE, 25, IGNORE
TriggerGroup= 25, $2000, 244, $2B00
GlobalTrigger= 10, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 26, 27, IGNORE
TriggerGroup= 26, $8000, 46, $10C, $8000, 64, $27, $8000, 0, $129
TriggerGroup= 27, $2000, 49, $3, $8000, 64, $227, $2000, 231, $3240, >
$8000+TGROUP_ELSE, 64, $226, $2000, 232, $6440
GlobalTrigger= 11, IGNORE, GT_LARA_HP_LESS_THAN, 1, IGNORE, 19, IGNORE
GlobalTrigger= 12, IGNORE, GT_CONDITION_GROUP, IGNORE, 28, 29, IGNORE
TriggerGroup= 28, $8000, 65, $1F2B
TriggerGroup= 29, $2000, 232, $1D41

6.1. Basic conditions

The basic conditions of the setup are contained in TriggerGroup#1, 2 and 3:

a, If any of the animations in TriggerGroup#1 is just being performed, then it means Case A just happens:

- If Lara is performing 'monkey' action (i.e. any of the 'monkey' animations).

; Set Trigger Type - CONDITION 5
; Exporting: CONDITION(5:62) for PARAMETER(12)
; <#> : Monkey
; <&> : Lara. (Status) Lara is performing <#>action is (E)
; (E) : TRUE (Lara is performing #action)
; Values to add in script command: $8000, 12, $5

- If Lara is performing 'hanged' action (i.e. any of the 'hanging without using legs/feet' animations, excluding 'shimmying around external/internal corners' animations, but including 'turning on monkey bars' - 271, 272 - animations).

; Set Trigger Type - CONDITION 5
; Exporting: CONDITION(5:62) for PARAMETER(18)
; <#> : Hanged
; <&> : Lara. (Status) Lara is performing <#>action is (E)
; (E) : TRUE (Lara is performing #action)
; Values to add in script command: $8000, 18, $5

- If Lara slides on a zipline: Animation 215.
- If Lara jumps and grabs a polerope: Animation 331, 337.
- If Lara is performing any of the 'shimmying around external/internal corners without feet on ladder' animations: Animation 355, 356, 357, 358, 359, 360, 361, 362.
- If Lara is performing any of the rope animations when her legs aren't locked around the rope: Animation 373, 384, 394.
- If Lara is swinging on parallel bars: Animation 462.

b, If any of the animations in TriggerGroup#2 is just being performed, then it means Case B just happens:

- If Lara is performing any of the polerope animations when her legs are locked around the polerope: all of the animations of State 100 (Animation 329, 338), State 101 (Animation 334, 335, 336), State 102 (Animation 332, 343, 344) and State 103 (Animation 333, 345, 346), furthermore Animation 327 or 328.
- If Lara is performing any of the rope animations when her legs are locked around the rope: Animation 374, 375, 376, 385, 387, 392, 393.

c, If any of the animations in TriggerGroup#3 is just being performed, then it means Case C just happens:

- If Lara is performing 'climbing' action (i.e. any of the 'climbing on ladder with feet on it' animations, excluding 'shimmying around external/internal corners' animations).

; Set Trigger Type - CONDITION 5
; Exporting: CONDITION(5:62) for PARAMETER(0)
; <#> : Climbing
; <&> : Lara. (Status) Lara is performing <#>action is (E)
; (E) : TRUE (Lara is performing #action)
; Values to add in script command: $8000, 0, $5

- If Lara is performing any of the 'shimmying around external/internal corners with feet on ladder' animations: Animation 363, 364, 365, 366, 367, 368, 369, 370.

Notes:

1. It's easy to identify the condition triggers used on states or animations in TriggerGroup#1, 2 or 3:

; Set Trigger Type - CONDITION 31
; Exporting: CONDITION(31:0) for PARAMETER(X)
; <#> : State-Id= X
; <&> : Lara. (State-Id) Lara is in <#>State-id
; (E) : 
; Values to add in script command: $8000, X, $1F

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

2. When I say 'Lara can perform ANY animations' then this 'any of them' is represented by TGROUP_OR constants in these TriggerGroups.

6.2. Showing the bar

Our custom bar, the strength bar is formed in the 'Customize= CUST_BAR' Script command:

- BAR_CUSTOM1 means you use the first custom bar slot for the strength bar.
- FBAR_SHOW_NAME means the bar has a name.
- 6, 65, 150, 12 are the coordinates of the bar on the screen.
- 1 and 2 are the IDs of ColorRGB commands. The colors defined in those ColorRGBs are the colors of the bar.
- #0040 is the ID of Local Byte Alfa1. It means the actual value of Local Byte Alfa1 is shown in the bar.

GlobalTrigger#1 uses TriggerGroup#4 as a condition. If TriggerGroup#4 is true then TriggerGroup#5 will happen.
So, if Lara performs any animation of TriggerGroup#1, #2 or #3 (i.e. if one of Case A, B or C just happens, so if Lara's just hanging) then the game will add number 1 to Local Byte Alfa2 and puts the bar on the screen:

; Set Trigger Type - FLIPEFFECT 231
; Exporting: TRIGGER(321:0) for FLIPEFFECT(231)
; <#> : Variables. Numeric. Add to <&>Variable the (E)value
; <&> : Local Byte Alfa2
; (E) : Value 1
; Values to add in script command: $2000, 231, $141

; Set Trigger Type - FLIPEFFECT 331
; Exporting: TRIGGER(4:0) for FLIPEFFECT(331)
; <#> : Custom Bar. Show the <&>Custom bar on screen for (E)Seconds
; <&> : BAR_CUSTOM1
; (E) : Forever (use other action/effect to disable it)
; Values to add in script command: $2000, 331, $4

Excepting some cases (see for example FGT_SINGLE_SHOT_FLAG below) an enabled GlobalTrigger will check its condition(s) at each frame. (The GlobalTriggers of this setup are always enabled.) That's why number 1 will be added at each frame to Local Byte Alfa2 if Lara's just hanging. (It also means the bar will be placed on the screen at each frame, if Lara's just hanging. It is necessary, because you can be sure now that the bar will be refreshed on the screen, if it has a new percent, i.e. if Local Byte Alfa1 has a new value.)

Note:
It's easy to identify the condition triggers used on TriggerGroups in TriggerGroup#4:

; Set Trigger Type - CONDITION 15
; Exporting: CONDITION(15:0) for PARAMETER(Z)
; <#> : TriggerGroup= Z
; <&> : Multiple condition of <#>TriggerGroup script command
; (E) : 
; Values to add in script command: $8000, Z, $F

6.3. Losing the strength totally

GlobalTrigger#2 uses TriggerGroup#6 as a condition. If TriggerGroup#6 is true then TriggerGroup#7 will happen. Or, if TriggerGroup#6 isn't true then TriggerGroup#8 will happen.
So, if the decreasing bar (i.e. the decreasing value of Local Byte Alfa1) reaches 0 then the game disables the Key CTRL, and - if Lara's just performing Animation 376 - forces Lara to perform Animation 374.
But, if the bar leaves 0 (because Lara's strength - i.e. the value of Local Byte Alfa1 - starts increasing at once if Lara's just stopped hanging) then the game enables the Key CTRL again. (As you know now, if Lara's not hanging, then her strength starts increasing by 3 % in each second. That's why 1 second after the disabling, the game always re-enables CTRL, because the strength isn't 0 now.)

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:62) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 0
; Values to add in script command: $8000, 64, $2B

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

; Set Trigger Type - FLIPEFFECT 80
; Exporting: TRIGGER(118:0) for FLIPEFFECT(80)
; <#> : Lara. (Animation) Force <&>Animation (256-512) of (E)slot for Lara
; <&> : 374 Animation
; (E) : SLOT_000 LARA
; Values to add in script command: $2000, 80, $76

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

Animation 376 is the animation when Lara's climbing up a rope. If she's just performing it when the decreasing bar reaches 0 then disabling CTRL is useless. But if Lara stops climbing up (so if she becomes still), the disabling will work at last, Lara will fall down.
The 'still Lara is on rope' animation is Animation 374. So, when Lara's just climbing up and the bar reaches 0 then the game will force her to stop (i.e. to perform Animation 374). And, because Animation 374 is usable for the CTRL-disabling, Lara will fall down.

Note:
You won't be able to use CTRL for other purposes (shooting, saving the game in Save Game menu etc.) either, through 1 second (i.e. until the re-enabling) after the disabling. - If it bothers you, change the setup somehow.

6.4. Counting the percents

GlobalTrigger#3 counts the 4 % decreasing when Lara performs a Case A animation.
GlobalTrigger#4 counts the 2 % decreasing when Lara performs a Case B animation.
GlobalTrigger#5 counts the 1 % decreasing when Lara performs a Case C animation.
And also GlobalTrigger#3 counts the 3 % increasing - but it works in all the cases, i.e. if Lara has fallen down whether performing a Case A animation, or performing a Case B animation, or performing a Case C animation before.

(Some parts of the setup - including some of these GlobalTriggers - use numbers you can't define directly in triggers. These numbers will be defined in the fields of the 'Parameters= PARAM_BIG_NUMBERS' Script command.)

So, GlobalTrigger#3 uses TriggerGroup#1 as a condition. If TriggerGroup#1 is true then TriggerGroup#9 will happen. Or, if TriggerGroup#1 isn't true then TriggerGroup#10 will happen.
So, if Lara's just performing a Case A animation, then two counting cases are possible:

- If Local Byte Alfa2=30 and Local Byte Alfa1 is bigger than 4 or equal with 4 then the game subtracts 4 from Local Byte Alfa1 (giving a new value to that) and turns Local Byte Alfa2 into 0.
So: as you know, if 1 second elapsed and Case A happens then the value of the bar will decrease by 4. Now 'Local Byte Alfa2=30' means that second and 'Local Byte Alfa1 minus 4' means the decreasing by 4.
(Local Byte Alfa2 turns into 0 so that variable now starts counting the next second, that will be elapsed if the variable reaches 30 again etc.
And the 'Local Byte Alfa1 is bigger than 4 or equal with 4' condition is necessary, because it's logical we can't subtract 4 from the variable, if that's smaller than 4. Because 3-4=-1, 2-4=-2 and 1-4=-3 are not valid numbers, there isn't 'minus percent strength'.
Of course, there are no 0-4=-4, -1-4=-5 etc. problems now, because the counting down will stop if it reaches 0 %: Lara releases the grab and the strength starts increasing. I mean, for example, there will never be percent value -1, that's why the game will never want to subtract 4 from that.)

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:2) for PARAMETER(65)
; <#> : Local Byte Alfa2
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 30
; Values to add in script command: $8000, 65, $1E2B

; Set Trigger Type - CONDITION 41
; Exporting: CONDITION(41:54) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is >= than (E)Value
; (E) : Value= 4
; Values to add in script command: $8000, 64, $429

; Set Trigger Type - FLIPEFFECT 233
; Exporting: TRIGGER(1088:0) for FLIPEFFECT(233)
; <#> : Variables. Numeric. Substract from <&>Variable the (E)value
; <&> : Local Byte Alfa1
; (E) : Value 4
; Values to add in script command: $2000, 233, $440

; Set Trigger Type - FLIPEFFECT 232
; Exporting: TRIGGER(65:0) for FLIPEFFECT(232)
; <#> : Variables. Numeric. Set <&>Variable with (E)value
; <&> : Local Byte Alfa2
; (E) : Value 0
; Values to add in script command: $2000, 232, $41

- If Local Byte Alfa2=30 ($8000, 65, $1E2B) and Local Byte Alfa1 is smaller than 4 then the game turns both Local Byte Alfa1 and Local Byte Alfa2 into 0 ($2000, 232, $41). - So this is the way to prevent 'negative percent strength', because in those 3-4, 2-4 and 1-4 cases the game always calculates 0 percent strength when the 1 second elapsed.

; Set Trigger Type - CONDITION 42
; Exporting: CONDITION(42:54) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is < than (E)Value
; (E) : Value= 4
; Values to add in script command: $8000, 64, $42A

; Set Trigger Type - FLIPEFFECT 232
; Exporting: TRIGGER(64:0) for FLIPEFFECT(232)
; <#> : Variables. Numeric. Set <&>Variable with (E)value
; <&> : Local Byte Alfa1
; (E) : Value 0
; Values to add in script command: $2000, 232, $40

If Lara's just not performing a Case A animation, then TriggerGroup#10 will happen. - There are two counting cases again:

- If Local Byte Alfa2=30 ($8000, 65, $1E2B) and Local Byte Alfa1 is smaller than the value of PARAM_BIG_NUMBERS field#1 (i.e. 98) and Lara's performing neither Case B ($8000+TGROUP_NOT, 2, $F) nor Case C ($8000+TGROUP_NOT, 3, $F) then the game adds number 3 to Local Byte Alfa1 (giving a new value to that) and turns Local Byte Alfa2 into 0 ($2000, 232, $41).
As you know, if 1 second elapsed and Lara's not hanging then the value of the bar will increase by 3. Thanks to the main condition (TriggerGroup#1) of GlobalTrigger#3 and $8000+TGROUP_NOT, 2, $F and $8000+TGROUP_NOT, 3, $F conditions, the 'not hanging' condition now is defined. The '1 second elapsed' is defined in 'Local Byte Alfa2=30' and the 'increasing by 3' is defined in 'Local Byte Alfa1 plus 3'.
(Local Byte Alfa2 turns into 0 so that variable now starts counting the next second, that will be elapsed if the variable reaches 30 again etc.
And the 'Local Byte Alfa1 is smaller than 98' condition is necessary - i.e. if the variable is 97 at most -, because it's logical we can't add 3 to the variable, if that's bigger than 97. Because, 98+3=101 and 99+3=102 are not valid numbers, there isn't 'more than one hundred percent strength'.
Of course, there are no 101+3=104, 102+3=105 etc. problems now, because TriggerGroup#10 can't let bigger strength value than 100. I mean, for example, there will never be percent value 101, that's why the game will never want to add 3 to that. - But there is 100+3=103 problem and that will also be solved now, at this TriggerGroup - but you will understand it at Chapter 6.5.)

; Set Trigger Type - CONDITION 39
; Exporting: CONDITION(39:60) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is < than (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 1
; Values to add in script command: $8000, 64, $127

; Set Trigger Type - FLIPEFFECT 231
; Exporting: TRIGGER(832:0) for FLIPEFFECT(231)
; <#> : Variables. Numeric. Add to <&>Variable the (E)value
; <&> : Local Byte Alfa1
; (E) : Value 3
; Values to add in script command: $2000, 231, $340

- If Local Byte Alfa2=30 ($8000, 65, $1E2B) and Local Byte Alfa1 is bigger than the value of PARAM_BIG_NUMBERS field#1 (i.e. 98) or equal with it, and Lara's performing neither Case B ($8000+TGROUP_NOT, 2, $F) nor C ($8000+TGROUP_NOT, 3, $F) then the game turns Local Byte Alfa into 100 ($2000, 232, $6440) and turns Local Byte Alfa2 into 0 ($2000, 232, $41). - So this is the way to prevent 'more than one hundred percent strength', because in those 98+3 and 99+3 and 100+3 cases the game always calculates 100 percent strength when the 1 second elapsed.

; Set Trigger Type - CONDITION 38
; Exporting: CONDITION(38:60) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is >= than (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 1
; Values to add in script command: $8000, 64, $126

GlobalTrigger#4 uses TriggerGroup#2 as a condition. If TriggerGroup#2 is true then TriggerGroup#11 will happen.
So, if Lara's just performing a Case B animation, then two counting cases are possible:

- If Local Byte Alfa2=30 ($8000, 65, $1E2B) and Local Byte Alfa1 is bigger than 2 or equal with 2 then the game subtracts 2 from Local Byte Alfa1 (giving a new value to that) and turns Local Byte Alfa2 into 0 ($2000, 232, $41).
So: as you know, if 1 second elapsed and Case B happens then the value of the bar will decrease by 2. Now 'Local Byte Alfa2=30' means that second and 'Local Byte Alfa1 minus 2' means the decreasing by 2.
(Local Byte Alfa2 turns into 0 so that variable now starts counting the next second, that will be elapsed if the variable reaches 30 again etc.
And the 'Local Byte Alfa1 is bigger than 2 or equal with 2' condition is necessary, because it's logical we can't subtract 2 from the variable, if that's smaller than 2. Because, 1-2=-1 is not a valid number, there isn't 'minus 1 percent strength'.
Of course, there are no 0-2=-2, -1-2=-3 etc. problems now, because the counting down will stop if it reaches 0 %.)

; Set Trigger Type - CONDITION 41
; Exporting: CONDITION(41:58) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is >= than (E)Value
; (E) : Value= 2
; Values to add in script command: $8000, 64, $229

; Set Trigger Type - FLIPEFFECT 233
; Exporting: TRIGGER(576:0) for FLIPEFFECT(233)
; <#> : Variables. Numeric. Substract from <&>Variable the (E)value
; <&> : Local Byte Alfa1
; (E) : Value 2
; Values to add in script command: $2000, 233, $240

- If Local Byte Alfa2=30 ($8000, 65, $1E2B) and Local Byte Alfa1 is 1 then the game turns both Local Byte Alfa1 ($2000, 232, $40) and Local Byte Alfa2 into 0 ($2000, 232, $41). - So this is the way to prevent 'minus percent strength', because in that 1-2=-1 case the game always calculates 0 percent strength when the 1 second elapsed.

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:60) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 1
; Values to add in script command: $8000, 64, $12B

GlobalTrigger#5 uses TriggerGroup#3 as a condition. If TriggerGroup#3 is true then TriggerGroup#12 will happen.
So, if Lara's just performing a Case C animation, and Local Byte Alfa2=30 ($8000, 65, $1E2B) then the game subtracts 1 from Local Byte Alfa1 (giving a new value to that) and turns Local Byte Alfa2 into 0 ($2000, 232, $41).
So: as you know, if 1 second elapsed and Case C happens then the value of the bar will decrease by 1. Now 'Local Byte Alfa2=30' means that second and 'Local Byte Alfa1 minus 1' means the decreasing by 1.
(Local Byte Alfa2 turns into 0 so that variable now starts counting the next second, that will be elapsed if the variable reaches 30 again etc.)

; Set Trigger Type - FLIPEFFECT 233
; Exporting: TRIGGER(320:0) for FLIPEFFECT(233)
; <#> : Variables. Numeric. Substract from <&>Variable the (E)value
; <&> : Local Byte Alfa1
; (E) : Value 1
; Values to add in script command: $2000, 233, $140

6.5. The rest

Either the game releases CTRL by GlobalTrigger#2 or the player releases CTRL by him/herself, the decreasing of the strength bar will stop (at 0 or a bigger value). Exactly at that moment, the bar starts increasing, which indicates 'Lara's just resting, so she's just getting strength'. - But, of course, she can't get more strength if the bar reaches 100 %.

GlobalTrigger#6 will control that procedure:
The GlobalTrigger uses TriggerGroup#13 as a condition. If TriggerGroup#13 is true then TriggerGroup#14 will happen. So, if all the conditions in TriggerGroup#15 are true ($8000, 15, $F) or all the conditions in TriggerGroup#16 are true ($8000+TGROUP_OR, 16, $F) then the game adds number 1 to Local Byte Alfa2 ($2000, 231, $141).

The conditions in TriggerGroup#15:
If Local Byte Alfa1 is smaller than the value of PARAM_BIG_NUMBERS field#0 (i.e. 100) - i.e. if the variable is 99 at most - and Lara's not hanging (because she's not performing Case A, B, C triggers, i.e. TriggerGroup#1, 2 or 3 triggers: $8000+TGROUP_NOT, 1, $F, $8000+TGROUP_NOT, 2, $F, $8000+TGROUP_NOT, 3, $F.

; Set Trigger Type - CONDITION 39
; Exporting: CONDITION(39:62) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is < than (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 0
; Values to add in script command: $8000, 64, $27

The conditions in TriggerGroup#16:
If Local Byte Alfa1 is equal with the value of PARAM_BIG_NUMBERS field#0 (i.e. 100) and Local Byte Alfa2 isn't 0 and Lara's not hanging (because she's not performing Case A, B, C triggers, i.e. TriggerGroup#1, 2 or 3 triggers).

; Set Trigger Type - CONDITION 40
; Exporting: CONDITION(40:62) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is = than (E)Big Number value
; (E) : Value of Parameters=PARAM_BIG_NUMBERS at index= 0
; Values to add in script command: $8000, 64, $28

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:62) for PARAMETER(65)
; <#> : Local Byte Alfa2
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 0
; Values to add in script command: $8000, 65, $2B

So, if Lara's just not hanging then GlobalTrigger#6 runs the 'timer' in Local Byte Alfa2 - the same way as GlobalTrigger#1 does: adding number 1 to it, at each frame. - But this time 1 will be added to that variable if Lara's not hanging while GlobalTrigger#1 does that when Lara's hanging.
So, with GlobalTrigger#1 you control the timer for decreasing strength, but with GlobalTrigger#6 you control the timer for increasing strength.

The 'more simply part' of that is what TriggerGroup#15 will cause: it adds number 1 to Local Byte Alfa2 always when Local Byte Alfa1 (the strength) is anywhere between 0 and 99 (including 0 and 99 itself). So Local Byte Alfa2 reaches 30 again and again, from 0 % strength to 99 % strength - and that's what TriggerGroup#10 will use (see above) to increase Local Byte Alfa1 by 3 % per second.

As I said above, 'I skipped some factors in the setup'. One of them is about a small cheat with the timer:
Let's see an example: the hanging Lara's strength is just 60 and the timer has just counted from 0 to 25 when the player releases the ledge and Lara falls down. So GlobalTrigger#6 starts, i.e. it also adds 1 and 1 and 1 etc. to the timer. That's why that becomes 26, 27, 28, 29, 30 - and then TriggerGroup#10 increases the strength from 60 to 63.
And that is a 'skipped factor'. - I mean, yes, there are 30 frames, 1 second between 60 and 63, but not all that 30 frames were spent having increasing strength. Only 5 frames were. And that is illogical a bit.

I told all of that only to understand the next part of the description:

When Lara's not hanging and she has her full hanging strength, then Local Byte Alfa1 (the strength) is 100 %, and Local Byte Alfa2 (the 'timer') is not running, having its starting value 0 continuously. - Naturally, mostly that's the situation when the player is playing.
So, with full strength, not hanging, Local Byte Alfa1 is 100 and Local Byte Alfa2 is 0. That's why GlobalTrigger#6 is not allowed to detect those values. (Because, why should it increase the strength when that is full?) I mean, if TriggerGroup#10 turns the strength into 100 and turns the timer into 0, then nothing happens, because GlobalTrigger#6 won't care about these values. - So this is the way to stop the increasing strength when that has just reached the full strength!

But we need GlobalTrigger#6 values for the increasing strength when the strength is 100 and the timer is NOT 0. - That condition is defined in TriggerGroup#16.

Wait a minute! It means increasing strength with 100 % value! 100 % means full, how can it be 'increasing'?
Well, it is logical - though it's very technical:
Let's see an example: Lara has full strength, 100 %, and she's not hanging, so the timer won't move, i.e. Local Byte Alfa2 is 0. Then she jumps up to grab a ledge. The timer starts: 1, 2, 3 etc. But Lara will hang only for some short moments, because the player releases CTRL, when the timer reaches 17, so Lara will fall down.
So the strength is still 100 - but technically it's not full, I mean it starts the increasing procedure now, because Lara is weaker now by 17 frames than the full strength. It means GlobalTrigger#6 starts adding 1 and 1 and 1 etc. to the timer now (18, 19 etc.). When the timer reaches 30, TriggerGroup#10 turns the timer into 0, and doesn't let 100 % strength to be 103. (That's why I said at the description of TriggerGroup#10 that 100+3 problem exists but TriggerGroup#10 will solve that as well.) - And now we reached the 'Local Byte Alfa1=100 and Local Byte Alfa2=0' case again, the strength is full and not changing.

6.6. Removing the bar

If the increasing bar reaches the full strength, that will disappear off the screen (until it appears on the screen again, because Lara is hanging again).
It's GlobalTrigger#7 that will clear the bar off the screen, with an Organizer.
The Organizer is needed, because without that, the bar will disappear exactly at the moment when it reaches 100 %. And that is ugly. That's why the Organizer will remove the bar 1 second after reaching 100 %.

GlobalTrigger#7 uses TriggerGroup#17 as a condition. If TriggerGroup#17 is true, then TriggerGroup#18 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

'If TriggerGroup#17 is true' means if Local Byte Alfa1 is the value of PARAM_BIG_NUMBERS field#0, i.e. 100 ($8000, 64, $28) and if Local Byte Alfa2=0 ($8000, 65, $2B) - so, 'if the increasing strength has reached its maximum', thanks to TriggerGroup#10, then we don't need the bar on the screen any more, that's why the Organizer starts, to remove it.
Organizer#1 starts TriggerGroup#19 after 1 second. TriggerGroup#19 contains the bar-removing trigger, that's why the bar will be removed 1 second after starting Organizer#1.

; Set Trigger Type - FLIPEFFECT 332
; Exporting: TRIGGER(4:0) for FLIPEFFECT(332)
; <#> : Custom Bar. Hide the <&>Custom bar
; <&> : BAR_CUSTOM1
; (E) : 
; Values to add in script command: $2000, 332, $4

The GlobalTrigger#7 has an FGT_SINGLE_SHOT_RESUMED flag. It's important, because of technical reasons. (Without that flag, the bar would remain on the screen when the bar reaches its maximum. Because, without that, the game states at each frame - when the condition is true - that 'remove the bar not now, but only after 1 second'.)

6.7. The sound signal

GlobalTrigger#8 controls the procedure, making the game play 'beep' sounds when Lara's just hanging and the strength is too low.
The beep plays in each second when Lara has maximum 5 seconds before her strength runs out. - That's why the beeping starts in different strength percents at the different cases:

- In Case A, the change is 4 %, that's why the beeping must be started just below 20 %, because 4 %�5 seconds=20 %.
- In Case B, the change is 2 %, that's why the beeping must be started just below 10 %, because 2 %�5 seconds=10 %.
- In Case C, the change is 1 %, that's why the beeping must be started just below 5 %, because 1 %�5 seconds=5 %.

Let's see for example Case A to make it clear:

The decreasing bar reaches 24 %.
Then the decreasing bar reaches 20 %. After that, the first beep plays.
Then the decreasing bar reaches 16 %. After that, the second beep plays.
Then the decreasing bar reaches 12 %. After that, the third beep plays.
Then the decreasing bar reaches 8 %. After that, the fourth beep plays.
Then the decreasing bar reaches 4 %. After that, the fifth beep plays.
Then the decreasing bar reaches 0 %. Lara falls down.

As you see, the beep won't play when the bar reaches a given percent, but will play when the timer is - exactly - between two given percents. (I mean, if the timer - running always from 0 to 30 frames - reaches always 15 frames.) Why? Because it seems a bit buggy if I try to play that sound exactly when the percent changes.

The condition of Case A is defined in TriggerGroup#22: if the strength (Local Byte Alfa1) is smaller than 20 and if Lara's performing a Case A animation of TriggerGroup#1 ($8000, 1, $F).

; Set Trigger Type - CONDITION 42
; Exporting: CONDITION(42:22) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is < than (E)Value
; (E) : Value= 20
; Values to add in script command: $8000, 64, $142A

The condition of Case B is defined in TriggerGroup#23: if the strength (Local Byte Alfa1) is smaller than 10 and if Lara's performing a Case B animation of TriggerGroup#2 ($8000, 2, $F).

; Set Trigger Type - CONDITION 42
; Exporting: CONDITION(42:42) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is < than (E)Value
; (E) : Value= 10
; Values to add in script command: $8000, 64, $A2A

The condition of Case C is defined in TriggerGroup#24: if the strength (Local Byte Alfa1) is smaller than 5 and if Lara's performing a Case C animation of TriggerGroup#3 ($8000, 3, $F).

; Set Trigger Type - CONDITION 42
; Exporting: CONDITION(42:52) for PARAMETER(64)
; <#> : Local Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is < than (E)Value
; (E) : Value= 5
; Values to add in script command: $8000, 64, $52A

TriggerGroup#20 merges the three conditions, saying: if either TriggerGroup#22 is true ($8000, 22, $F), or TriggerGroup#23 is true ($8000+TGROUP_OR, 23, $F), or TriggerGroup#24 is true ($8000+TGROUP_OR, 24, $F) - and, of course, if the 'timer' (Local Byte Alfa2) is just 15.

; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:32) for PARAMETER(65)
; <#> : Local Byte Alfa2
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 15
; Values to add in script command: $8000, 65, $F2B

GlobalTrigger#8 uses TriggerGroup#20 as a condition: if that is true, then TriggerGroup#21 (i.e. playing the 'beep') will happen. - I mean, if Lara's hanging and her strength is under a given percent, then you will hear a beep in every second, until her strength has just totally run out.

; Set Trigger Type - FLIPEFFECT 70
; Exporting: TRIGGER(8048:0) for FLIPEFFECT(70)
; <#> : Sound. Play <&>Sound sample of first group (0-255) for (E) time
; <&> : TICK_TOCK 112 Ok tick
; (E) : Perform one single time
; Values to add in script command: $2000, 70, $1F70

6.8. Eating chocolates

First of all, you need a usual Script entry for the chocolate bar (i.e. PUZZLE_ITEM4):

Puzzle= 4, Chocolate Bar, $0009, $0300, $0000, $0000, $0000, $0002

GlobalTrigger#9 is a GlobalTrigger that is always true (see: GT_ALWAYS). So it performs TriggerGroup#25 at every frame of the level: it copies the actual amount of PUZZLE_ITEM4 chocolate bars in the inventory into Global Byte Alfa1 variable. - Thanks to the continuous performing, if Lara picks up a bar or 'eats' one, the new amount will be realized at once in the variable.

; Set Trigger Type - FLIPEFFECT 244
; Exporting: TRIGGER(11008:0) for FLIPEFFECT(244)
; <#> : Variables. Memory. Copy to <&>Numeric Variable the (E)Savegame Memory value
; <&> : Global Byte Alfa1
; (E) : Inventory. Puzzle Item 4 (Byte)
; Values to add in script command: $2000, 244, $2B00

GlobalTrigger#10 controls what will happen if Lara eats a chocolate. 'Eating' means the conditions in TriggerGroup#26 are true. The 'happenings' are defined in TriggerGroup#27.

These are the conditions in TriggerGroup#26:
If the player has just hit key C and if Local Byte Alfa1, the strength is smaller than the value of PARAM_BIG_NUMBERS field#0 (i.e. 100) - i.e. if the variable is 99 at most - ($8000, 64, $27) and if Global Byte Alfa1 is bigger than 1 or equal with 1.

; Set Trigger Type - CONDITION 12
; Exporting: CONDITION(12:60) for PARAMETER(46)
; <#> : KeyC
; <&> : Keyboard. <#>keyboard scancode is currently (E)
; (E) : ACTIVE (Single shot for positive condition)
; Values to add in script command: $8000, 46, $10C

; Set Trigger Type - CONDITION 41
; Exporting: CONDITION(41:60) for PARAMETER(0)
; <#> : Global Byte Alfa1
; <&> : Variables. The <#>Numeric Variable is >= than (E)Value
; (E) : Value= 1
; Values to add in script command: $8000, 0, $129

So TriggerGroup#26 says this:
We could encounter more problems if we wanted to use a PUZZLE_ITEM4 chocolate from directly the inventory. (For example, there is no hole for this puzzle item.) So this time, 'if I hit key C' ('C' - Chocolate) means 'if I used a chocolate from the inventory'. - But only: