Key Item Event like The Witch House's

I wonder is there any simpler method of key item event like The Witch House? I found the script but it's only for RMVX Ace and I'm trying to do it with eventing. I did it but it's only working with normal switches ("Key" is connected to common event, terrain tag and switches) However, I can only for specific key only.

My question is what if this key item can unlock common locked chest? not only specific?

Thank you!🙏 sorry if I explained it weird
I'm not sure I understood it, but
I'm almost 100% sure it's possible.
I'm not sure I understood it, but
I'm almost 100% sure it's possible.
Could you explain how to do it? :LZSblush:
So you want a key item to always unlock a certain door, chest, or so on? I am not too familiar with the Witch's House.
Please show your event and your common event so we can see what you've got so far. And explain how you have your terrain tag set up and what you're doing with it.

If your common event is not being called from the item, then you'll need to identify what event you're standing in front of (if any), then determine if it's the right type of event, can be unlocked (is the right type of chest, hasn't been unlocked already), and then use a script call to turn on that event's self switch - this will get you away from a common switch and allow you to use the same common event on multiple map events.

Generally, you should try to explain the mechanic you're trying to achieve. Saying "like game XYZ" means only those who have played it will know what you're talking about, which reduces the number of people who can assist.
So you want a key item to always unlock a certain door, chest, or so on? I am not too familiar with the Witch's House.
Yes, without conditional branch if "key" is in inventory only but we need to inventory first and choose "key item"

Please show your event and your common event so we can see what you've got so far. And explain how you have your terrain tag set up and what you're doing with it.

If your common event is not being called from the item, then you'll need to identify what event you're standing in front of (if any), then determine if it's the right type of event, can be unlocked (is the right type of chest, hasn't been unlocked already), and then use a script call to turn on that event's self switch - this will get you away from a common switch and allow you to use the same common event on multiple map events.

Generally, you should try to explain the mechanic you're trying to achieve. Saying "like game XYZ" means only those who have played it will know what you're talking about, which reduces the number of people who can assist.

Sorry! Okay.
Spoiler
First I add terrain tag to blank tile, for example here:
1596254212452.png

and then put it this blank tile with terrain tag to map in front of the door (in layer 2 and 3)
1596254322976.png


Door event for first tab, so when you have no key at all, this message shows
1596254467516.png


so I made this common event and linked it to Key Item
1596254645389.png

1596254697039.png

You should open inventory and choose "Door Key" to open the door (in front of the door) Thanks to terrain tag help

and then door can be opened now
1596255002191.png


my question is explained above, what if I want to do with common door/chest, not only spesific door?

Thank you!
Okay, this is good. You didn't say what your Door common event is - is it just doing the SE and move route so the door opens, or are you checking that switch for some reason?

It's been a long time since I used XP. To do it the way I said, you'd need to do a bit of complex scripting, and IIRC XP doesn't have a big script window. So the method I'm giving you below turns on a switch, makes EVERY door on the current map check to see if the player is standing in front and facing it, then turns off the switch again. If there is a door that meets the requirements, it will open itself and turn on its own self switch. This means you don't need to use a global switch, and you don't need to use terrain tags.


Make your common event look like this (of course use whatever variables you have available, and name them accordingly:
Code:
Control Variables: [0001: Player X] = Player's Map X
Control Variables: [0002: Player Y] = Player's Map Y
Control Switches: [0002: Key Used] = OFF
Control Switches: [0001: All Events Check for Key] = ON
Wait: 10 frames
Control Switches: [0001: All Events Check for Key] = OFF
Conditional Branch: Switch [0002: Key Used] = OFF
  Text: It's a Key
End

That's it - it stores the player's location into variables, tells all events to check if they're "the one", and turns off the switch again. 10 frames is probably generous - you could reduce this if you don't have your maps flooded with events.

Now on your door event, create another page in between the existing two (so page 1 says you need a key, page 2 is the new one, and page 3 has self switch A on rather than the switch you're using now):
Code:
Conditional Branch: Script: $game_variables[1] == get_character(0).x
  Conditional Branch: Script: $game_variables[2] == get_character(0).y + 1
    Conditional Branch: Player is facing Up
      Play SE
      Change Items: Door Key - 1
      Control Switches: [0002: Key Used] = ON
      Control Self Switch: A = ON
      Text: Opened
    Else
      Text: It's a Key
    End
  End
End
Set it to Parallel Process, and condition it by Switch [0001: All Events Check for Key].

So what we're doing here is making each event check the player's location in relation to itself (get_character(0).x is "this event's" X position, and get_character(0).y + 1 is one tile below "this event"), see if the player is facing the right direction, and if so, unlocking the door.

If the door is facing a different direction and the player needs to be facing a direction other than Up, you'll change those 3 conditional branches to specify what tile the player should be on and what direction they should be facing. If you have this and you run into trouble, post a screenshot of your map showing where things are, and I'll walk you through that example.

Now you can copy and paste this event all over the place, onto the same map or onto different maps, and as long as you have a key, whatever door you're standing in front of and facing, will open.

Switch 2 is just an extra that gets turned on if a door event is found, so if it's still off by the time the common event's wait is finished, it knows no door was opened, so the player probably wasn't standing in front of one, and you can just display that message again.
That "door" common event is just playing the SE and move route. My fault :'D
Anyway, I already tried it anything you've explained and it's working perfectly. I can do key for all door/chest :LZSjoy::LZSjoy::LZSjoy:

Thank you so much, Shaz!!! ;_;

Original thread: https://forums.rpgmakerweb.com/threads/key-item-event-like-the-witch-houses.124774/