OverpassTile修正 OverpassTile Fix

插件简介:

在MV自带的Kadokawa插件里有一款叫OverpassTile.js的插件,该插件可以使指定区域id的图块变成可以双层行走的图块,即角色可以从桥上方行走,也可以从桥底下通过,从桥上不能直接下至地面,反之亦然。然而该脚本只提供了通行和遮挡的判定,还有些细节没有顾及。本插件在该插件基础之上进行了一些修正:

  • 被放置在overpass区域的事件或角色将被默认放在上层
  • 碰撞检测:不同层的事件和角色互不影响,同层的事件和角色的碰撞与原有优先度设置一致
  • 事件触发检测:角色不能触发不同层的事件,同层的事件触发与原有优先度设置一致
  • (可选)伤害地形及草丛效果不影响高层的角色

截图说明:

桥上的事件不会阻挡桥下的主角队,反之亦然,事件的移动路线也不会受到影响
OTF01.png

在桥上无法触发桥下的宝箱,但在桥下的同一图块则可以触发
OTF02.png
OTF03.png

桥上的角色不会受到毒沼的伤害(及草丛效果),而桥下依然会
OTF04.png

食用方法:

插件管理器安装,根据需求设置功能开关:

  • Disable Damage Floor:当为ON时,角色处于伤害地形的上层则不会受到伤害。默认OFF
  • Disable Bush Effect:当为ON时,角色处于草丛地形的上层则不会出现草丛效果。默认OFF

注意事项:

  • 本插件必须和OverpassTile.js共同使用
  • OverpassTile.js的层次判定方法为:角色或事件处于gateway区域则判定为上层,一旦进入非overpass区域则判定为下层
  • 事件触发和碰撞检测的修正只会作用在主角和事件处于不同的层级上,处于同层则与默认RM处理方式一致,请根据上面一条辨别角色和事件所在层次
  • 当事件处于gateway区域附近,会出现由于处在层级判定临界点而产生的穿透和无法触发事件的情况,请尽量避免这样的设置
  • 当启用伤害地形和草丛效果屏蔽功能时,只要角色处于上层,这两种效果就不会生效,处于下层依然会生效。因此无法做出上层的毒沼扣血这种效果

使用条款:

非商业·商业皆可,请credit AndrewX

更新履历:

Version 0.20:
  • 新增:【测试】增加对高层事件的优先级问题的修正
Version 0.10:
  • 完成插件原型

插件内容:

插件内容AndrewX_OverpassTileFix.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
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
//=============================================================================
// AndrewX - OverpassTileFix
// AndrewX_OverpassTileFix.js
//=============================================================================
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);
};
})();