Eventing: A Puzzle Problem

Hey, everyone. I'm currently trying to wrap my brain around the eventing sequence for a particular puzzle, and I was wondering if you guys could help.


Basically, the puzzle involves the player standing at a "console" and remotely controlling an NPC in order to have that NPC reach a switch out of the player's reach (see screenshot #1). However, the catch is that the "console" doesn't function properly, and so the NPC moves in the opposite direction of the player's input -- left for right, up for down. The player must guide the NPC to a switch at the other end of a maze to progress.


I've done the puzzle itself through autorun-activated events that cause the NPC to move if the condition is met that the player pushes a particular direction (see screenshot #2).


What I'm stuck on is how to actually event the completion of the puzzle. I want to make it so that the puzzle disengages after the NPC reaches a certain location/tile, i.e. the switch. I tried to see if one of the options for a Conditional Branch was something like "Event is in [location]," but there's no such thing. How can I event this puzzle in such a way that the game recognizes where the NPC is, and ends the puzzle when the NPC reaches that specified location?


puzzle1.png


puzzle2.png
You could always set two variables equal to the event's current position, then use a conditional branch to check if it's in a certain position. So, something like:


Variable X = Event's Map X


Variable Y = Event's Map Y


If Variable X = X position


    If Variable Y = Y position


        Set switch to "turn off" event"


The variable can be set to such through the Game Data option in the variable's Operand section. There will be a Character option, and you can choose the event, then Map X and Map Y.
You could always set two variables equal to the event's current position, then use a conditional branch to check if it's in a certain position. So, something like:


Variable X = Event's Map X


Variable Y = Event's Map Y


If Variable X = X position


    If Variable Y = Y position


        Set switch to "turn off" event"


The variable can be set to such through the Game Data option in the variable's Operand section. There will be a Character option, and you can choose the event, then Map X and Map Y.



That does the trick! I didn't think to check variables for a location item. Thanks, mlogan. 

Original thread: https://forums.rpgmakerweb.com/threads/eventing-a-puzzle-problem.66341/