MV Trigger a "Player Touch" event without the player touching it

I have an event (a light switch) which the player can turn on and off by touching it. I would also like for other characters to be able to toggle the switch. Is there a script call for triggering an event as if the player had touched it?

I saw something in the script call list:

JavaScript:
$gameMap.event(id)._trigger = x;
0 = Action, 1 = Player Touch, 2 = Event Touch, 3 = Autorun, 4 = Parallel

but I guess that's for something else, as it did nothing the way I used it. Thanks.
Hi!

You can use that script call to check how many events are on the same tile:

$gameMap.eventsXy(x,y)

It will return an array with the events on these coordinates. So, you can put it in a conditional:
$gameMap.eventsXy(8, 6).length > 1

If the length of this array is higher than 1, means that two or more events are on the same tile. So you just need to replace the arguments of the function with the coordinates of your light switch event.
@Eliaquim
Thanks, but I just meant that I was looking at the script call list and saw $gameMap.event(id)._trigger = x; and thought that maybe that could be used for what I'm trying to do, but obviously it can't. For this, I really just want to know if there is a script call for triggering a Player Touch event without the player having to actually touch it.
I know Yanfly has a plugin that lets you run a Player Touch event just by clicking on it, so I figured there's probably a method that lets you just run an event.
@HankB wrong start

what does the event do? because instead of triggering it, you should command the results directly.

if that event just switches a switch you can give that command elsewhere.
if the event is more complex, you can place it in a common event and call that CE from either the map event on triggering and from anywhere else
if neither of the options above fit, there are some other options but we would have to see that event to tell you how to change it.

because yes there are ways to trigger event pages by script, but that is not the best option in my opinion.
@Eliaquim
Thanks, but I just meant that I was looking at the script call list and saw $gameMap.event(id)._trigger = x; and thought that maybe that could be used for what I'm trying to do, but obviously it can't. For this, I really just want to know if there is a script call for triggering a Player Touch event without the player having to actually touch it.
I know Yanfly has a plugin that lets you run a Player Touch event just by clicking on it, so I figured there's probably a method that lets you just run an event.
I believe you could use:
$gameMap.event(ID).start()

To be safe, you can check if there are any event command already running and then call the command(Kind of like the code does when the player triggers an event):
if(!$gameMap.isEventRunning()) $gameMap.event(ID).start()

But I would not do that. I do prefer to follow the @Andar logic.
I believe you could use:
$gameMap.event(ID).start()

That works perfectly. Thanks!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/trigger-a-player-touch-event-without-the-player-touching-it.138825/