Help with Common Event

I am trying to make a common event that is called when the player is trying to open a locked door.

The idea is for the event that is locked to store the variables of the map ID and the event ID, then call the common event "Open Lock."

Control Variables: [0041:lock - map id] = Map IDControl Variables: [0042:lock - event id] = event_idCall Common Event: [Open Lock]The event would first check to make sure that the actor that has the lockpicking skill is in the front of the party...

@>Conditional Branch: Script: $game_party.members[0].id == 71 ...otherwise spitting out a generic "it's locked" message.

If the correct actor is in the lead, a script call would use the stored variables for map ID and event ID to change the self switch of the locked event to "D."

$game_self_switches[[[$game_variables[41]], [$game_variables[42]], "D"]] = trueThe locked event's self switch D would contain the loot if a chest, or simply a blank page if it was a door.

I have this all written in, but for some reason it's not working. I created an NPC to spit out the variables in text form to see if they were being set properly, and they were. This leads me to believe that I am not using the correct script call to set the self switch.

Any thoughts?
I have split this out from the Script Call thread, because it's possibly going to require some screenshots and back and forth and really deserves its own thread

You've got a lot of brackets there that aren't necessary.

Also, if you're using a Script call to do the self switch, you don't even need to use variables.  So you can do away with those altogether, and just use the following in your script call:

$game_self_switches[[@map_id, @event_id, 'D']] = true
If that doesn't work, can you provide a screenshot of the following:

- your event where it's calling the common event

- the common event

- your event where it's calling the common event, but the tab with self switch D as a condition

Make sure you include the whole event window in those, because the triggers and conditions are important for us to see as well.
Okay, that worked perfectly. I guess I was overthinking it - I figured since I was calling a common event, it wouldn't know the map ID and event ID, and I would have to put them into variables to get the common event to recognize it.

Thank you!
Common events know where they're called from, and behave as if they are actually part of the calling event.  They're nice in that way 🙂

Original thread: https://forums.rpgmakerweb.com/threads/help-with-common-event.45116/