@Andar
It's fairly complicated, but I'll go ahead and lay it out. I'm making a puzzle mini-game in which the player pushes different events around. Different events react differently to one another, depending on what kind of events they are. For example, if you push an apple next to a goat, the goat will eat the apple. If you push a torch next to a snake, the snake will move one space away from the torch. If you use a torch to push a snake next to a goat, the snake will bite and kill the goat. And so on.
I needed a way to have events trigger other events just be being next to them. I tried using
Galv's Puzzle Functions, but that didn't work for me because it only only triggers events that are above, below, left and right of the events, but not events in the 1,3,7,9 positions. Then I realized I could use
Galv's Map Projectiles to achieve the effect I wanted. Simply have each event firing transparent projectiles in all 8 directions and have them go just 1 space. You can set it so that when a projectile from a map event hits another map event, it triggers a common event, and you can tailor it for each map event. Cool.
This is where it gets a little complicated, because I'm also using Yanfly's
Self Switches and Variables plugin. What I wanted to do was have the common event simply turn on a Self Switch for the event that got hit by the projectile, but that doesn't work with Galv's plugin for some reason. I noticed that if I used the Set Movement Route > Switch On in the common event, and specified that it was for Event 3 (for example), then it worked fine. Of course if I just used "Control Switches : #0010 Self Sw Whatever = on" then it doesn't work. I figured I could use
Code:
$gameVariables.setValue(99, Number(this._eventId));
To get the event ID, and then use a script call for Set Movement Route, and specify the event ID there. After posting my original question, I realized that I could just use Yanfly's lunatic mode and use this in the common event:
Code:
this.setSelfSwitchValue(mapId, eventId, switchId, true)
So I guess I was kind of going around the world just to get to next door. I've been using RMMV for a while, I just don't know javascript. Also, I ain't got a
good brain.