查看: 10540|回复: 14

[已经过期] MV要如何实现无限图层显示系统和63号区域不可通行?

[复制链接]
梦石
0
星屑
116
在线时间
101 小时
注册时间
2012-10-19
回帖
15
发表于 2016-5-5 21:58:25 | 显示全部楼层 |阅读模式

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

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

×
已经习惯用PS去画地图然后分类设置几号区域不可通行,这样做出来的地图会比较华丽。请问MV有这样的插件吗?并不懂代码_(:з」∠)_ 请见谅
w _(:з」∠)_=3
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-5-5 22:03:12 | 显示全部楼层
本帖最后由 tseyik 于 2016-8-30 11:49 编辑

2016/07/04
Ver1.3 公開
・イベントがリージョンを踏んだときにセルフスイッチを操作する機能を追加
・指定したリージョンのどこかへランダムに場所移動させる機能を追加
2016/04/11
Ver1.2 公開
・追加設定事件移動可能区域機能
2016/03/11
Ver1.1 公開
・その場で向き変更する機能を追加
2015/12/01
Ver1.0 公開

移動機能拡張
  1. //=============================================================================
  2. // TMVplugin - 移動機能拡張
  3. // 作者: tomoaky ([url]http://hikimoki.sakura.ne.jp/[/url])
  4. // Version: 1.3
  5. // 最終更新日: 2016/07/04
  6. //=============================================================================

  7. /*:
  8. * @plugindesc 壁衝突音やリージョンによる通行設定などの機能を追加します。
  9. *
  10. * @author tomoaky ([url]http://hikimoki.sakura.ne.jp/[/url])
  11. *
  12. * @param passableRegionId
  13. * @desc タイルに関係なく通行を可能にするリージョン番号
  14. * 初期値: 251
  15. * @default 251
  16. *
  17. * @param dontPassRegionId
  18. * @desc タイルに関係なく通行を不可にするリージョン番号
  19. * 初期値: 252
  20. * @default 252
  21. *
  22. * @param seKnockWall
  23. * @desc 壁衝突効果音
  24. * 初期値: <name:Blow1><volume:90><pitch:100>
  25. * @default <name:Blow1><volume:90><pitch:100>
  26. *
  27. * @param knockWallPan
  28. * @desc 壁衝突効果音の左右バランス
  29. * 初期値: 75
  30. * @default 75
  31. *
  32. * @param knockWallInterval
  33. * @desc 壁衝突効果音の再生間隔(フレーム数)
  34. * 初期値: 30
  35. * @default 30
  36. *
  37. * @param turnKeyCode
  38. * @desc その場で向き変更に使うキー
  39. * 初期値: 83
  40. * @default 83
  41. *
  42. * @param movableRegion1
  43. * @desc イベントの移動可能リージョンタイプ設定1番
  44. * 設定例: 1,2,3
  45. * @default
  46. *
  47. * @param movableRegion2
  48. * @desc イベントの移動可能リージョンタイプ設定2番
  49. * 設定例: 1,2,3
  50. * @default
  51. *
  52. * @param movableRegion3
  53. * @desc イベントの移動可能リージョンタイプ設定3番
  54. * 設定例: 1,2,3
  55. * @default
  56. *
  57. * @param movableRegion4
  58. * @desc イベントの移動可能リージョンタイプ設定4番
  59. * 設定例: 1,2,3
  60. * @default
  61. *
  62. * @param movableRegion5
  63. * @desc イベントの移動可能リージョンタイプ設定5番
  64. * 設定例: 1,2,3
  65. * @default
  66. *
  67. * @param movableRegion6
  68. * @desc イベントの移動可能リージョンタイプ設定6番
  69. * 設定例: 1,2,3
  70. * @default
  71. *
  72. * @param movableRegion7
  73. * @desc イベントの移動可能リージョンタイプ設定7番
  74. * 設定例: 1,2,3
  75. * @default
  76. *
  77. * @param movableRegion8
  78. * @desc イベントの移動可能リージョンタイプ設定8番
  79. * 設定例: 1,2,3
  80. * @default
  81. *
  82. * @param movableRegion9
  83. * @desc イベントの移動可能リージョンタイプ設定9番
  84. * 設定例: 1,2,3
  85. * @default
  86. *
  87. * @param movableRegion10
  88. * @desc イベントの移動可能リージョンタイプ設定10番
  89. * 設定例: 1,2,3
  90. * @default
  91. *
  92. * @help
  93. * 使い方:
  94. *   Sキーを押しながら方向キーを押すと、移動せずにプレイヤーの向きだけを
  95. *   変えることができます。マウス(タップ)操作の場合はプレイヤーがいる場所
  96. *   をクリックすることで、時計回りに90度回転します。
  97. *
  98. *   その場で移動せずに向きを変更する機能で使用するキーは turnKeyCode の値を
  99. *   変更することで設定できます。65 ならA、66 ならB、とアルファベットが
  100. *   順に並んでいます、XやZなど他の機能に割り当てられていないキーを設定して
  101. *   ください。
  102. *
  103. *   メモ欄タグを使って、イベントごとに移動可能なリージョンを変更できます。
  104. *   プラグインパラメータで移動可能リージョンタイプをカスタマイズしてから
  105. *   利用してください。
  106. *   たとえば movableRegion1 の値を 1,2,3 にして、イベントのメモ欄に
  107. *   <movableRegion:1> というタグを書いた場合、そのイベントはリージョンが
  108. *   1~3番の場所のみ移動できるようになります。
  109. *
  110. *
  111. * メモ欄タグ(イベント)
  112. *   <movableRegion:1>
  113. *     移動可能リージョンタイプを1番に設定する
  114. *
  115. *   <stepSwitchOnA:64>
  116. *     イベントが移動してリージョン64番を踏むとセルフスイッチAをオン
  117. *     A以外のセルフスイッチを使用する場合は stepSwitchOnB のようにして
  118. *     ください。
  119. *
  120. *   <stepSwitchOffB:65>
  121. *     イベントが移動してリージョン65番を踏むとセルフスイッチBをオフ
  122. *
  123. *
  124. * プラグインコマンド:
  125. *   regionLocate 3 20
  126. *     3番のイベントをリージョン20番が設定されている座標のどこかへ場所移動
  127. *     させます。
  128. *     イベント番号が 0 ならコマンドを実行したイベント自体、-1 ならプレイヤー
  129. *     を対象とします。
  130. *
  131. *
  132. */

  133. var Imported = Imported || {};
  134. Imported.TMMoveEx = true;

  135. (function() {

  136.   var parameters = PluginManager.parameters('TMMoveEx');
  137.   var passableRegionId  = +parameters['passableRegionId'];
  138.   var dontPassRegionId  = +parameters['dontPassRegionId'];
  139.   var knockWallInterval = +parameters['knockWallInterval'];
  140.   var knockWallPan      = +parameters['knockWallPan'];
  141.   var re = /<name:(.+?)><volume:(.+?)><pitch:(.+?)>/;
  142.   var match = re.exec(parameters['seKnockWall']);
  143.   if (match) {
  144.     var seKnockWall = {};
  145.     seKnockWall.name   = match[1];
  146.     seKnockWall.volume = +match[2];
  147.     seKnockWall.pitch  = +match[3];
  148.   } else {
  149.     var seKnockWall = {name:'Blow1', volume:90, pitch:100};
  150.   }
  151.   Input.keyMapper[+parameters['turnKeyCode']] = 'turn';
  152.   var movableRegionType = [];
  153.   for (var i = 1; i <= 10; i++) {
  154.     var key = 'movableRegion' + i;
  155.     movableRegionType[i] = parameters[key].split(',');
  156.   }

  157.   //-----------------------------------------------------------------------------
  158.   // Game_Map
  159.   //

  160.   var _Game_Map_checkPassage = Game_Map.prototype.checkPassage;
  161.   Game_Map.prototype.checkPassage = function(x, y, bit) {
  162.     var regionId = this.regionId(x, y);
  163.     if (regionId === passableRegionId) return true;
  164.     if (regionId === dontPassRegionId) return false;
  165.     return _Game_Map_checkPassage.call(this, x, y, bit);
  166.   };

  167.   Game_Map.prototype.regionPoints = function(regionId) {
  168.     var result = [];
  169.     for (var x = 0; x < this.width(); x++) {
  170.       for (var y = 0; y < this.height(); y++) {
  171.         if (this.regionId(x, y) === regionId &&
  172.             this.eventIdXy(x, y) === 0) {
  173.           result.push(new Point(x, y));
  174.         }
  175.       }
  176.     }
  177.     return result;
  178.   };
  179.   
  180.   Game_Map.prototype.regionPointRandom = function(regionId) {
  181.     var regionPoints = this.regionPoints(regionId);
  182.     if (regionPoints.length > 0) {
  183.       return regionPoints[Math.randomInt(regionPoints.length)];
  184.     }
  185.     return null;
  186.   };

  187.   //-----------------------------------------------------------------------------
  188.   // Game_Player
  189.   //

  190.   var _Game_Player_moveStraight = Game_Player.prototype.moveStraight;
  191.   Game_Player.prototype.moveStraight = function(d) {
  192.     _Game_Player_moveStraight.call(this, d);
  193.     if (!this.isMovementSucceeded()) {
  194.       var x2 = $gameMap.roundXWithDirection(this.x, d);
  195.       var y2 = $gameMap.roundYWithDirection(this.y, d);
  196.       if (this.isNormal() && ($gameMap.boat().pos(x2, y2) || $gameMap.ship().pos(x2, y2))) {
  197.         return;
  198.       }
  199.       if (this.isInVehicle() && this.vehicle().isLandOk(this.x, this.y, this.direction())) {
  200.         return;
  201.       }
  202.       var d2 = this.reverseDir(d);
  203.       if (!$gameMap.isPassable(this.x, this.y, d) || !$gameMap.isPassable(x2, y2, d2)) {
  204.         this._knockWallCount = this._knockWallCount === undefined ? 0 : this._knockWallCount;
  205.         if (this._knockWallCount + knockWallInterval <= Graphics.frameCount ||
  206.             this._lastKnockWallDir !== d) {
  207.           if (d === 4) {
  208.             seKnockWall.pan = -knockWallPan;
  209.           } else if (d === 6) {
  210.             seKnockWall.pan = knockWallPan;
  211.           } else {
  212.             seKnockWall.pan = 0;
  213.           }
  214.           AudioManager.playSe(seKnockWall);
  215.           this._knockWallCount = Graphics.frameCount;
  216.           this._lastKnockWallDir = d;
  217.         }
  218.       }
  219.     }
  220.   };

  221.   var _Game_Player_moveByInput = Game_Player.prototype.moveByInput;
  222.   Game_Player.prototype.moveByInput = function() {
  223.     if (!this.isMoving() && this.canMove()) {
  224.       var direction = this.getInputDirection();
  225.       if (Input.isPressed('turn') && direction > 0) {
  226.         this.setDirection(direction);
  227.         return;
  228.       }
  229.       if (TouchInput.isTriggered() && $gameTemp.isDestinationValid()) {
  230.         var x = $gameTemp.destinationX();
  231.         var y = $gameTemp.destinationY();
  232.         if (this.pos(x, y)) {
  233.           this.turnRight90();
  234.           return;
  235.         }
  236.       }
  237.     }
  238.     _Game_Player_moveByInput.call(this);
  239.   };

  240.   //-----------------------------------------------------------------------------
  241.   // Game_Event
  242.   //

  243.   var _Game_Event_isMapPassable = Game_Event.prototype.isMapPassable;
  244.   Game_Event.prototype.isMapPassable = function(x, y, d) {
  245.     var movableRegion = this.event().meta['movableRegion'];
  246.     if (movableRegion) {
  247.       var x2 = $gameMap.roundXWithDirection(x, d);
  248.       var y2 = $gameMap.roundYWithDirection(y, d);
  249.       var region = $gameMap.regionId(x2, y2);
  250.       return movableRegionType[+movableRegion].indexOf('' + region) >= 0;
  251.     } else {
  252.       return _Game_Event_isMapPassable.call(this, x, y, d);
  253.     }
  254.   };

  255.   var _Game_Event_moveStraight = Game_Event.prototype.moveStraight;
  256.   Game_Event.prototype.moveStraight = function(d) {
  257.     _Game_Event_moveStraight.call(this, d);
  258.     var keys = ['A', 'B', 'C', 'D'];
  259.     for (var i = 0; i < 4; i++) {
  260.       var a = keys[i];
  261.       if (this.event().meta['stepSwitchOn' + a] &&
  262.           this.regionId() === +this.event().meta['stepSwitchOn' + a]) {
  263.         var key = [$gameMap.mapId(), this.eventId(), a];
  264.         $gameSelfSwitches.setValue(key, true);
  265.       } else if (this.event().meta['stepSwitchOff' + a] &&
  266.           this.regionId() === +this.event().meta['stepSwitchOff' + a]) {
  267.         var key = [$gameMap.mapId(), this.eventId(), a];
  268.         $gameSelfSwitches.setValue(key, false);
  269.       }
  270.     }
  271.   };

  272.   //-----------------------------------------------------------------------------
  273.   // Game_Interpreter
  274.   //

  275.   var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  276.   Game_Interpreter.prototype.pluginCommand = function(command, args) {
  277.     _Game_Interpreter_pluginCommand.call(this, command, args);
  278.     if (command === 'regionLocate') {
  279.       var character = this.character(+args[0]);
  280.       if (character) {
  281.         var point = $gameMap.regionPointRandom(+args[1]);
  282.         if (point) {
  283.           character.locate(point.x, point.y);
  284.         }
  285.       }
  286.     }
  287.   };
  288.   
  289. })();

复制代码
回复

使用道具 举报

职业の水客

梦石
2
星屑
17082
在线时间
7500 小时
注册时间
2010-6-16
回帖
3466

极短27评委MZ评测员极短26评委开拓者

发表于 2016-5-5 22:04:12 | 显示全部楼层
游戏开发工具集,一站式AI生图+图片完美像素化及相关处理网站。
群爆炸重建后状态:论坛老人最多(只剩下了活跃的老人),技术力很强(依旧不变)的编程灌水群:901540785
专门讨论RM相关的Q群:56875149
PS:第一个群不是专门讨论RM的,第二个才是哦。
PS2:接受MV/MZ插件定制(QQ763992443)
回复

使用道具 举报

梦石
0
星屑
116
在线时间
101 小时
注册时间
2012-10-19
回帖
15
 楼主| 发表于 2016-5-6 21:34:18 | 显示全部楼层
tseyik 发表于 2016-5-5 22:03
2016/04/11
Ver1.2 公開
・イベントごとに移動可能リージョンを設定する機能を追加

这个没有太看懂,移动机能扩张是指设置区域通行度吗?
w _(:з」∠)_=3
回复

使用道具 举报

梦石
0
星屑
116
在线时间
101 小时
注册时间
2012-10-19
回帖
15
 楼主| 发表于 2016-5-6 21:36:05 | 显示全部楼层
寂静的夜里 发表于 2016-5-5 22:04
https://rpg.blue/forum.php?mod=viewthread&tid=384577&extra=page%3D2%26filter%3Dtypeid%26typeid%3D ...

非常谢谢,这个很有帮助:)
w _(:з」∠)_=3
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-5-6 22:17:53 | 显示全部楼层
凌霄L 发表于 2016-5-6 21:34
这个没有太看懂,移动机能扩张是指设置区域通行度吗?

* @desc タイルに関係なく通行を可能にするリージョン番号(強制通行可能)
* 初期値: 251
* @default 251
*
* @param dontPassRegionId
* @desc タイルに関係なく通行を不可にするリージョン番号(強制通行不可)
* 初期値: 252
* @default 252
回复

使用道具 举报

梦石
0
星屑
116
在线时间
101 小时
注册时间
2012-10-19
回帖
15
 楼主| 发表于 2016-5-6 22:53:34 | 显示全部楼层
tseyik 发表于 2016-5-6 22:17
* @desc タイルに関係なく通行を可能にするリージョン番号(強制通行可能)
* 初期値: 251
* @default 2 ...

也就是说只要在事件里设置初期值为通行不可就可以运用了吗,但是怎么设置为几号区域不可通行呢?对代码完全不懂,非常抱歉_(:з」∠)_,麻烦你了

点评

不是事件,是在挿件管理器中設,予設区域251為強制通行,区域252為強制不通行  发表于 2016-5-6 22:58
w _(:з」∠)_=3
回复

使用道具 举报

梦石
0
星屑
116
在线时间
101 小时
注册时间
2012-10-19
回帖
15
 楼主| 发表于 2016-5-6 23:25:11 | 显示全部楼层
tseyik 发表于 2016-5-6 22:17
* @desc タイルに関係なく通行を可能にするリージョン番号(強制通行可能)
* 初期値: 251
* @default 2 ...

在插件管理器里设置开启后并没有运用起来,预设和更改预设后都没有作用_(:з」∠)_ 是还需要什么条件吗
w _(:з」∠)_=3
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-5-7 14:11:22 | 显示全部楼层
凌霄L 发表于 2016-5-6 23:25
在插件管理器里设置开启后并没有运用起来,预设和更改预设后都没有作用_(:з」∠)_ 是还需要什么条件吗 ...

可以呀
Image004.png
Image001.png
Image002.png
Image003.png
回复

使用道具 举报

梦石
0
星屑
116
在线时间
101 小时
注册时间
2012-10-19
回帖
15
 楼主| 发表于 2016-5-16 17:57:49 | 显示全部楼层
tseyik 发表于 2016-5-7 14:11
可以呀

谢谢,现在才看到对不起! 我重新开了一个新档发现是可以用,以前用的那个文件和无限图层显示系统的那个js有冲突,稍微有点困扰_(:з」∠)_,那个不可走的图层走过去就会有音效这是怎么回事???能消除声音吗?  真是麻烦你了(土下座

点评

<volume:90>改成<volume:0>就聴不到了  发表于 2016-5-16 19:24
w _(:з」∠)_=3
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部