If player is ON event, do X, else do Y

I thought this would be simple, but so far I didn't have any luck. I'm trying to do the following: A switch is set to on. If the player is not on a certain event when the event is set to on, this event will be erased. If the player is ON the event however, the player will die (or whatever). What is the simplest way to do this? It might be the friday-evening tiredness that is making my mind foggy... I'm using XP, but I think this is the same for all versions.
As happens so often, I found it soon after I posted... So here's the solution:

Have this running in the background to get the players coordinations:

onevent1.png


Then, when the switch is triggered, have this on your event:

onevent2.png


Hope this can help anyone else too.
Hi,

A nice solution, but I can't help but to leave a little comment on it:

Often, it is not necessary that a variable has the right value all the time. For example, if you only use the variable in that conditional branch, it would suffice to set the variable once right before that command.

By doing that you avoid a possible short delay (1/40 sec., depending on the actual execution order of the events) and reduce the impact of your code, as the rest of the variable updates were going to waste anyway.
You are correct. Will it still make a difference if there are like 50 of these events on a map? I'm changing it anyway.
You don't need to use two events for this.


In your second event, just get the player's X and Y positions into variables right before the conditional branch.


If you MUST put it into a parallel process event that's always running (you don't, but if you MUST) put a Wait 5 Frames at the start. You don't need to update the variables 60 times every second.


In fact - where is the switch being turned on that triggers the second event? You could just move all that logic into the event that turns that switch on, and don't worry about parallel process events at all.


I've moved this thread to VX Ace Support (this is not a Tech Support question). Please be sure to post your threads in the correct forum next time. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/if-player-is-on-event-do-x-else-do-y.38012/