查看: 4335|回复: 2

[已经解决] 求MV的63号不可通行脚本。

[复制链接]
梦石
0
星屑
50
在线时间
47 小时
注册时间
2015-12-3
回帖
46
发表于 2015-12-11 22:09:20 | 显示全部楼层 |阅读模式

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

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

×
{:2_275:} 求大神给个类似其他RM的63号不可通行脚本,当然,MV貌似可以设置成255
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-12-12 09:27:50 | 显示全部楼层
[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]

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 认可答案

查看全部评分

回复

使用道具 举报

…あたしは天

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

开拓者贵宾

发表于 2015-12-12 09:42:46 | 显示全部楼层
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部