-
Notifications
You must be signed in to change notification settings - Fork 0
/
bentelk_SpookyAction.js
33 lines (31 loc) · 1.3 KB
/
bentelk_SpookyAction.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*:
* @plugindesc Allows certain events to trigger when you're adjacent to them (see help for more info).
* @author Ben Hendel-Doying
*
* @help If the event's spritesheet's name contains the text "Aggro" anywhere,
* then it can be triggered from a tile away. For example, if the event is
* triggered via touch, then it will be triggered by touching an adjacent tile.
* The intention of this plugin was to allow for creatures that wander the map,
* and start fights simply by being near you, but it may serve other purposes
* as well.
*/
Game_Player.prototype.checkEventTriggerHere = function(triggers) {
if (this.canStartLocalEvents()) {
this.startMapEvent(this.x, this.y, triggers, false);
if (!$gameMap.isEventRunning()) {
var events = $gameMap.eventsXy(this.x - 1, this.y)
.concat($gameMap.eventsXy(this.x + 1, this.y))
.concat($gameMap.eventsXy(this.x, this.y - 1))
.concat($gameMap.eventsXy(this.x, this.y + 1))
;
events.some(function(event) {
if(event._characterName.contains('Aggro') && event.isTriggerIn(triggers)) {
event.start();
return true;
}
else
return false;
});
}
}
};