I’m wondering how to make my interaction variable disable. Meaning if you press E then nothing happens until the game allows you too. The game will open up with the player in his sitting animation, but when the play presses E they can stand and move around. How do I fix this?
Here’s My code for sitting down if anyone wants to help.
Hi, from your description I am not sure what you want to fix (the player should or should not sit at the beginning of the scene?), but generally you could use boolean object variables on your player. At the start of the scene the variable is set to false and when the player is in collision with chair you can toggle it to true which could be used then as a condition + e key is released for the player to sit (if that’s what you want).
Yeah, Sorry about that. Even I didn’t know what I was talking about. But basically thanks to the desk space event group in the screen shot, the player can sit and stand when they press E while standing near it.
I’ve made it so that this behavior is triggered upon entering the game and the player is already sitting down upon entering the room. Problem is. They can still press e to get up and move around.
How do I disable the “E Key Released” for this moment in the game? If you know.
I still don’t really understand what the player is supposed to do. So you want the player to sit but there should be no possibility to release e and move around? You could just get rid of the "e key released’ condition then, but I guess that’s not really what you want since this is the only possibility in this part of your events to do something with the player.
As mentioned, you might want to set boolean object variables. Let’s say you have a boolean object variable “sit”, you can set it to true when the player sits (collides with chair) and toggle it to false after an animation is finished or whatever should happen before the player can move again. Then you give the state of the boolean variable (false) as a condition together with pressing or releasing the e key for doing what you want the player to do.
From what I understand the mechanics is working, but he wants to disable it at sometimes during the game (including at the beginning). Not just disable stand or sit, but the entire mechanics. Example: maybe during a dialogue or cutscene he does not want the player to still have the possibility to get stand/sit, but when it’s over, the mechanics can be active again.
I think your explanation with boolean object variable can be used like just “ative/desative” for that entire “behavior”.
@Lightstone_Legend , I think you can put all yours events about “Desk Space” like subevents of a event with the condition checking “boolean object variable is true”. Something like this:
Now you can switch to false when you no longer want your behavior to work and switch to true when you want to active it again.