Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // ElevationFix.js
- //=============================================================================
- /*:
- * @plugindesc Allow interaction with events only on same level
- * @author Shaz
- *
- * @help This plugin has no plugin commands
- *
- * Add <elevation> as a comment to an event page, and you will only be
- * able to interact with that event when you are at the same height
- * (you will not be able to interact with it if there is a cliff edge
- * between you and the event, for example).
- */
- (function() {
- var _Game_Event_start = Game_Event.prototype.start;
- Game_Event.prototype.start = function() {
- var list = this.list();
- if (list && list.length > 1) {
- if (list.filter(function(cmd) {
- return (cmd.code === 108 || cmd.code === 408) && cmd.parameters[0].match(/<elevation>/);
- }).length > 0) {
- var px = $gamePlayer.x;
- var py = $gamePlayer.y;
- var x = this.x;
- var y = this.y;
- var d = px < x ? 4 : px > x ? 6 : py < y ? 8 : py > y ? 2 : px === x && py === y ? 10 : 0;
- if (!this.isMapPassable(x, y, d)) { return; }
- }
- _Game_Event_start.call(this);
- }
- }
- })();
Add Comment
Please, Sign In to add comment