查看: 5459|回复: 5

[已经解决] mv有区域限制通行的插件吗?

[复制链接]
梦石
0
星屑
55
在线时间
461 小时
注册时间
2014-7-23
回帖
178
发表于 2015-11-17 15:19:57 | 显示全部楼层 |阅读模式

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

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

×
就像类似Ace那个一样的 填写上区域号就限制通行
@taroxd

点评

点错了 还没找到方法  发表于 2015-11-17 15:31

…あたしは天

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

开拓者贵宾

发表于 2015-11-17 15:21:56 | 显示全部楼层
照着 VA 那个脚本自己改改就是咯 本来就功能太简单,都懒得作为脚本发布

点评

我不会呀 有时间弄下呗  发表于 2015-11-18 11:46
回复

使用道具 举报

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

Orange - Region Collisions
[fold=Orange - Region Collisions]/*=============================================================================
* Orange - Region Collisions
* By Hudell - www.hudell.com
* OrangeRegionCollisions.js
* Version: 1.1
* Free for commercial and non commercial use.
*=============================================================================*/
/*:
* @plugindesc Allows the usage of regions to overwrite the passability configuration of tiles
* @author Hudell
*
* @param BlockRegionId
* @desc The ID of the region that should be used to block passage on a tile
* @default 0
*
* @param UnblockRegionId
* @desc The ID of the region that should be used to unblock passage on a tile
* @default 0
*
* @param BlockPlayerRegionId
* @desc The ID of the region that should be used to block passage of the player on a tile
* @default 0
*
* @param UnblockPlayerRegionId
* @desc The ID of the region that should be used to unblock passage of the player on a tile
* @default 0
*
* @param BlockEventRegionId
* @desc The ID of the region that should be used to block passage of events on a tile
* @default 0
*
* @param UnblockEventRegionId
* @desc The ID of the region that should be used to unblock passage of events on a tile
* @default 0
*
* @help
* ============================================================================
* Latest Version
* ============================================================================
*
* Get the latest version of this script on
* http://link.hudell.com/region-collisions
*
*=============================================================================*/
var Imported = Imported || {};
var OrangeRegionCollisions = OrangeRegionCollisions || {};

(function($) {
  "use strict";

  $.Parameters = PluginManager.parameters('OrangeRegionCollisions');
  $.Param = $.Param || {};

  $.Param.BlockRegionId = Number($.Parameters['BlockRegionId'] || 0);
  $.Param.UnblockRegionId = Number($.Parameters['UnblockRegionId'] || 0);
  $.Param.BlockPlayerRegionId = Number($.Parameters['BlockPlayerRegionId'] || 0);
  $.Param.UnblockPlayerRegionId = Number($.Parameters['UnblockPlayerRegionId'] || 0);
  $.Param.BlockEventRegionId = Number($.Parameters['BlockEventRegionId'] || 0);
  $.Param.UnblockEventRegionId = Number($.Parameters['UnblockEventRegionId'] || 0);

  var oldGame_Map_checkPassage = Game_Map.prototype.checkPassage;
  Game_Map.prototype.checkPassage = function(x, y, bit) {
    if ($.Param.BlockRegionId > 0 || $.Param.UnblockRegionId > 0) {
      var regionId = this.regionId(x, y);

      if (regionId > 0) {
        if ($.Param.BlockRegionId > 0 && regionId == $.Param.BlockRegionId) {
          return false;
        }

        if ($.Param.UnblockRegionId > 0 && regionId == $.Param.UnblockRegionId) {
          return true;
        }
      }
    }

    return oldGame_Map_checkPassage.call(this, x, y, bit);
  };

  var oldGameEvent_isMapPassable = Game_Event.prototype.isMapPassable;
  Game_Event.prototype.isMapPassable = function(x, y, d) {
    if ($.Param.BlockEventRegionId > 0 || $.Param.UnblockRegionId > 0) {
      var new_x = $gameMap.roundXWithDirection(x, d);
      var new_y = $gameMap.roundYWithDirection(y, d);
      var regionId = $gameMap.regionId(new_x, new_y);

      if (regionId > 0) {
        if ($.Param.BlockEventRegionId > 0 && regionId == $.Param.BlockEventRegionId) {
          return false;
        }

        if ($.Param.UnblockRegionId > 0 && regionId == $.Param.UnblockRegionId) {
          return true;
        }
      }
    }

    return oldGameEvent_isMapPassable.call(this, x, y, d);   
  };

  var oldGamePlayer_isMapPassable = Game_Player.prototype.isMapPassable;
  if (Imported["SuperOrangeMovement"] !== undefined) {
    var insignificantValue = 0.000001;

    $.runForAllPositions = function(x, y, callback) {
      var first_x = (x + this.hitboxXSize).floor();
      var last_x = (x + this.hitboxXSize + this.hitboxWidthSize - insignificantValue).floor();
      var first_y = (y + this.hitboxYSize).floor();
      var last_y = (y + this.hitboxYSize + this.hitboxHeightSize - insignificantValue).floor();

      for (var new_x = first_x; new_x <= last_x; new_x++) {
        for (var new_y = first_y; new_y <= last_y; new_y++) {
          var result = callback.call(this, new_x, new_y);

          if (result === true) return true;
          if (result === false) return false;
        }
      }

      return null;
    };


    $.checkPlayerRegionCollision = function(x, y) {
      var regionId = $gameMap.regionId(x, y);

      if (regionId > 0) {
        if ($.Param.BlockPlayerRegionId > 0 && regionId == $.Param.BlockPlayerRegionId) {
          return false;
        }

        if ($.Param.UnblockRegionId > 0 && regionId == $.Param.UnblockRegionId) {
          return true;
        }
      }

      return null;
    };

    Game_Player.prototype.isMapPassable = function(x, y, d) {
      if ($.Param.BlockPlayerRegionId > 0 || $.Param.UnblockRegionId > 0) {
        var new_x = $gameMap.roundFractionXWithDirection(x, d);
        var new_y = $gameMap.roundFractionYWithDirection(y, d);

        var result = $.runForAllPositions.call(this, new_x, new_y, $.checkPlayerRegionCollision);
        
        if (result === true) return true;
        if (result === false) return false;
      }

      return oldGamePlayer_isMapPassable.call(this, x, y, d);   
    };
  }
  else {
    Game_Player.prototype.isMapPassable = function(x, y, d) {
      if ($.Param.BlockPlayerRegionId > 0 || $.Param.UnblockRegionId > 0) {
        var new_x = $gameMap.roundXWithDirection(x, d);
        var new_y = $gameMap.roundYWithDirection(y, d);
        var regionId = $gameMap.regionId(new_x, new_y);

        if (regionId > 0) {
          if ($.Param.BlockPlayerRegionId > 0 && regionId == $.Param.BlockPlayerRegionId) {
            return false;
          }

          if ($.Param.UnblockRegionId > 0 && regionId == $.Param.UnblockRegionId) {
            return true;
          }
        }
      }

      return oldGamePlayer_isMapPassable.call(this, x, y, d);   
    };

  }

})(OrangeRegionCollisions);

// If MVCommons is imported, register the plugin with it's PluginManager.
if (Imported['MVCommons'] !== undefined) {
  PluginManager.register("OrangeRegionCollisions", "1.1.0", "Allows the usage of regions to overwrite the passability configuration of tiles", {
    email: "plugins@hudell.com",
    name: "Hudell",
    website: "http://www.hudell.com"
  }, "2015-10-21");
} else {
  Imported["OrangeRegionCollisions"] = true;
}
[/fold]

点评

插件怎么没反应啊  发表于 2015-11-18 12:00
设置了区域没用啊。。。。  发表于 2015-11-18 11:45
回复

使用道具 举报

梦石
0
星屑
676
在线时间
224 小时
注册时间
2006-12-7
回帖
780
发表于 2015-11-18 09:59:31 | 显示全部楼层
yanfly里面有

点评

哪个啊?  发表于 2015-11-18 11:53
回复

使用道具 举报

梦石
0
星屑
676
在线时间
224 小时
注册时间
2006-12-7
回帖
780
发表于 2015-11-18 11:59:43 | 显示全部楼层
yep_region restrictions
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-11-18 12:18:03 | 显示全部楼层
有效呀
canvas.png

点评

哎 还是不行 在行工程里也是,我找了另外一个 谢谢了  发表于 2015-11-19 12:09
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部