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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
var AndrewX = AndrewX || {}; AndrewX.OTF = AndrewX.OTF || {};
* @plugindesc v0.20 Add collision & trigger check and initial layers for events when using OverpassTile.js and more. * @author AndrewX * * @param Disable Damage Floor * @desc While ON, character will not get damaged if they are on higher level of damage floor. (Default: OFF) * @default OFF * * @param Disable Bush Effect * @desc While ON, bush tile will not affect character on higher level. (Default: OFF) * @default OFF * * @help * ============================================================================ * Introduction and Instructions * ============================================================================ * The Kadokawa OverpassTile plugin does not support the collision judgment * modification between characters who are in different floors. This plugin * provides: * * If a character or event is initially placed on a overpass tile, it will * automatically be put on the top of the tile. * * Characters and events on different levels does not collide with each other. * * Character cannot trigger events in a different level. * * (Optional) Bush tile and damage floor will not affect character that on * higher level. * * * Note: * Make sure this plugin is used together with OverpassTile.js by Kadokawa. * * As defined in OverpassTile.js, if a character or event is in gateway * region, it is set on higher level. Once it enters a non-overpass region, * it is set to be on lower level. * * Event trigger level check fix will not work if the event and character are * on the same level. * * If an event is placed between edge of higher and lower level (i.e. around * the gateway tile), level collision check might go wrong. Please be careful * with this situation. * * If Disable Damage Floor and Disable Bush Effect functions are ON, for * overpass and gateway regions, damage floor and bush effort will ALWAYS be * ignored if the character is on higher level, and will still be valid if * character is on lower level. So you cannot make them affect character that * on higher level. * * ============================================================================ * Changelog * ============================================================================ * * Version 0.20: * Add: [Test] Fix higher level event priority issue * * Version 0.10: * - Finished prototype * * ============================================================================ * Term of Use * ============================================================================ * * Free for use in non-commercial or commercial RMMV projects * Please credit AndrewX * */
(function() {
var parameters = PluginManager.parameters('AndrewX_OverpassTileFix'); var disableDamage = parameters['Disable Damage Floor']; var disableBush = parameters['Disable Bush Effect']; AndrewX.OTF.isCollidedWithEvents = Game_CharacterBase.prototype.isCollidedWithEvents; Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y) { var events = $gameMap.eventsXyNt(x, y); var higher = this._higherLevel; return events.some(function(event) { if (!event.isNormalPriority()) { return false } if (event._higherLevel != higher) { return false; } return true; }); };
AndrewX.OTF.refreshBushDepth = Game_CharacterBase.prototype.refreshBushDepth; Game_CharacterBase.prototype.refreshBushDepth = function() { AndrewX.OTF.refreshBushDepth.call(this); if (this._higherLevel === undefined) { this._higherLevel = true; } if (disableBush.toUpperCase() === "ON" && this._higherLevel === true) { this._bushDepth = 0; } };
AndrewX.OTF.isCollidedWithPlayerCharacters = Game_Event.prototype.isCollidedWithPlayerCharacters; Game_Event.prototype.isCollidedWithPlayerCharacters = function(x, y) { if (this._higherLevel != $gamePlayer._higherLevel) { return false; } return AndrewX.OTF.isCollidedWithPlayerCharacters.call(this, x, y); };
AndrewX.OTF.startMapEvent = Game_Player.prototype.startMapEvent; 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) { if (event._higherLevel === $gamePlayer._higherLevel) { event.start(); } } }); } };
AndrewX.OTF.isOnDamageFloor = Game_Player.prototype.isOnDamageFloor; Game_Player.prototype.isOnDamageFloor = function() { if (disableDamage.toUpperCase() === "ON" && this._higherLevel === true) { return false; } return $gameMap.isDamageFloor(this.x, this.y) && !this.isInAirship(); };
AndrewX.OTF.screenZ = Game_CharacterBase.prototype.screenZ; Game_CharacterBase.prototype.screenZ = function() { if (this._higherLevel) { if (this._priorityType===0){ return 4; } else if (this._priorityType===2){ return 6; } return 5; } return AndrewX.OTF.screenZ.call(this); }; })();
|