View Single Post
Old 18-02-19, 17:39   #13231
TheLostSecret
Member
 
Joined: Mar 2018
Posts: 632
Arrow A solution for your problem...

Quote:
Originally Posted by A_De View Post
Does anybody know how to disable keyboard keys during flyby or Inventory/Pause menu?
For some reasons there are only controls disabled, but not other keys. I added the hotkey for diary and it can be switched on always, no matter if the controls are off. The same is about using PLS with globaltrigger with GT_GAME_KEY2_COMMAND and KEY2_USE_FLARE. It completely ignores any status of controls, and there even does not matter if Lara is alive or not.
Hello A_De!

There is one solution for you which I suppose it can help you with your issue.

This is how the algorithm works:

We need to allocate a variable to check for us whether a flyby camera is active or we are in our Inventory/Pause Menu. Whenever the variable is set to 1, it means that the game is busy doing some operations hence our other TriggerGroups in action must be suspended. After the operation is complete ( I mean when the player has exited Inventory/Pause Screen and/or the flyby scene has been broken/ended ), we will set the value to 0, which means there are no more operations to wait for.

Here, I have used Local Byte Delta4 variable, but if you have already occupied this variable, you can change the code the way you want!

Code:
GlobalTrigger=  1 , IGNORE , GT_GAME_KEY2_COMMAND , 65536 , IGNORE , 1 , 2
GlobalTrigger=  2 , IGNORE , GT_GAME_KEY2_COMMAND , 8192 , IGNORE  , 1 , 2
GlobalTrigger=  3 , IGNORE , GT_CONDITION_GROUP , IGNORE , 3 , 1 , 2

TriggerGroup=  1 , $2000, 232, $14B
TriggerGroup=  2 , $2000, 232, $4B
TriggerGroup=  3 , $8000+TGROUP_AND, 13, $34 , $8000+TGROUP_AND, 10, $5
Now, a very strange thing you might realize is that we have used GT_GAME_KEY2_COMMAND, but what does 65536 mean? This is something I have discovered recently. According to Microsoft DirectX DirectInput Knowledge Base, each key code is assigned with a value of power 2. 65536 equals 2 ^ 16, which means 16 is the control ID handle for "Pause" command and a power of two is the code received by game from our controller device.

Maybe this question might pop up in your mind that why do I have to use a GT_GAME_KEYX_COMMAND? Why can't I use other condition triggers to check for input? The answer is that when the inventory/pause menu is prompted, the game's background operations such as rendering the scene, getting other inputs, etc. will be disabled 1 frame before the inventory/pause menu is shown, but here we need a command that has A VERY HIGH PRIORITY which even works in the suspension frame, and as a result, GT_GAME_KEYX_COMMAND is the best choice.

So, the code works like this:

GlobalTrigger with ID 1 waits for "Pause" key input from the player. As soon as the mapped button is received from our controller device, it will set the Local Byte Alfa4 value to 1. If not TRUE, it will revert it back to 0.
GlobalTrigger with ID 2 waits for "Inventory" key input from the player. As soon as the mapped button is received from our controller device, it will set the Local Byte Alfa4 value to 1. If not TRUE, it will revert it back to 0.
GlobalTrigger with ID 3 checks for miscellaneous conditions, such as if there is a flyby sequence in progress or if Lara is dying.

TriggerGroup with ID 1 sets the variable's value to 1.
TriggerGroup with ID 2 sets the variable's value to 0.
TriggerGroup with ID 3 is our condition group.

HOW TO MAKE OUR CODE WORK?

Simple!

Just add this condition trigger to the beginning of each TriggerGroup you want to control its suspension while the game is busy doing some operations ( such as player is in pause menu/inventory and other conditions you would like to be there! ):

Code:
$8000+TGROUP_AND, 75, $2B , ;OTHER COMMANDS...
; Set Trigger Type - CONDITION 43
; Exporting: CONDITION(43:62) for PARAMETER(75) {Tomb_NextGeneration}
; <#> : Local Byte Delta4
; <&> : Variables. The <#>Numeric Variable is = than (E)Value
; (E) : Value= 0
; Values to add in script command: $8000, 75, $2B


If you had any problems, let me know and I would be grateful to help you!

Last edited by TheLostSecret; 18-02-19 at 18:51. Reason: Updating Code
TheLostSecret is offline   Reply With Quote