This should do it for you - save into a .js file in your plugins folder - name doesn't matter. I'd suggest you put it very high in your plugin list, in case there are other plugins that alias these methods.
Your event trigger needs to be Event Touch (this means the event touches the player OR the player touches the event; Player Touch requires the player to initiate contact).
Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) {
if (!$gameMap.isEventRunning()) {
$gameMap.eventsXy(x, y).forEach(function(event) {
if (event.isTriggerIn(triggers) && event.isNormalPriority() === normal) {
event.setInitiator(1);
event.start();
}
});
}
};
Game_Event.prototype.setInitiator = function(value) {
this._initiator = value;
};
Game_Event.prototype.checkEventTriggerTouch = function(x, y) {
if (!$gameMap.isEventRunning()) {
if (this._trigger === 2 && $gamePlayer.pos(x, y)) {
if (!this.isJumping() && this.isNormalPriority()) {
this.setInitiator(2);
this.start();
}
}
}
};
Game_Event.prototype.checkEventTriggerAuto = function() {
if (this._trigger === 3) {
this.setInitiator(3);
this.start();
}
};
Then in your event command, you can do a conditional branch like this:
Code:
If Script: $gameMap.event(this._eventId)._initiator === 1
Comment: Player initiated the contact
Else
If Script: $gameMap.event(this._eventId)._initiator === 2
Comment: Event initiated the contact
End
End
and just add the relevant commands in place of the comments.
Let me know how you go with this. I haven't tested it, so there might be some typos or something (if you get an error, post a screenshot of the console). I don't think there will be an issue because we haven't pre-defined _initiator - if you do a test and it's not set, it will just be
undefined and your conditions should both evaluate to false.
If you have other plugins that alter the behaviour between the player and events, that could cause this to not work, or to not work in all situations. So they might need to be looked at as well.