Hello,
I want to learn how can I make "key system".
When I pick a key from my inventory and player is standing next to doors (while facing them), then he has to choose to either use key or not. I don't know how can I make such conditioning where player MUST face doors for item common event to activate.
I tried with event on player touch switch but it kinda failed. "Event that is in front of doors activates on player touch . If player is facing UP, then switch facing doors is on".
The problem is that when player stops facing doors or just goes elsewhere then switch "facing" is still on and player can use key anywhere while facing anything lol.
Please help, I'm noob.
This is how my item usage common events looks like for now. I want it to start only when player is facing right direction and standing next to doors.
Use the Conditional Branch and check the Player is Facing (in whatever direction). It's on tab 3 or 4.
Put all of your logic inside the conditional branch, so it only gets executed when the player is facing up, and nothing happens if they're facing any other direction.
Yes but then it will work no matter where he stands. He just has to "face up" what if i want it to work while facing up AND be next to the doors?
I mean.. if someone just clicks at key from inventory while facing up in middle of room then he will open doors while being meters away from them. 😀
Make it completely differently, by using an event with the "select key item" command on the door.
Make an event on the door itself, triggered by action button.
First command inside that item is "select key item", with a variable for storing the item ID.
That will bring up a window for the player to select between all key items in inventory.
The ID of the item selected will be stored in the variable used by the command.
Then follow it with a conditional branch checking if the ID is the correct key for that door, either opening it if yes or show text " that item doesn't fit here".
I'm using Luna Engine for custom looks on menus so I would rather not use "Select Key Item" options because it's opening in top screen with default window looks.
Then you'll need a series of conditional branches to eliminate all unwanted options (like the player standing in the wrong Position.
Or request a script to change the appearance of the select key item command.
No need for map events changing switches.
Use control variables in the common event to get the current player position (x/y) and then compared those numbers with the correct position for the key use.
One thing I can't figure. Why check for directions at all? Can't you make the very door with priority same as character,
and interact with the door directly instead some event under your feet? That how is guaranteed the player always would face it.
Then, you can make that door activate on player touch ( or action button, if you want the player to press enter), and if all criteria met(no need for direction check anymore, and in the case the player's x and y when you interact with the door won't change as well). Upon meeting all criterias, the door transfer the player and activate self switch to other page (so next time player won't need to use key again).
Andar thank You very much! This works like a charm now.