查看: 7205|回复: 9

[原创发布] 【自用·测试】OverpassTile修正

[复制链接]
梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
发表于 2015-12-12 23:50:22 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 andrewx 于 2015-12-13 09:30 编辑

在MV自带的Kadokawa插件里有一款叫OverpassTile.js的插件,该插件可以使指定区域id的图块变成可以双层行走的图块,即角色可以从桥上方行走,也可以从桥底下通过,从桥上不能直接下至地面,反之亦然。
然而该脚本只提供了通行和遮挡的判定,还有些细节没有顾及。本插件在该插件基础之上进行了如下修正:
- 被放置在overpass区域的事件或角色将被默认放在上层
- 碰撞检测:不同层的事件和角色互不影响,同层的事件和角色的碰撞与原有优先度设置一致
- 事件触发检测:角色不能触发不同层的事件,同层的事件触发与原有优先度设置一致
- (可选)伤害地形及草丛效果不影响高层的角色


截图说明:
桥上的事件不会阻挡桥下的主角队,反之亦然,事件的移动路线也不会受到影响
fix0.PNG

在桥上无法触发桥下的宝箱,但在桥下的同一图块则可以触发
fix1.PNG
fix2.PNG

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


食用方法:
插件管理器安装,根据需求设置功能开关:
- Disable Damage Floor:当为ON时,角色处于伤害地形的上层则不会受到伤害。默认OFF
- Disable Bush Effect:当为ON时,角色处于草丛地形的上层则不会出现草丛效果。默认OFF


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

插件内容:
Ver 0.10

  1. //=============================================================================
  2. // AndrewX - OverpassTileFix
  3. // AndrewX_OverpassTileFix.js
  4. //=============================================================================
  5. var AndrewX = AndrewX || {};
  6. AndrewX.OTF = AndrewX.OTF || {};
  7. //=============================================================================
  8. /*:
  9. * @plugindesc v0.10 Add collision & trigger check and initial layers for events when using OverpassTile.js and more.
  10. * @author AndrewX
  11. *
  12. * @param Disable Damage Floor
  13. * @desc While ON, character will not get damaged if they are on higher level of damage floor. (Default: OFF)
  14. * @default OFF
  15. *
  16. * @param Disable Bush Effect
  17. * @desc While ON, bush tile will not affect character on higher level. (Default: OFF)
  18. * @default OFF
  19. *
  20. * @help
  21. * ============================================================================
  22. * Introduction and Instructions
  23. * ============================================================================
  24. * The Kadokawa OverpassTile plugin does not support the collision judgment
  25. * modification between characters who are in different floors. This plugin
  26. * provides:
  27. *
  28. * If a character or event is initially placed on a overpass tile, it will
  29. * automatically be put on the top of the tile.
  30. *
  31. * Characters and events on different levels does not collide with each other.
  32. *
  33. * Character cannot trigger events in a different level.
  34. *
  35. * (Optional) Bush tile and damage floor will not affect character that on
  36. * higher level.
  37. *
  38. *
  39. * Note:
  40. * Make sure this plugin is used together with OverpassTile.js by Kadokawa.
  41. *
  42. * As defined in OverpassTile.js, if a character or event is in gateway
  43. * region, it is set on higher level. Once it enters a non-overpass region,
  44. * it is set to be on lower level.
  45. *
  46. * Event trigger level check fix will not work if the event and character are
  47. * on the same level.
  48. *
  49. * If an event is placed between edge of higher and lower level (i.e. around
  50. * the gateway tile), level collision check might go wrong. Please be careful
  51. * with this situation.
  52. *
  53. * If Disable Damage Floor and Disable Bush Effect functions are ON, for
  54. * overpass and gateway regions, damage floor and bush effort will ALWAYS be
  55. * ignored if the character is on higher level, and will still be valid if
  56. * character is on lower level. So you cannot make them affect character that
  57. * on higher level.
  58. *
  59. * ============================================================================
  60. * Changelog
  61. * ============================================================================
  62. *
  63. * Version 0.10:
  64. * - Finished prototype
  65. *
  66. * ============================================================================
  67. * Term of Use
  68. * ============================================================================
  69. *
  70. * Free for use in non-commercial or commercial RMMV projects
  71. * Please credit AndrewX
  72. *
  73. */
  74. //=============================================================================

  75. (function() {

  76.         var parameters = PluginManager.parameters('AndrewX_OverpassTileFix');
  77.         var disableDamage = parameters['Disable Damage Floor'];
  78.         var disableBush = parameters['Disable Bush Effect'];

  79.         AndrewX.OTF.isCollidedWithEvents = Game_CharacterBase.prototype.isCollidedWithEvents;
  80.         Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y) {
  81.                 var events = $gameMap.eventsXyNt(x, y);
  82.                 var higher = this._higherLevel;
  83.                 return events.some(function(event) {
  84.                         if (!event.isNormalPriority()) {
  85.                                 return false
  86.                         }
  87.                         if (event._higherLevel != higher) {
  88.                                 return false;
  89.                         }
  90.                         return true;
  91.                 });
  92.         };

  93.         AndrewX.OTF.refreshBushDepth = Game_CharacterBase.prototype.refreshBushDepth;
  94.         Game_CharacterBase.prototype.refreshBushDepth = function() {
  95.                 AndrewX.OTF.refreshBushDepth.call(this);
  96.                 if (this._higherLevel === undefined) {
  97.                         this._higherLevel = true;
  98.                 }
  99.                 if (disableBush === "ON" && this._higherLevel === true) {
  100.                         this._bushDepth = 0;
  101.                 }
  102.         };

  103.         AndrewX.OTF.isCollidedWithPlayerCharacters = Game_Event.prototype.isCollidedWithPlayerCharacters;
  104.         Game_Event.prototype.isCollidedWithPlayerCharacters = function(x, y) {
  105.                 if (this._higherLevel != $gamePlayer._higherLevel) {
  106.                         return false;
  107.                 }
  108.                 return AndrewX.OTF.isCollidedWithPlayerCharacters.call(this, x, y);
  109.         };

  110.         AndrewX.OTF.startMapEvent = Game_Player.prototype.startMapEvent;
  111.         Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) {
  112.                 if (!$gameMap.isEventRunning()) {
  113.                         $gameMap.eventsXy(x, y).forEach(function(event) {
  114.                                 if (event.isTriggerIn(triggers) && event.isNormalPriority() === normal) {
  115.                                         if (event._higherLevel === $gamePlayer._higherLevel) {
  116.                                                 event.start();
  117.                                         }
  118.                                 }
  119.                         });
  120.                 }
  121.         };

  122.         AndrewX.OTF.isOnDamageFloor = Game_Player.prototype.isOnDamageFloor;
  123.         Game_Player.prototype.isOnDamageFloor = function() {
  124.                 if (disableDamage === "ON" && this._higherLevel === true) {
  125.                         return false;
  126.                 }
  127.                 return $gameMap.isDamageFloor(this.x, this.y) && !this.isInAirship();
  128.         };

  129. })();
复制代码

评分

参与人数 2梦石 +1 赞 +1 收起 理由
sweetcrazy + 1 精品文章
余烬之中 + 1 精品文章

查看全部评分

…あたしは天

梦石
0
星屑
2311
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2015-12-13 06:21:17 | 显示全部楼层
有顶层变量的时候,还是拿个匿名函数包起来吧……
回复

使用道具 举报

梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
 楼主| 发表于 2015-12-13 09:32:02 | 显示全部楼层
taroxd 发表于 2015-12-13 06:21
有顶层变量的时候,还是拿个匿名函数包起来吧……

已经修改,感谢指正!
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-12-13 16:52:59 | 显示全部楼层
本帖最后由 tseyik 于 2015-12-13 17:02 编辑

- 当启用伤害地形和草丛效果屏蔽功能时,只要角色处于上层,这两种效果就不会生效,处于下层依然会生效。因此无法做出上层的毒沼扣血这种效果
可否加上指令,可在遊戲中啓用/関閉「伤害地形和草丛效果屏蔽功能」
可指定某開関;開関on就啓用/off就関閉
這就可在上层使用伤害地形和草丛效果
回复

使用道具 举报

梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
 楼主| 发表于 2015-12-13 19:09:19 | 显示全部楼层
tseyik 发表于 2015-12-13 16:52
- 当启用伤害地形和草丛效果屏蔽功能时,只要角色处于上层,这两种效果就不会生效,处于下层依然会生效。因 ...

是可以这样做,但是我实在想不出来这样的应用场景。因为一般伤害地形都是A类图块,属于地面,桥梁图块则是B~E类。难道你需要上层扣血下层反而不扣血这样的情况?

目前这个插件并没有完全屏蔽扣血和草丛效果,对于没有使用OverpassTile插件里两个ID的区域,这两个效果都是不受影响的
回复

使用道具 举报

梦石
0
星屑
50
在线时间
27 小时
注册时间
2014-7-31
回帖
22
发表于 2015-12-14 10:56:24 | 显示全部楼层
楼主真是专注于2D画面3维化30年呀,好顶赞!!
回复

使用道具 举报

梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
 楼主| 发表于 2015-12-14 11:09:51 | 显示全部楼层
七尾夜行 发表于 2015-12-14 10:56
楼主真是专注于2D画面3维化30年呀,好顶赞!!

我只是想回到RMXP的三层地图的辉煌年代。真不理解VX之后地图怎么就走上了这么一条简化道路,只能尝试自己动手丰衣足食了ORZ

评分

参与人数 1星屑 +45 收起 理由
orzfly + 45

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
27 小时
注册时间
2014-7-31
回帖
22
发表于 2015-12-14 14:48:51 | 显示全部楼层
andrewx 发表于 2015-12-14 11:09
我只是想回到RMXP的三层地图的辉煌年代。真不理解VX之后地图怎么就走上了这么一条简化道路,只能尝试自己 ...

也许开发方是希望我们重内容吧。。。。。

点评

当然算...我就是地图党  发表于 2015-12-15 10:49
难道你认为地图不算是内容?  发表于 2015-12-14 15:34
回复

使用道具 举报

梦石
0
星屑
55
在线时间
112 小时
注册时间
2008-12-9
回帖
133
发表于 2017-3-29 12:05:09 | 显示全部楼层
挖个坟终于找到楼主了,感谢你的插件!
回复

使用道具 举报

梦石
0
星屑
2814
在线时间
616 小时
注册时间
2018-1-17
回帖
1230
发表于 2018-3-15 00:01:27 | 显示全部楼层
二段挖坟,我的想法也和楼上一样 这个帖非常好
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部