Use key on specific place while facing doors

RPGVeir

Veteran
Veteran
Joined
May 31, 2015
Messages
70
Reaction score
0
First Language
Polish
Primarily Uses
RMVXA
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.
 

RPGVeir

Veteran
Veteran
Joined
May 31, 2015
Messages
70
Reaction score
0
First Language
Polish
Primarily Uses
RMVXA
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.
 

Attachments

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
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.
 

RPGVeir

Veteran
Veteran
Joined
May 31, 2015
Messages
70
Reaction score
0
First Language
Polish
Primarily Uses
RMVXA
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?
 

RPGVeir

Veteran
Veteran
Joined
May 31, 2015
Messages
70
Reaction score
0
First Language
Polish
Primarily Uses
RMVXA
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. :D
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
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".
 

RPGVeir

Veteran
Veteran
Joined
May 31, 2015
Messages
70
Reaction score
0
First Language
Polish
Primarily Uses
RMVXA
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
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.
 

RPGVeir

Veteran
Veteran
Joined
May 31, 2015
Messages
70
Reaction score
0
First Language
Polish
Primarily Uses
RMVXA
Yeah. I had one idea for that that could work but I'm not expert and I'd like to know if something like this won't lag the game.
This solution works just fine

upload_2018-4-23_12-47-41.png
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
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.
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
90
Reaction score
34
First Language
Bulgarian
Primarily Uses
RMVXA
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).
 
Last edited:

RPGVeir

Veteran
Veteran
Joined
May 31, 2015
Messages
70
Reaction score
0
First Language
Polish
Primarily Uses
RMVXA
Andar thank You very much! This works like a charm now.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,543
Members
137,834
Latest member
EverNoir
Top