Need help with an item-using event

I'm currently making a puzzle game for a school project.
I got stuck in this "use-specific-item-to-proceed" process...
For example, let's say that the player has to use a key in front of a door.
My objectives are 1) assigning the right key to the door, 2) and showing a message if the player did not insert the right key and 3) making sure the key only works in front of the door (not making it able to use keys in the kitchen when I want to open the basement door or something.)
Ex) Player stands in front of a golden door and opens the item menu. Player uses a silver key. Message: Wrong key. The player opens the item menu. Player uses a golden key. The door opens. Player stands in front of a tree. The player opens the item menu and uses a golden key. Message: This is not the time to use that.
I've messed up with Select Items, Common Events and setting the player location as variables (doing this, however, did not allow my player character to move), but no luck. Could anyone guide me on how to achieve my goal/or inform me of a tool that allows me to do so? (I've found Yanfly's Advanced variable system, but it was not exactly what I wanted.)

I'm kinda new to this stuff + English is not my first language, so let me know if I made any mistakes. Thanks!
Try this first; I will be back at 9 p.m.

https://forums.rpgmakerweb.com/index.php?threads/give-item-to-event-gift-giving-system.78603/


If it is not work, I will be back.
Try this first; I will be back at 9 p.m.

https://forums.rpgmakerweb.com/index.php?threads/give-item-to-event-gift-giving-system.78603/


If it is not work, I will be back.


Thank you, I will definitely try that out!
you only need the regular map event for the door that is blocked - no common event needed, and neither do you need to check for player position.

when triggering the door event, you use a show text for "Please select key to open door", followed by a select key item command.
That command returns the ID of the selected item into the variable given.
So next is conditional branch, comparing the variable with the number of the key that should fit here. If yes, open and transfer - if not show text "wrong key".

That's it - nothing more, you just need to make sure that the player can find the key as an item for this to work.

If you need help with this, post a screenshot of the event where you tried to do this and we'll tell you what to change.
@afternoon700, I thought it is hard, but Andar's way is corrected. Here is visual. I tested.
Capture20.PNG
Capture27.PNG
I just realized that the "door" example that I mentioned was totally inappropriate for my case. I am terribly sorry...
The case is, I do not want the player to know that an event is a "door" of some sort.
Map004.png

This is what I want to achieve:

1. On standing on the red star, a message appears: "Looks like some sort of switch! But it can't be reached..."
2. The event ends without a select screen or anything. The player needs to open the menu, choose the item window, then use a "balloon."
2-1. Using other items than a balloon will print a text "No use."
2-2. If the player is not on the red star and the balloon is used, the text "This is not the time to use that." will be printed.
3. When the "balloon" is used on the red star, a key will be dropped.

Again, thank you for the tips (which were very useful in other parts of my project!) and sorry for the confusion I brought about.
@afternoon700, Please note that Key Count #1 can change to be any name.

Yes, 1. On standing on the red star, a message appears: "Looks like some sort of switch! But it can't be reached..."
Yes, 2. The event ends without a select screen or anything. The player needs to open the menu, choose the item window, then use a "balloon."
Yes 2-1. Using other items than a balloon will print a text "No use." Note: it is going to cost you a lot of common events to make each item respond saying "No use" when trying to use it.
No, 2-2. If the player is not on the red star and the balloon is used, the text "This is not the time to use that." will be printed. (I am not very good at a variable location yet sorry or you could try Yanfly Event Region Trigger plugin)😅
Yes, 3. When the "balloon" is used on the red star, a key will be dropped.

That is why Andar stopped you because it can turn into a complicated solution if you do not want to change your vision.
@afternoon700, Please note that Key Count #1 can change to be any name.

Yes, 1. On standing on the red star, a message appears: "Looks like some sort of switch! But it can't be reached..."
Yes, 2. The event ends without a select screen or anything. The player needs to open the menu, choose the item window, then use a "balloon."
Yes 2-1. Using other items than a balloon will print a text "No use." Note: it is going to cost you a lot of common events to make each item respond saying "No use" when trying to use it.
No, 2-2. If the player is not on the red star and the balloon is used, the text "This is not the time to use that." will be printed. (I am very good at a variable location yet sorry or you could try Yanfly Event Region Trigger plugin)😅
Yes, 3. When the "balloon" is used on the red star, a key will be dropped.

That is why Andar stopped you because it can turn into a complicated solution if you do not want to change your vision.


Huge thanks! You're a lifesaver!!
@afternoon700, no problem, if you do not like the simple way. 😂You could wait for others who have JavaScript knowledge to guide you in different ways which might be better than mine.
I just realized that the "door" example that I mentioned was totally inappropriate for my case. I am terribly sorry...
The case is, I do not want the player to know that an event is a "door" of some sort.
View attachment 116296
This is what I want to achieve:

1. On standing on the red star, a message appears: "Looks like some sort of switch! But it can't be reached..."
2. The event ends without a select screen or anything. The player needs to open the menu, choose the item window, then use a "balloon."
2-1. Using other items than a balloon will print a text "No use."
2-2. If the player is not on the red star and the balloon is used, the text "This is not the time to use that." will be printed.
3. When the "balloon" is used on the red star, a key will be dropped.

Again, thank you for the tips (which were very useful in other parts of my project!) and sorry for the confusion I brought about.

Could anyone help me achieve 2-2?
Could anyone help me achieve 2-2?

Okay, I finally did it with the help of UnPropro's Conditional Branch Assistant.
20190527002534_1.jpg
20190526231327_1.jpg

Just do this instead of using Yanfly's Region Trigger or Region Events. It works like a charm.
Okay, I finally did it with the help of UnPropro's Conditional Branch Assistant.View attachment 116334 View attachment 116335
Just do this instead of using Yanfly's Region Trigger or Region Events. It works like a charm.
Hello,
I also want to make a puzzle minigame and I like your solution with The Conditional Branch Assistant plugin, but I can't find it anywhere. Any suggestions for where to get it? 🙂
@Darniela I looked around and couldn't find a working version of the CBA plugin either. However, if all you need to do is see the Region ID that the player is standing on, and set a variable equal to it, use this Script call:

$gameVariables.setValue(variable_id, $gamePlayer.regionId());

Replace variable_id with the ID of the variable you want to set. Then, use that variable in a conditional branch to make sure that it's the Region ID you want to "fully activate" the item on.
@Darniela I looked around and couldn't find a working version of the CBA plugin either. However, if all you need to do is see the Region ID that the player is standing on, and set a variable equal to it, use this Script call:

$gameVariables.setValue(variable_id, $gamePlayer.regionId());

Replace variable_id with the ID of the variable you want to set. Then, use that variable in a conditional branch to make sure that it's the Region ID you want to "fully activate" the item on.
Thank you very much for your solution, I'll definitely try it out in my project! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-an-item-using-event.109369/