Alright so what I'm trying to do is this:
I'm trying to check an enemy's X,Y coordinates against the player's location without inserting said X,Y coordinates into variables of their own. I want them to react in a certain way when they're above the player, and since I'm using ABOVE priority AND I want either/or on Player or Enemy collision, I need to use a script to do that.
In my game the player's location is constantly tracked in Variables 5 and 6, so I can do it very easily in a conditional branch script like this, for example if the enemy is Event #4:
But the problem is I want multiple of these enemies on the same maps, without having to change that event number every time. I'm hoping to use Common Events so that I can easily modify all of them whenever I need to without going through to every single event.
I was under the impression that entering $gameMap.event(0) would return whatever event you put the script on, but I tried that on both the event itself and on a common event and both came back with the error saying they can't run X of undefined, so it's clearly not finding the event.
Isn't there a better version of "whatever this event's X is" that is flexible enough to apply through a common event?
I'm trying to check an enemy's X,Y coordinates against the player's location without inserting said X,Y coordinates into variables of their own. I want them to react in a certain way when they're above the player, and since I'm using ABOVE priority AND I want either/or on Player or Enemy collision, I need to use a script to do that.
In my game the player's location is constantly tracked in Variables 5 and 6, so I can do it very easily in a conditional branch script like this, for example if the enemy is Event #4:
($gameMap.event(4).x == $gameVariables.value(5)) && ($gameMap.event(4).y == $gameVariables.value(6));
But the problem is I want multiple of these enemies on the same maps, without having to change that event number every time. I'm hoping to use Common Events so that I can easily modify all of them whenever I need to without going through to every single event.
I was under the impression that entering $gameMap.event(0) would return whatever event you put the script on, but I tried that on both the event itself and on a common event and both came back with the error saying they can't run X of undefined, so it's clearly not finding the event.
Isn't there a better version of "whatever this event's X is" that is flexible enough to apply through a common event?