查看: 21661|回复: 30

[已经解决] 雪流星+杂兵天下+VIPArcher负重脚本,能否给每个角色变量?

[复制链接]
梦石
0
星屑
640
在线时间
888 小时
注册时间
2007-4-3
回帖
53
发表于 2020-3-29 09:12:42 | 显示全部楼层 |阅读模式
悬赏50星屑已解决
本帖最后由 xyzgwx 于 2020-4-10 00:21 编辑

https://rpg.blue/thread-369608-1-1.html
这个集合众多高手的脚本



能否改为给每个角色独立负重,队伍里只要有一个角色已装备的物品超过这个角色的负重,队伍就不能移动?

原有的那个变量,还是用来控制全部物品总重(包括所有角色已装备的物品),超过也不能移动?

最佳答案

查看完整内容

满负重是否可移动在61行可以设置 false为不可移动 true为可移动 根据LZ的需求默认已改为false了哦 角色有初始装备的情况下 需要手动在初始化事件里写入current_load(对应装备总重量) 才可使背包的装备负重正常获取 增添新角色时如果自带初始装备也需要使用这个脚本手动添加哦
梦石
3
星屑
7336
在线时间
608 小时
注册时间
2019-9-15
回帖
112

R考场第七期金奖

发表于 2020-3-29 09:12:43 | 显示全部楼层
本帖最后由 Cupidk爱呗茶 于 2020-4-7 16:59 编辑

满负重是否可移动在61行可以设置 false为不可移动 true为可移动 根据LZ的需求默认已改为false了哦
角色有初始装备的情况下 需要手动在初始化事件里写入current_load(对应装备总重量) 才可使背包的装备负重正常获取
增添新角色时如果自带初始装备也需要使用这个脚本手动添加哦

评分

参与人数 1赞 +1 收起 理由
xyzgwx + 1 塞糖

查看全部评分

********
回复

使用道具 举报

梦石
3
星屑
7336
在线时间
608 小时
注册时间
2019-9-15
回帖
112

R考场第七期金奖

发表于 2020-4-3 20:04:37 | 显示全部楼层
本帖最后由 Cupidk爱呗茶 于 2020-4-29 02:32 编辑

根据楼主的需要稍微小改了一下 不知道能不能满足需求的说 【有问题的话可以联系我更正哦
版本更新啦 根据LZ需求添加了物品超重自动显示与装备负重加成【

2020.4.3版本[pre lang="ruby" line="1"]#==============================================================================
# +++ VX移植 - VA负重系统改进版 +++
#==============================================================================
# VX版 原作者 By 雪流星
# 蓝本 杂兵天下的VA移植版
# 改进 By:VIPArcher
#  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
# 二次小改 By:小茶司令(爱呗茶)2020.4.3
#==============================================================================
# 就是在物品画面的右上角放了一个显示负重的窗口
# 更新了代码,取消的原来的计算每个队员的负重然后累加的模式 2014-12-10
# 增加了商店界面的负重显示     2014-9-3
#==============================================================================
#
# 物品备注<load N> 则该物品占用 N 点负重
# load也可以写成「负重」或「負重」#注:没有“「」”不写的话默认为 Default_Load
# 更改当前负重 current_load(x[,assign])
# 其中 x 为数值可以为负数,assign 为 true 时当前负重直接赋值为x(可省略)
# 例如:current_load(10,true) 当前负重直接赋值为10
# 默认给物品增加一行说明.说明内容是物品的重量.
# 但默认帮助窗口一共只能显示2行内容.
# 因此你在数据库设置武器、护甲说明的时候.
# 如果设置了2行内容.那么这新增加的第3行将无法显示出来.
# 特别地,如果你使用了我的【技能物品说明增强】脚本,请将其置于该脚本以上的位置
# 2020.4.3 增加内容:
# 1.每名角色的独立装备负重
# 2.队伍中若有一名以上角色装备负重超过上限则进行超重处理
# 3.装备超重提示
# 4.添加若干常量设置
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:load] = 20140919
#==============================================================================
# ★ 设定部分 ★
#==============================================================================
module  VIPArcher end
module  VIPArcher::Load
  Default_Load = 1    #物品的默认负重
  Default_Equip = 40  #每名角色默认装备重量上限 ###########################
#若不想使用默认负重则需数据库角色备注里添加文本 例: <负重 50>
  
  Width = 150         #负重信息窗口宽度
  
  Load_Name = "负重:" #负重前显示的文字
  
  Load_Var = 0        #作为队伍负重上限的变量ID,为0禁用变量作为负重上限,变成
                      #累计每个角色的负重能力来计算负重上限
                     
  EQUIPSWLOAD  = true     #true 使用 / false 不使用
  # 用于是否显示装备栏的负重信息#####################
  
  $equip_map = true   #装备负重提示开关
  
  Load_Eval = "((mhp + mmp) * @level / agi) * [hp_rate,0.5].max"
  # 每个角色的负重计算公式(eval)
  
  Stop_SW = false       #true 使用 / false 不使用
  # 事件中调用增减道具/武器/防具时,如果会导致超过负重上限,是否执行中断事件处理
  # 推荐不使用,因为新加的功能就有一个是当超过负重时限制角色移动,开启这个
  # 的话这个限制移动就无效了的说·3·

  Movable =  false       #true 使用 / false 不使用
  # 满负重时降低移动速度(不使用时禁止移动连事件都无法启动,只能丢弃/使用物品)
  
  
  Move_Speed = 2 # 满负重时的移动速度
  
  # 负重超过上限时的提示内容
  Message = "\\i[4]负重超过可承受的范围,\n移动将变得\\c[10]十分艰难!\\c[0]
丢些没用的东西掉吧。"

  # 装备负重超过上限时的提示内容
  Message2 = "\\i[4]检测到队伍中至少有一名角色装备负重\n\\c[10]超过可承受范围\\c[0],队伍行动将变得\\c[10]十分艰难!\\c[0]
必要时请及时更换更轻便的装备哦。"

  # 装备负重信息默认显示位置
  Messset = 1  #0 上 / 1 中 / 2 下
  
  # 按X键(A键)是否可以丢弃道具
  # 如果你另外使用了丢弃道具的脚本请关闭
  Lose_SW = true       #true 使用 / false 不使用

  # 是否在帮助窗口内自动添加负重信息
  Help_SW = true       #true 使用 / false 不使用

  # 装备在身上的装备是否算入负重
  Equip_SW = true      #true 计算 / false 不计算
  #         "★★★★★★ 注意 ★★★★★★"
  # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
end
#==============================================================================
# ☆ 装备负重 ☆#######################
#==============================================================================
class Game_Actor
  include VIPArcher::Load
  attr_accessor :equip_weight      #已装备物品重量
  attr_accessor :equip_weightmax   #最大负重
  alias setup_plus setup
  alias refresh_plus refresh
  alias change_equip_plus change_equip
  #--------------------------------------------------------------------------
  # ● 设置
  #--------------------------------------------------------------------------
  def setup(actor_id)
    setup_plus(actor_id)
    @equip_weight = equips.compact.inject(0) {|r, item| r += item.load }
    @equip_weightmax = loadmax
  end  
  #--------------------------------------------------------------------------
  # ● 获取队伍角色最大负重
  #--------------------------------------------------------------------------
   def loadmax
    return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
    return Default_Equip
  end
  #--------------------------------------------------------------------------
  # ● 更换装备
  #     slot_id : 装备栏 ID
  #     item    : 武器/护甲(为 nil 时装备解除)
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
  change_equip_plus(slot_id, item)
  $equip_map = true  
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
a = equips.compact.inject(0) {|r, item| r += item.load }
   if @equip_weight != a
    @equip_weight = a
   end
   refresh_plus
  end
end
#==============================================================================
#  ☆ 装备超重提示 ☆#######################
#==============================================================================
class Scene_Map < Scene_Base
include  VIPArcher::Load
alias start_plus start
def start
   start_plus
   equiptips
end  
  #--------------------------------------------------------------------------
  # ● 装备超重提示
  #--------------------------------------------------------------------------
  def equiptips
      if $equip_map
     for i in 1..$data_system.party_members.clone.size
   if $game_actors.equip_weight > $game_actors.equip_weightmax
      $game_message.position = Messset
      $equip_map = false
     return $game_message.texts.push("#{Message2}")
    end
   end
  end
end
end   
#==============================================================================
#  ☆ 能力窗口 ☆#######################
#==============================================================================
class Window_EquipStatus
  include VIPArcher::Load #继承了该模块
  alias refresh_plus refresh
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
  refresh_plus
  if EQUIPSWLOAD
  contents.font.size = 16 ;contents.font.color = text_color(21)
if @actor !=nil
  x=80
   contents.draw_text(x,0,100,16,"负重:")
   if @actor.equip_weight > @actor.equip_weightmax
   contents.font.color = text_color(10)
   contents.draw_text(x-30,20,100,16,"超重!")
   end
  contents.font.color = text_color(0)
  contents.draw_text(x+50,0,100,16,"#{@actor.equip_weight}/#{@actor.equip_weightmax}")
end  
  contents.font.size = 21
  end
end
end  
#==============================================================================
# ☆ 设定结束 ☆
#==============================================================================
class RPG::BaseItem
  include VIPArcher::Load #继承了该模块
  #--------------------------------------------------------------------------
  # ● 获取道具的重量
  #--------------------------------------------------------------------------
  def load
    return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
    return $1.to_i if @note =~ /<(?:load|负重|負重)\s*(\d+)>/i
    return Default_Load #若备注没有 <负重 (数字)> 则自动替换为该常量
  end
  #--------------------------------------------------------------------------
  # ● 新增负重帮助内容
  #--------------------------------------------------------------------------
  def description
    if Help_SW && load && load != 0
      return @description + "\n\\}重量:#{load}"
    else
      return @description
    end
  end unless $VIPArcherScript[:help_ex]
end
#==============================================================================
#  显示当前负重信息的窗口
#==============================================================================
class Window_Load < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(Graphics.width - window_width, 72, window_width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    Width
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    contents.font.size - 4
    draw_text(0, 0, window_width - 64, 24,load_name,0)
    draw_text(0, 0, window_width - 24, 24, weight,2)
    @temp_load = $game_party.current_load
  end
  #--------------------------------------------------------------------------
  # ● 获取当前负重信息
  #--------------------------------------------------------------------------
  def weight
    "#{$game_party.current_load}/#{$game_party.total_load}"
  end
  #--------------------------------------------------------------------------
  # ● 获取负重前显示文字
  #--------------------------------------------------------------------------
  def load_name
    Load_Name
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    refresh if @temp_load != $game_party.current_load
  end
end
#-------------------------------------------------------------------------------
class Window_ItemCategory < Window_HorzCommand
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    scene_item_is? ? Graphics.width - Width : Graphics.width
  end
  #--------------------------------------------------------------------------
  # ● 获取列数
  #--------------------------------------------------------------------------
  def col_max
    return scene_item_is? ? 3 : 4
  end
  #--------------------------------------------------------------------------
  # ● 判断是否为物品栏场景
  #--------------------------------------------------------------------------
  def scene_item_is?
    return SceneManager.scene_is?(Scene_Item)
  end
end
#==============================================================================
# ■ 物品界面显示负重栏
#==============================================================================
class Scene_Item < Scene_ItemBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias load_start start
  def start
    load_start
    @load_window = Window_Load.new
    @load_window.viewport = @viewport
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  alias load_terminate terminate
  def terminate
    load_terminate
    @load_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  alias load_update update
  def update
    #--------------------------------------------------------------------------
    # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
    #--------------------------------------------------------------------------
    if Input.trigger?(Input::X) && Lose_SW
      item = @item_window.item
      if item.is_a?(RPG::Item) && item.key_item?
        Sound.play_buzzer
      else
        Sound.play_cancel
        $game_party.lose_item(item, 1)
        @item_window.refresh
      end unless item == nil
    end
    @load_window.update
    load_update
  end
end
#-------------------------------------------------------------------------------
class Window_ShopNumber < Window_Selectable
  include VIPArcher::Load
  attr_accessor :buy_or_sell                    #买入的标志
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopnumber_refresh refresh
  def refresh
    vip_shopnumber_refresh
    draw_current_weight(@item)
  end
  #--------------------------------------------------------------------------
  # ○ 买卖时重量变化的描绘
  #--------------------------------------------------------------------------
  def draw_current_weight(item)
    current = $game_party.current_load
    weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
    width = contents_width - 8
    cx = text_size(@currency_unit).width
    change_color(system_color)
    draw_text(4, y + 60, width, line_height, "#{Load_Name}")
    change_color(normal_color)
    wt = "#{weight} / #{$game_party.total_load}"
    draw_text(4, y + 60, width, line_height, wt, 2)
  end
end
#-------------------------------------------------------------------------------
class Window_ShopStatus < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopstatus_refresh refresh
  def refresh
    vip_shopstatus_refresh
    draw_weight_occupy(4, 24)
  end
  #--------------------------------------------------------------------------
  # ● 绘制持负重信息
  #--------------------------------------------------------------------------
  def draw_weight_occupy(x, y)
    rect = Rect.new(x, y, contents.width - 4 - x, line_height)
    change_color(system_color)
    draw_text(rect, "#{Load_Name}", 3)
    change_color(normal_color)
    weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
    draw_text(rect, weight, 2)
    @temp_load = $game_party.current_load
  end
end
#==============================================================================
# ■ 获取队伍最大负重
#==============================================================================
class Game_Party < Game_Unit
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_accessor :current_load, :load_trade_item     #负重
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias load_initialize initialize
  def initialize
    load_initialize
    total_load
    @current_load = 0
    @total_load = 0
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍最大负重
  #--------------------------------------------------------------------------
  def total_load
    return $game_variables[Load_Var] if Load_Var > 0
    all_members.inject(0) {|total,actor| total + actor.load }
  end
  #--------------------------------------------------------------------------
  # ● 判断物品负重是否已满
  #--------------------------------------------------------------------------
  def load_max?
    return false if @current_load == 0
    @current_load >= total_load
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍的总装备重量
  #--------------------------------------------------------------------------
#  def equiptotal
#    load=0
#    for i in 1..$data_system.party_members.clone.size
#    load += $game_actors.equip_weight
#    end
#    return load
#  end  
  #--------------------------------------------------------------------------
  # ● 判断装备负重是否已满##################################
  #--------------------------------------------------------------------------
  def eload_max?
   max=0
   for i in 1..$data_system.party_members.clone.size
   max+=1 if $game_actors.equip_weight <= $game_actors.equip_weightmax
   return false if max == $data_system.party_members.clone.size
   end
end  
  #--------------------------------------------------------------------------
  # ● 增加/减少物品时计算负重
  #--------------------------------------------------------------------------
  alias load_gain_item gain_item
  def gain_item(item, n, include_equip = false)
    return if item.nil?
    load_gain_item(item, n, include_equip)
    @current_load += item.load * n if !@load_trade_item
  end
end
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 装备时不计算负重的增减 * 方法覆盖
  #     new_item : 取出的物品
  #     old_item : 放入的物品
  #--------------------------------------------------------------------------
  def trade_item_with_party(new_item, old_item)
    return false if new_item && !$game_party.has_item?(new_item)
    $game_party.load_trade_item = true if Equip_SW == true
    $game_party.gain_item(old_item, 1)
    $game_party.lose_item(new_item, 1)
    $game_party.load_trade_item = false if Equip_SW == true
    return true
  end
  #--------------------------------------------------------------------------
  # ● 获取角色的负重上限
  #--------------------------------------------------------------------------
  def load
    eval(Load_Eval).to_i
  end
end
#==============================================================================
# ■ 增减物品时判断负重
#==============================================================================
class Game_Interpreter
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 增减道具
  #--------------------------------------------------------------------------
  alias load_command_126 command_126
  def command_126
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 0, n) && Stop_SW
    load_command_126
  end
  #--------------------------------------------------------------------------
  # ● 增減武器
  #--------------------------------------------------------------------------
  alias load_command_127 command_127
  def command_127
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 1, n) && Stop_SW
    load_command_127
  end
  #--------------------------------------------------------------------------
  # ● 增減防具
  #--------------------------------------------------------------------------
  alias load_command_128 command_128
  def command_128
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 2, n) && Stop_SW
    load_command_128
  end
  #--------------------------------------------------------------------------
  # ● 增减物品超重时提示
  #--------------------------------------------------------------------------
  def check_load(item_id, type, n)
    case type
    when 0; item = $data_items[item_id]
    when 1; item = $data_weapons[item_id]
    when 2; item = $data_armors[item_id]
    end
    if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
      $game_message.texts.push("#{Message}") if $game_message.visible != true
      $game_message.visible = true
    end
    return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  end
  #--------------------------------------------------------------------------
  # ● 更改负重
  #--------------------------------------------------------------------------
  def current_load(current_load,assign = false)
    if assign
      $game_party.current_load = current_load
    else
      $game_party.current_load += current_load
    end
  end
end
#==============================================================================
# ★ 满负重时限制行动 ★
#==============================================================================
class Game_Player < Game_Character
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 判定是否可以移动###################
  #--------------------------------------------------------------------------
  alias load_movable? movable?
  def movable?
    return false if $game_party.load_max? && !Movable
    return false if $game_party.eload_max? && !Movable ###################
    load_movable?
  end
end
#==============================================================================
# ★ 满负重时降低移动速度 ★
#==============================================================================
class Game_CharacterBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取移动速度(判断是否跑步)################
  #--------------------------------------------------------------------------
  alias load_real_move_speed real_move_speed
  def real_move_speed
    return Move_Speed if $game_party.load_max? && Movable
    return Move_Speed if $game_party.eload_max? && Movable ################
    load_real_move_speed
  end
end
#==============================================================================
# ★ 满负重时限制购买 ★
#==============================================================================
class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 查询商品是否可买
  #--------------------------------------------------------------------------
  alias load_enable? enable?
  def enable?(item)
    load_enable?(item) && !$game_party.load_max?
  end
end
#==============================================================================
# ★ 根据负重设定可购买的物品数量 ★
#==============================================================================
class Scene_Shop < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 指令“买入”
  #--------------------------------------------------------------------------
  alias vip_load_command_buy command_buy
  def command_buy
    vip_load_command_buy
    @number_window.buy_or_sell = true
  end
  #--------------------------------------------------------------------------
  # ● 指令“卖出”
  #--------------------------------------------------------------------------
  alias vip_load_command_sell command_sell
  def command_sell
    vip_load_command_sell
    @number_window.buy_or_sell = false
  end
  #--------------------------------------------------------------------------
  # ● 获取可以买入的最大值
  #--------------------------------------------------------------------------
  alias load_max_buy max_buy
  def max_buy
    vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
    $game_party.current_load) / @item.load
    [load_max_buy,vip].min
  end
end[/pre]

2020.4.9更新************[pre lang="ruby" line="1"]#==============================================================================
# +++ VX移植 - VA负重系统改进版 +++
#==============================================================================
# VX版 原作者 By 雪流星
# 蓝本 杂兵天下的VA移植版
# 改进 By:VIPArcher
#  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
# 二次小改 By:小茶司令(爱呗茶)2020.4.3
#==============================================================================
# 就是在物品画面的右上角放了一个显示负重的窗口
# 更新了代码,取消的原来的计算每个队员的负重然后累加的模式 2014-12-10
# 增加了商店界面的负重显示     2014-9-3
#==============================================================================
# 物品备注<load N> 则该物品占用 N 点负重
# load也可以写成「负重」或「負重」#注:没有“「」”不写的话默认为 Default_Load
# 更改当前负重 current_load(x[,assign])
# 其中 x 为数值可以为负数,assign 为 true 时当前负重直接赋值为x(可省略)
# 例如:current_load(10,true) 当前负重直接赋值为10
# 默认给物品增加一行说明.说明内容是物品的重量.
# 但默认帮助窗口一共只能显示2行内容.
# 因此你在数据库设置武器、护甲说明的时候.
# 如果设置了2行内容.那么这新增加的第3行将无法显示出来.
# 特别地,如果你使用了我的【技能物品说明增强】脚本,请将其置于该脚本以上的位置
# 2020.4.3 增加内容:
# 1.每名角色的独立装备负重
# 2.队伍中若有一名以上角色装备负重超过上限则进行超重处理
# 3.装备超重提示
# 4.添加若干常量设置
# 2020.4.9 增加内容
# 1.增加物品自动超重提示【当物品超重时 每次启动物品栏并返回地图界面后将提示一次】(原版为只有事件获取物品后超重才进行提示)
# (并将原版相等时超重处理改为超过时超重处理)
# 2.添加了装备的个人负重加成属性 【详见装备栏】
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:load] = 20140919
#==============================================================================
# ★ 设定部分 ★
#==============================================================================
module  VIPArcher end
module  VIPArcher::Load
  Default_Load = 1    #物品的默认负重
  Default_Equip = 0  #每名角色默认装备重量上限 ###########################
#若不想使用默认负重则需数据库角色备注里添加文本 例: <负重 50>


  EQUIPZHONG = 0      #每件装备的初始负重加成  ps:装备栏中该属性若为0则不进行显示
#若不想使用默认负重则需数据库装备备注里添加文本 例: <负重加成 50>  

  Width = 150         #负重信息窗口宽度
  
  Load_Name = "负重:" #负重前显示的文字
  
  LoadJC_Name = "负重加成:" #装备栏中负重加成属性显示的文字
  
  Load_Var = 0        #作为队伍负重上限的变量ID,为0禁用变量作为负重上限,变成
                      #累计每个角色的负重能力来计算负重上限
                     
  EQUIPSWLOAD  = true     #true 使用 / false 不使用
  # 用于是否显示装备栏的负重信息#####################
  
  
  #装备负重的超重提示是否开启 #true 使用 / false 不使用
  EQUIP_TIPS = true
  #物品负重的超重提示是否开启  #true 使用 / false 不使用
  ITEM_TIPS  = true   
  
  
  $equip_map = true   #装备负重的提示开关初始状态
  $item_map  = true    #物品负重的提示开关初始状态
  
  Load_Eval = "((mhp + mmp) * @level / agi) * [hp_rate,0.5].max"
  # 每个角色的负重计算公式(eval)
  
  Stop_SW = false       #true 使用 / false 不使用
  # 事件中调用增减道具/武器/防具时,如果会导致超过负重上限,是否执行中断事件处理
  # 推荐不使用,因为新加的功能就有一个是当超过负重时限制角色移动,开启这个
  # 的话这个限制移动就无效了的说·3·

  Movable =  false       #true 使用 / false 不使用
  # 满负重时降低移动速度(不使用时禁止移动连事件都无法启动,只能丢弃/使用物品)
  
  
  Move_Speed = 2 # 满负重时的移动速度
  
  # 负重超过上限时的提示内容
  Message = "\\i[4]负重超过可承受的范围,\n移动将变得\\c[10]十分艰难!\\c[0]
丢些没用的东西掉吧。"

  # 装备负重超过上限时的提示内容
  Message2 = "\\i[4]检测到队伍中至少有一名角色装备负重\n\\c[10]超过可承受范围\\c[0],队伍行动将变得\\c[10]十分艰难!\\c[0]
必要时请及时更换更轻便的装备哦。"

  # 装备超重信息默认显示位置
  Messset = 1  #0 上 / 1 中 / 2 下
  
  # 物品超重信息默认显示位置
  Messset2 = 1  #0 上 / 1 中 / 2 下
  
  # 按X键(A键)是否可以丢弃道具
  # 如果你另外使用了丢弃道具的脚本请关闭
  Lose_SW = true       #true 使用 / false 不使用

  # 是否在帮助窗口内自动添加负重信息
  Help_SW = true       #true 使用 / false 不使用

  # 装备在身上的装备是否算入负重
  Equip_SW = false      #true 计算 / false 不计算
  #         "★★★★★★ 注意 ★★★★★★"
  # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
end
#==============================================================================
# ☆ 装备负重 ☆#######################
#==============================================================================
class Game_Actor
  include VIPArcher::Load
  attr_accessor :equip_weight      #已装备物品重量
  attr_accessor :equip_weightmax   #最大负重
  alias setup_plus setup
  alias refresh_plus refresh
  alias change_equip_plus change_equip
  #--------------------------------------------------------------------------
  # ● 设置
  #--------------------------------------------------------------------------
  def setup(actor_id)
    setup_plus(actor_id)
    @equip_weight = equips.compact.inject(0) {|r, item| r += item.load }
    @equip_weightmax = loadmax
  end  
  #--------------------------------------------------------------------------
  # ● 获取队伍角色最大负重
  #--------------------------------------------------------------------------
#   def loadmax
#    return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
#    return Default_Equip
#  end
  #--------------------------------------------------------------------------
  # ● 获取队伍角色基础负重
  #--------------------------------------------------------------------------
  def jichuload
    return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
    return Default_Equip
  end
    #--------------------------------------------------------------------------
  # ● 获取队伍角色最大负重
  #--------------------------------------------------------------------------
  def loadmax
    return jichuload  + equips.compact.inject(0) {|r, item| r += item.zhong }
  end  
  #--------------------------------------------------------------------------
  # ● 更换装备
  #     slot_id : 装备栏 ID
  #     item    : 武器/护甲(为 nil 时装备解除)
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
  change_equip_plus(slot_id, item)
  $equip_map = true  
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
a = equips.compact.inject(0) {|r, item| r += item.load }
   if @equip_weight != a
    @equip_weight =  a
  end
   @equip_weightmax = loadmax if @equip_weightmax != loadmax
    refresh_plus
  end
end
#==============================================================================
#  ☆ 超重提示 ☆#######################
#==============================================================================
class Scene_Map < Scene_Base
include  VIPArcher::Load
alias start_plus start
def start
   start_plus
   tipss
end  
  #--------------------------------------------------------------------------
  # ● 超重提示
  #--------------------------------------------------------------------------
  def tipss
    #####装备超重提示######
      if EQUIP_TIPS && $equip_map
     for i in 1..$data_system.party_members.clone.size
   if $game_actors.equip_weight > $game_actors.equip_weightmax
      $game_message.position = Messset
      $equip_map = false
     return $game_message.texts.push("#{Message2}")
    end
   end
  end
    #####物品超重提示#######
    if ITEM_TIPS && $item_map
  if $game_party.current_load > $game_party.total_load  
      $game_message.position = Messset2
      $item_map = false
     return $game_message.texts.push("#{Message}")
   end  
  end
end
end   
#==============================================================================
#  ☆ 能力窗口 ☆#######################
#==============================================================================
class Window_EquipStatus
  include VIPArcher::Load #继承了该模块
  alias refresh_plus refresh
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
  refresh_plus
  if EQUIPSWLOAD
  contents.font.size = 16 ;contents.font.color = text_color(21)
if @actor !=nil
  x=80
   contents.draw_text(x,0,100,16,"负重:")
   if @actor.equip_weight > @actor.equip_weightmax
   contents.font.color = text_color(10)
   contents.draw_text(x-30,20,100,16,"超重!")
   end
  contents.font.color = text_color(0)
  contents.draw_text(x+50,0,100,16,"#{@actor.equip_weight}/#{@actor.equip_weightmax}")
end  
  contents.font.size = 21
  end
end
end  
#==============================================================================
# ☆ 设定结束 ☆
#==============================================================================
class RPG::BaseItem
  include VIPArcher::Load #继承了该模块
  #--------------------------------------------------------------------------
  # ● 获取道具的重量
  #--------------------------------------------------------------------------
  def load
    return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
    return $1.to_i if @note =~ /<(?:load|负重|負重)\s*(\d+)>/i
    return Default_Load #若备注没有 <负重 (数字)> 则自动替换为该常量
  end
  #--------------------------------------------------------------------------
  # ● 获取道具的属性加成
  #--------------------------------------------------------------------------
  def zhong
    return unless self.is_a?(RPG::EquipItem)
    return $1.to_i if @note =~ /<(?:load加成|负重加成|負重加成)\s*(\d+)>/i
    return EQUIPZHONG #若备注没有 <负重加成 (数字)> 则自动替换为该常量
  end  
  #--------------------------------------------------------------------------
  # ● 新增负重帮助内容
  #--------------------------------------------------------------------------
  def description
    if Help_SW && load && load != 0
     return @description + "\n\\}重量:#{load} #{LoadJC_Name}#{zhong}"  if zhong && zhong != 0
     return @description + "\n\\}重量:#{load}"
   else######################################
     return @description + "\n\\}#{LoadJC_Name}#{zhong}" if zhong && zhong != 0
     return @description
    end
  end unless $VIPArcherScript[:help_ex]
end
#==============================================================================
#  显示当前负重信息的窗口
#==============================================================================
class Window_Load < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(Graphics.width - window_width, 72, window_width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    Width
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    contents.font.size - 4
    draw_text(0, 0, window_width - 64, 24,load_name,0)
    draw_text(0, 0, window_width - 24, 24, weight,2)
    @temp_load = $game_party.current_load
  end
  #--------------------------------------------------------------------------
  # ● 获取当前负重信息
  #--------------------------------------------------------------------------
  def weight
    "#{$game_party.current_load}/#{$game_party.total_load}"
  end
  #--------------------------------------------------------------------------
  # ● 获取负重前显示文字
  #--------------------------------------------------------------------------
  def load_name
    Load_Name
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    refresh if @temp_load != $game_party.current_load
  end
end
#-------------------------------------------------------------------------------
class Window_ItemCategory < Window_HorzCommand
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    scene_item_is? ? Graphics.width - Width : Graphics.width
  end
  #--------------------------------------------------------------------------
  # ● 获取列数
  #--------------------------------------------------------------------------
  def col_max
    return scene_item_is? ? 3 : 4
  end
  #--------------------------------------------------------------------------
  # ● 判断是否为物品栏场景
  #--------------------------------------------------------------------------
  def scene_item_is?
    return SceneManager.scene_is?(Scene_Item)
  end
end
#==============================================================================
# ■ 物品界面显示负重栏
#==============================================================================
class Scene_Item < Scene_ItemBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias load_start start
  def start
    load_start
    @load_window = Window_Load.new
    @load_window.viewport = @viewport
    $item_map = true
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  alias load_terminate terminate
  def terminate
    load_terminate
    @load_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  alias load_update update
  def update
    #--------------------------------------------------------------------------
    # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
    #--------------------------------------------------------------------------
    if Input.trigger?(Input::X) && Lose_SW
      item = @item_window.item
      if item.is_a?(RPG::Item) && item.key_item?
        Sound.play_buzzer
      else
        Sound.play_cancel
        $game_party.lose_item(item, 1)
        @item_window.refresh
      end unless item == nil
    end
    @load_window.update
    load_update
  end
end
#-------------------------------------------------------------------------------
class Window_ShopNumber < Window_Selectable
  include VIPArcher::Load
  attr_accessor :buy_or_sell                    #买入的标志
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopnumber_refresh refresh
  def refresh
    vip_shopnumber_refresh
    draw_current_weight(@item)
  end
  #--------------------------------------------------------------------------
  # ○ 买卖时重量变化的描绘
  #--------------------------------------------------------------------------
  def draw_current_weight(item)
    current = $game_party.current_load
    weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
    width = contents_width - 8
    cx = text_size(@currency_unit).width
    change_color(system_color)
    draw_text(4, y + 60, width, line_height, "#{Load_Name}")
    change_color(normal_color)
    wt = "#{weight} / #{$game_party.total_load}"
    draw_text(4, y + 60, width, line_height, wt, 2)
  end
end
#-------------------------------------------------------------------------------
class Window_ShopStatus < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopstatus_refresh refresh
  def refresh
    vip_shopstatus_refresh
    draw_weight_occupy(4, 24)
  end
  #--------------------------------------------------------------------------
  # ● 绘制持负重信息
  #--------------------------------------------------------------------------
  def draw_weight_occupy(x, y)
    rect = Rect.new(x, y, contents.width - 4 - x, line_height)
    change_color(system_color)
    draw_text(rect, "#{Load_Name}", 3)
    change_color(normal_color)
    weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
    draw_text(rect, weight, 2)
    @temp_load = $game_party.current_load
  end
end
#==============================================================================
# ■ 获取队伍最大负重
#==============================================================================
class Game_Party < Game_Unit
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_accessor :current_load, :load_trade_item     #负重
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias load_initialize initialize
  def initialize
    load_initialize
    total_load
    @current_load = 0
    @total_load = 0
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍最大负重
  #--------------------------------------------------------------------------
  def total_load
    return $game_variables[Load_Var] if Load_Var > 0
    all_members.inject(0) {|total,actor| total + actor.load }
  end
  #--------------------------------------------------------------------------
  # ● 判断物品负重是否已满
  #--------------------------------------------------------------------------
  def load_max?
    return false if @current_load == 0
    @current_load > total_load
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍的总装备重量
  #--------------------------------------------------------------------------
#  def equiptotal
#    load=0
#    for i in 1..$data_system.party_members.clone.size
#    load += $game_actors.equip_weight
#    end
#    return load
#  end  
  #--------------------------------------------------------------------------
  # ● 判断装备负重是否已满##################################
  #--------------------------------------------------------------------------
  def eload_max?
   max=0
   for i in 1..$data_system.party_members.clone.size
   max+=1 if $game_actors.equip_weight <= $game_actors.equip_weightmax
   return false if max == $data_system.party_members.clone.size
   end
end  
  #--------------------------------------------------------------------------
  # ● 增加/减少物品时计算负重
  #--------------------------------------------------------------------------
  alias load_gain_item gain_item
  def gain_item(item, n, include_equip = false)
    return if item.nil?
    load_gain_item(item, n, include_equip)
    @current_load += item.load * n if !@load_trade_item
  end
end
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 装备时不计算负重的增减 * 方法覆盖
  #     new_item : 取出的物品
  #     old_item : 放入的物品
  #--------------------------------------------------------------------------
  def trade_item_with_party(new_item, old_item)
    return false if new_item && !$game_party.has_item?(new_item)
    $game_party.load_trade_item = true if Equip_SW == true
    $game_party.gain_item(old_item, 1)
    $game_party.lose_item(new_item, 1)
    $game_party.load_trade_item = false if Equip_SW == true
    return true
  end
  #--------------------------------------------------------------------------
  # ● 获取角色的负重上限
  #--------------------------------------------------------------------------
  def load
    eval(Load_Eval).to_i
  end
end
#==============================================================================
# ■ 增减物品时判断负重
#==============================================================================
class Game_Interpreter
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 增减道具
  #--------------------------------------------------------------------------
  alias load_command_126 command_126
  def command_126
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 0, n) && Stop_SW
    load_command_126
  end
  #--------------------------------------------------------------------------
  # ● 增減武器
  #--------------------------------------------------------------------------
  alias load_command_127 command_127
  def command_127
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 1, n) && Stop_SW
    load_command_127
  end
  #--------------------------------------------------------------------------
  # ● 增減防具
  #--------------------------------------------------------------------------
  alias load_command_128 command_128
  def command_128
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 2, n) && Stop_SW
    load_command_128
  end
  #--------------------------------------------------------------------------
  # ● 增减物品超重时提示
  #--------------------------------------------------------------------------
  def check_load(item_id, type, n)
    case type
    when 0; item = $data_items[item_id]
    when 1; item = $data_weapons[item_id]
    when 2; item = $data_armors[item_id]
    end
    if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
      $game_message.texts.push("#{Message}") if $game_message.visible != true
      $game_message.visible = true
    end
    return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  end
  #--------------------------------------------------------------------------
  # ● 更改负重
  #--------------------------------------------------------------------------
  def current_load(current_load,assign = false)
    if assign
      $game_party.current_load = current_load
    else
      $game_party.current_load += current_load
    end
  end
end
#==============================================================================
# ★ 满负重时限制行动 ★
#==============================================================================
class Game_Player < Game_Character
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 判定是否可以移动###################
  #--------------------------------------------------------------------------
  alias load_movable? movable?
  def movable?
    return false if $game_party.load_max? && !Movable
    return false if $game_party.eload_max? && !Movable ###################
    load_movable?
  end
end
#==============================================================================
# ★ 满负重时降低移动速度 ★
#==============================================================================
class Game_CharacterBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取移动速度(判断是否跑步)################
  #--------------------------------------------------------------------------
  alias load_real_move_speed real_move_speed
  def real_move_speed
    return Move_Speed if $game_party.load_max? && Movable
    return Move_Speed if $game_party.eload_max? && Movable ################
    load_real_move_speed
  end
end
#==============================================================================
# ★ 满负重时限制购买 ★
#==============================================================================
class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 查询商品是否可买
  #--------------------------------------------------------------------------
  alias load_enable? enable?
  def enable?(item)
    load_enable?(item) && !$game_party.load_max?
  end
end
#==============================================================================
# ★ 根据负重设定可购买的物品数量 ★
#==============================================================================
class Scene_Shop < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 指令“买入”
  #--------------------------------------------------------------------------
  alias vip_load_command_buy command_buy
  def command_buy
    vip_load_command_buy
    @number_window.buy_or_sell = true
  end
  #--------------------------------------------------------------------------
  # ● 指令“卖出”
  #--------------------------------------------------------------------------
  alias vip_load_command_sell command_sell
  def command_sell
    vip_load_command_sell
    @number_window.buy_or_sell = false
  end
  #--------------------------------------------------------------------------
  # ● 获取可以买入的最大值
  #--------------------------------------------------------------------------
  alias load_max_buy max_buy
  def max_buy
    vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
    $game_party.current_load) / @item.load
    [load_max_buy,vip].min
  end
end
[/pre]


2020.4.13版 详情请见更新记录[pre lang="ruby" line="1"]#==============================================================================
# +++ VX移植 - VA负重系统改进版 +++
#==============================================================================
# VX版 原作者 By 雪流星
# 蓝本 杂兵天下的VA移植版
# 改进 By:VIPArcher
#  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
# 二次小改 By:小茶司令(爱呗茶)2020.4.3
#==============================================================================
# 就是在物品画面的右上角放了一个显示负重的窗口
# 更新了代码,取消的原来的计算每个队员的负重然后累加的模式 2014-12-10
# 增加了商店界面的负重显示     2014-9-3
#==============================================================================
# 物品备注<load N> 则该物品占用 N 点负重
# load也可以写成「负重」或「負重」#注:没有“「」”不写的话默认为 Default_Load
# 更改当前负重 current_load(x[,assign])
# 其中 x 为数值可以为负数,assign 为 true 时当前负重直接赋值为x(可省略)
# 例如:current_load(10,true) 当前负重直接赋值为10
# 默认给物品增加一行说明.说明内容是物品的重量.
# 但默认帮助窗口一共只能显示2行内容.
# 因此你在数据库设置武器、护甲说明的时候.
# 如果设置了2行内容.那么这新增加的第3行将无法显示出来.
# 特别地,如果你使用了我的【技能物品说明增强】脚本,请将其置于该脚本以上的位置
# 2020.4.3 增加内容:
# 1.每名角色的独立装备负重
# 2.队伍中若有一名以上角色装备负重超过上限则进行超重处理
# 3.装备超重提示
# 4.添加若干常量设置
# 2020.4.9 增加内容
# 1.增加物品超重提示【当物品超重时 每次启动物品栏并返回地图界面后将提示一次】
# (并将原版相等时超重处理改为超过时超重处理)
# 2.添加了装备的个人负重加成属性 【详见装备栏】
#2020.4.13 更新内容#################
# 1.重构装备提示系统,可自动判断具体几号角色负重超出上限
# 2.新的备注功能<炒鸡生命值>
#使用时将<炒鸡生命值>添加进需要该属性角色的备注栏中即可
#添加该功能后该角色最大生命值将变为自身最大负重 - 装备负重【就是一般来说的装备武器会降低血限】
#并且添加该功能的角色将额外获得当前生命值的额外装备负重 但并不会造成实际影响(详情请查看装备栏)
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:load] = 20140919
#==============================================================================
# ★ 设定部分 ★
#==============================================================================
module  VIPArcher end
module  VIPArcher::Load
  Default_Load = 1    #物品的默认负重
  Default_Equip = 0  #每名角色默认装备重量上限 ###########################
#若不想使用默认负重则需数据库角色备注里添加文本 例: <负重 50>


  EQUIPZHONG = 0      #每件装备的初始负重加成  ps:装备栏中该属性若为0则不进行显示
#若不想使用默认负重则需数据库装备备注里添加文本 例: <负重加成 50>  

  Width = 150         #负重信息窗口宽度
  
  Load_Name = "负重:" #负重前显示的文字
  
  LoadJC_Name = "负重加成:" #装备栏中负重加成属性显示的文字
  
  Load_Var = 0        #作为队伍负重上限的变量ID,为0禁用变量作为负重上限,变成
                      #累计每个角色的负重能力来计算负重上限
                     
  EQUIPSWLOAD  = true     #true 使用 / false 不使用
  # 用于是否显示装备栏的负重信息#####################
  
  
  #装备负重的超重提示是否开启 #true 使用 / false 不使用
  EQUIP_TIPS = true
  #物品负重的超重提示是否开启  #true 使用 / false 不使用
  ITEM_TIPS  = true   
  
  
  $equip_map = true   #装备负重的提示开关初始状态
  $item_map  = true    #物品负重的提示开关初始状态
  
  Load_Eval = "((mhp + mmp) * @level / agi) * [hp_rate,0.5].max"
  # 每个角色的负重计算公式(eval)
  
  Stop_SW = false       #true 使用 / false 不使用
  # 事件中调用增减道具/武器/防具时,如果会导致超过负重上限,是否执行中断事件处理
  # 推荐不使用,因为新加的功能就有一个是当超过负重时限制角色移动,开启这个
  # 的话这个限制移动就无效了的说·3·

  Movable =  false       #true 使用 / false 不使用
  # 满负重时降低移动速度(不使用时禁止移动连事件都无法启动,只能丢弃/使用物品)
  
  
  Move_Speed = 2 # 满负重时的移动速度
  
  # 负重超过上限时的提示内容
  Message = "\\i[4]物品负重超过可承受的范围,\n移动将变得\\c[10]十分艰难!\\c[0]
丢些没用的东西掉吧。"

  # 装备负重超过上限时的提示内容
#  Message2 = "\\i[4]检测到队伍中至少有一名角色装备负重\n\\c[10]超过可承受范围\\c[0],队伍行动将变得\\c[10]十分艰难!\\c[0]
#必要时请及时更换更轻便的装备哦。"
  Message2 = "\\i[4]检测到队伍中XX角色装备负重\n\\c[10]超过可承受范围\\c[0],队伍行动将变得\\c[10]十分艰难!\\c[0]
必要时请及时更换更轻便的装备哦。"

  # 装备超重信息默认显示位置
  Messset = 1  #0 上 / 1 中 / 2 下
  
  # 物品超重信息默认显示位置
  Messset2 = 1  #0 上 / 1 中 / 2 下
  
  # 按X键(A键)是否可以丢弃道具
  # 如果你另外使用了丢弃道具的脚本请关闭
  Lose_SW = true       #true 使用 / false 不使用

  # 是否在帮助窗口内自动添加负重信息
  Help_SW = true       #true 使用 / false 不使用

  # 装备在身上的装备是否算入负重
  Equip_SW = false      #true 计算 / false 不计算
  #         "★★★★★★ 注意 ★★★★★★"
  # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
end
#==============================================================================
# ☆ 装备负重 ☆#######################
#==============================================================================
class Game_Actor
  include VIPArcher::Load
  attr_accessor :equip_weight      #已装备物品重量
  attr_accessor :equip_weightmax   #最大负重
  alias setup_plus setup
  alias refresh_plus refresh
  alias change_equip_plus change_equip
  #--------------------------------------------------------------------------
  # ● 设置
  #--------------------------------------------------------------------------
  def setup(actor_id)
    setup_plus(actor_id)
    @equip_weight =  equips.compact.inject(0) {|r, item| r += item.load }
    @equip_weightmax = loadmax
  end  
  #--------------------------------------------------------------------------
  # ● 获取能力重定义
  #--------------------------------------------------------------------------
  def param(param_id)
    return trueload if $data_actors[id].note =~ /<炒鸡生命值>/ && param_id == 0   
    value = param_base(param_id) + param_plus(param_id) #基础+额外
    value *= param_rate(param_id) * param_buff_rate(param_id)
    [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍角色基础负重
  #--------------------------------------------------------------------------
  def jichuload
    return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
    return Default_Equip
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍角色可使用负重
  #--------------------------------------------------------------------------
  def trueload
   return [@equip_weightmax - @equip_weight,1].max if @equip_weightmax && @equip_weight
  end  
  #--------------------------------------------------------------------------
  # ● 获取队伍角色最大负重
  #--------------------------------------------------------------------------
  def loadmax
    return jichuload  + equips.compact.inject(0) {|r, item| r += item.zhong }
  end  
  #--------------------------------------------------------------------------
  # ● 更换装备
  #     slot_id : 装备栏 ID
  #     item    : 武器/护甲(为 nil 时装备解除)
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
  change_equip_plus(slot_id, item)
  $equip_map = true  
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    a = equips.compact.inject(0) {|r, item| r += item.load }
   if @equip_weight != a
    @equip_weight = a
  end
   mhp if mhp != trueload
   @equip_weightmax = loadmax if @equip_weightmax != loadmax
   refresh_plus
  end
end
#==============================================================================
#  ☆ 超重提示 ☆#######################
#==============================================================================
class Scene_Map < Scene_Base
include  VIPArcher::Load
alias start_plus start
def start
   start_plus
   tipss
end  
  #--------------------------------------------------------------------------
  # ● 超重提示
  #--------------------------------------------------------------------------
  def tipss
    a=""
    b=Message2.clone
    data=[]
     #####装备超重提示######
      if EQUIP_TIPS && $equip_map
      for i in 1..$data_system.party_members.clone.size
      data.push("#{i}号") if $game_actors.equip_weight > $game_actors.equip_weightmax
     end
   
     for i in 1..$data_system.party_members.clone.size
    if $game_actors.equip_weight > $game_actors.equip_weightmax
      $game_message.position = Messset
      $equip_map = false
      
     for j in 0...data.size
     a+=data[j]
     end  
     b.sub!(/\XX/)  {"\\c[10]#{a}\\c[0]"}
    return $game_message.texts.push("#{b}")
    end
  end
end
    #####物品超重提示#######
    if ITEM_TIPS && $item_map
  if $game_party.current_load > $game_party.total_load  
      $game_message.position = Messset2
      $item_map = false
     return $game_message.texts.push("#{Message}")
   end  
  end
end
end   
#==============================================================================
#  ☆ 能力窗口 ☆#######################
#==============================================================================
class Window_EquipStatus
  include VIPArcher::Load #继承了该模块
  alias refresh_plus refresh
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
  refresh_plus
  if EQUIPSWLOAD
  contents.font.size = 16 ;contents.font.color = text_color(21)
if @actor !=nil
  id = @actor.id
  x=70;x2=85
  y=25
  load = @actor.equip_weight + @actor.hp
  contents.draw_text(x,0,100,16,"负重:")
  
    if $data_actors[id].note =~ /<炒鸡生命值>/
   if load > @actor.equip_weightmax
   a = load - @actor.equip_weightmax
   contents.font.color = text_color(10)
   contents.draw_text(x2-30,y,100,16,"超重")
   contents.draw_text(x2-27,y+16,100,16,a)
  end
   contents.font.color = text_color(3);contents.font.size = 11
   contents.draw_text(x+50,15,85,16,"("+"#{@actor.hp}"+")");contents.font.size = 16
   
  contents.font.color = text_color(0)
  contents.draw_text(x+42,0,85,16,"#{load}/#{@actor.equip_weightmax}")
   else ####################未使用炒鸡系统
    if @actor.equip_weight > @actor.equip_weightmax
   a = @actor.equip_weight - @actor.equip_weightmax
   contents.font.color = text_color(10)
   contents.draw_text(x2-30,y,100,16,"超重")
   contents.draw_text(x2-27,y+16,100,16,a)
   end
  
  contents.font.color = text_color(0)
  contents.draw_text(x+42,0,85,16,"#{@actor.equip_weight}/#{@actor.equip_weightmax}")
   end  ####################正则判断结束
end  
  contents.font.size = 22
  end
end
end  
#==============================================================================
# ☆ 设定结束 ☆
#==============================================================================
class RPG::BaseItem
  include VIPArcher::Load #继承了该模块
  #--------------------------------------------------------------------------
  # ● 获取道具的重量
  #--------------------------------------------------------------------------
  def load
    return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
    return $1.to_i if @note =~ /<(?:load|负重|負重)\s*(\d+)>/i
    return Default_Load #若备注没有 <负重 (数字)> 则自动替换为该常量
  end
  #--------------------------------------------------------------------------
  # ● 获取道具的属性加成
  #--------------------------------------------------------------------------
  def zhong
    return unless self.is_a?(RPG::EquipItem)
    return $1.to_i if @note =~ /<(?:load加成|负重加成|負重加成)\s*(\d+)>/i
    return EQUIPZHONG #若备注没有 <负重加成 (数字)> 则自动替换为该常量
  end  
  #--------------------------------------------------------------------------
  # ● 新增负重帮助内容
  #--------------------------------------------------------------------------
  def description
    if Help_SW && load && load != 0
     return @description + "\n\\}重量:#{load} #{LoadJC_Name}#{zhong}"  if zhong && zhong != 0
     return @description + "\n\\}重量:#{load}"
   else######################################
     return @description + "\n\\}#{LoadJC_Name}#{zhong}" if zhong && zhong != 0
     return @description
    end
  end unless $VIPArcherScript[:help_ex]
end
#==============================================================================
#  显示当前负重信息的窗口
#==============================================================================
class Window_Load < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(Graphics.width - window_width, 72, window_width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    Width
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    contents.font.size - 4
    draw_text(0, 0, window_width - 64, 24,load_name,0)
    draw_text(0, 0, window_width - 24, 24, weight,2)
    @temp_load = $game_party.current_load
  end
  #--------------------------------------------------------------------------
  # ● 获取当前负重信息
  #--------------------------------------------------------------------------
  def weight
    "#{$game_party.current_load}/#{$game_party.total_load}"
  end
  #--------------------------------------------------------------------------
  # ● 获取负重前显示文字
  #--------------------------------------------------------------------------
  def load_name
    Load_Name
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    refresh if @temp_load != $game_party.current_load
  end
end
#-------------------------------------------------------------------------------
class Window_ItemCategory < Window_HorzCommand
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    scene_item_is? ? Graphics.width - Width : Graphics.width
  end
  #--------------------------------------------------------------------------
  # ● 获取列数
  #--------------------------------------------------------------------------
  def col_max
    return scene_item_is? ? 3 : 4
  end
  #--------------------------------------------------------------------------
  # ● 判断是否为物品栏场景
  #--------------------------------------------------------------------------
  def scene_item_is?
    return SceneManager.scene_is?(Scene_Item)
  end
end
#==============================================================================
# ■ 物品界面显示负重栏
#==============================================================================
class Scene_Item < Scene_ItemBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias load_start start
  def start
    load_start
    @load_window = Window_Load.new
    @load_window.viewport = @viewport
    $item_map = true
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  alias load_terminate terminate
  def terminate
    load_terminate
    @load_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  alias load_update update
  def update
    #--------------------------------------------------------------------------
    # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
    #--------------------------------------------------------------------------
    if Input.trigger?(Input::X) && Lose_SW
      item = @item_window.item
      if item.is_a?(RPG::Item) && item.key_item?
        Sound.play_buzzer
      else
        Sound.play_cancel
        $game_party.lose_item(item, 1)
        @item_window.refresh
      end unless item == nil
    end
    @load_window.update
    load_update
  end
end
#-------------------------------------------------------------------------------
class Window_ShopNumber < Window_Selectable
  include VIPArcher::Load
  attr_accessor :buy_or_sell                    #买入的标志
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopnumber_refresh refresh
  def refresh
    vip_shopnumber_refresh
    draw_current_weight(@item)
  end
  #--------------------------------------------------------------------------
  # ○ 买卖时重量变化的描绘
  #--------------------------------------------------------------------------
  def draw_current_weight(item)
    current = $game_party.current_load
    weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
    width = contents_width - 8
    cx = text_size(@currency_unit).width
    change_color(system_color)
    draw_text(4, y + 60, width, line_height, "#{Load_Name}")
    change_color(normal_color)
    wt = "#{weight} / #{$game_party.total_load}"
    draw_text(4, y + 60, width, line_height, wt, 2)
  end
end
#-------------------------------------------------------------------------------
class Window_ShopStatus < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopstatus_refresh refresh
  def refresh
    vip_shopstatus_refresh
    draw_weight_occupy(4, 24)
  end
  #--------------------------------------------------------------------------
  # ● 绘制持负重信息
  #--------------------------------------------------------------------------
  def draw_weight_occupy(x, y)
    rect = Rect.new(x, y, contents.width - 4 - x, line_height)
    change_color(system_color)
    draw_text(rect, "#{Load_Name}", 3)
    change_color(normal_color)
    weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
    draw_text(rect, weight, 2)
    @temp_load = $game_party.current_load
  end
end
#==============================================================================
# ■ 获取队伍最大负重
#==============================================================================
class Game_Party < Game_Unit
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_accessor :current_load, :load_trade_item     #负重
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias load_initialize initialize
  def initialize
    load_initialize
    total_load
    @current_load = 0
    @total_load = 0
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍最大负重
  #--------------------------------------------------------------------------
  def total_load
    return $game_variables[Load_Var] if Load_Var > 0
    all_members.inject(0) {|total,actor| total + actor.load }
  end
  #--------------------------------------------------------------------------
  # ● 判断物品负重是否已满
  #--------------------------------------------------------------------------
  def load_max?
    return false if @current_load == 0
    @current_load > total_load
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍的总装备重量
  #--------------------------------------------------------------------------
#  def equiptotal
#    load=0
#    for i in 1..$data_system.party_members.clone.size
#    load += $game_actors.equip_weight
#    end
#    return load
#  end  
  #--------------------------------------------------------------------------
  # ● 判断装备负重是否已满##################################
  #--------------------------------------------------------------------------
  def eload_max?
   max=0
   for i in 1..$data_system.party_members.clone.size
   max+=1 if $game_actors.equip_weight <= $game_actors.equip_weightmax
   return false if max == $data_system.party_members.clone.size
   end
end  
  #--------------------------------------------------------------------------
  # ● 增加/减少物品时计算负重
  #--------------------------------------------------------------------------
  alias load_gain_item gain_item
  def gain_item(item, n, include_equip = false)
    return if item.nil?
    load_gain_item(item, n, include_equip)
    @current_load += item.load * n if !@load_trade_item
  end
end
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 装备时不计算负重的增减 * 方法覆盖
  #     new_item : 取出的物品
  #     old_item : 放入的物品
  #--------------------------------------------------------------------------
  def trade_item_with_party(new_item, old_item)
    return false if new_item && !$game_party.has_item?(new_item)
    $game_party.load_trade_item = true if Equip_SW == true
    $game_party.gain_item(old_item, 1)
    $game_party.lose_item(new_item, 1)
    $game_party.load_trade_item = false if Equip_SW == true
    return true
  end
  #--------------------------------------------------------------------------
  # ● 获取角色的负重上限
  #--------------------------------------------------------------------------
  def load
    eval(Load_Eval).to_i
  end
end
#==============================================================================
# ■ 增减物品时判断负重
#==============================================================================
class Game_Interpreter
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 增减道具
  #--------------------------------------------------------------------------
  alias load_command_126 command_126
  def command_126
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 0, n) && Stop_SW
    load_command_126
  end
  #--------------------------------------------------------------------------
  # ● 增減武器
  #--------------------------------------------------------------------------
  alias load_command_127 command_127
  def command_127
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 1, n) && Stop_SW
    load_command_127
  end
  #--------------------------------------------------------------------------
  # ● 增減防具
  #--------------------------------------------------------------------------
  alias load_command_128 command_128
  def command_128
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 2, n) && Stop_SW
    load_command_128
  end
  #--------------------------------------------------------------------------
  # ● 增减物品超重时提示
  #--------------------------------------------------------------------------
  def check_load(item_id, type, n)
    case type
    when 0; item = $data_items[item_id]
    when 1; item = $data_weapons[item_id]
    when 2; item = $data_armors[item_id]
    end
    if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
      $game_message.texts.push("#{Message}") if $game_message.visible != true
      $game_message.visible = true
    end
    return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  end
  #--------------------------------------------------------------------------
  # ● 更改负重
  #--------------------------------------------------------------------------
  def current_load(current_load,assign = false)
    if assign
      $game_party.current_load = current_load
    else
      $game_party.current_load += current_load
    end
  end
end
#==============================================================================
# ★ 满负重时限制行动 ★
#==============================================================================
class Game_Player < Game_Character
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 判定是否可以移动###################
  #--------------------------------------------------------------------------
  alias load_movable? movable?
  def movable?
    return false if $game_party.load_max? && !Movable
    return false if $game_party.eload_max? && !Movable ###################
    load_movable?
  end
end
#==============================================================================
# ★ 满负重时降低移动速度 ★
#==============================================================================
class Game_CharacterBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取移动速度(判断是否跑步)################
  #--------------------------------------------------------------------------
  alias load_real_move_speed real_move_speed
  def real_move_speed
    return Move_Speed if $game_party.load_max? && Movable
    return Move_Speed if $game_party.eload_max? && Movable ################
    load_real_move_speed
  end
end
#==============================================================================
# ★ 满负重时限制购买 ★
#==============================================================================
class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 查询商品是否可买
  #--------------------------------------------------------------------------
  alias load_enable? enable?
  def enable?(item)
    load_enable?(item) && !$game_party.load_max?
  end
end
#==============================================================================
# ★ 根据负重设定可购买的物品数量 ★
#==============================================================================
class Scene_Shop < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 指令“买入”
  #--------------------------------------------------------------------------
  alias vip_load_command_buy command_buy
  def command_buy
    vip_load_command_buy
    @number_window.buy_or_sell = true
  end
  #--------------------------------------------------------------------------
  # ● 指令“卖出”
  #--------------------------------------------------------------------------
  alias vip_load_command_sell command_sell
  def command_sell
    vip_load_command_sell
    @number_window.buy_or_sell = false
  end
  #--------------------------------------------------------------------------
  # ● 获取可以买入的最大值
  #--------------------------------------------------------------------------
  alias load_max_buy max_buy
  def max_buy
    vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
    $game_party.current_load) / @item.load
    [load_max_buy,vip].min
  end
end[/pre]

2020.4.17  【增加数位缩进与全新方法】[pre lang="ruby" line="1"]#==============================================================================
# +++ VX移植 - VA负重系统改进版 +++
#==============================================================================
# VX版 原作者 By 雪流星
# 蓝本 杂兵天下的VA移植版
# 改进 By:VIPArcher
#  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
# 二次小改 By:小茶司令(爱呗茶)2020.4.3
#==============================================================================
# 就是在物品画面的右上角放了一个显示负重的窗口
# 更新了代码,取消的原来的计算每个队员的负重然后累加的模式 2014-12-10
# 增加了商店界面的负重显示     2014-9-3
#==============================================================================
# 物品备注<load N> 则该物品占用 N 点负重
# load也可以写成「负重」或「負重」#注:没有“「」”不写的话默认为 Default_Load
# 更改当前负重 current_load(x[,assign])
# 其中 x 为数值可以为负数,assign 为 true 时当前负重直接赋值为x(可省略)
# 例如:current_load(10,true) 当前负重直接赋值为10
# 默认给物品增加一行说明.说明内容是物品的重量.
# 但默认帮助窗口一共只能显示2行内容.
# 因此你在数据库设置武器、护甲说明的时候.
# 如果设置了2行内容.那么这新增加的第3行将无法显示出来.
# 特别地,如果你使用了我的【技能物品说明增强】脚本,请将其置于该脚本以上的位置
# 2020.4.3 增加内容:
# 1.每名角色的独立装备负重
# 2.队伍中若有一名以上角色装备负重超过上限则进行超重处理
# 3.装备超重提示
# 4.添加若干常量设置
# 2020.4.9 增加内容
# 1.增加物品超重提示【当物品超重时 每次启动物品栏并返回地图界面后将提示一次】
# (并将原版相等时超重处理改为超过时超重处理)
# 2.添加了装备的个人负重加成属性 【详见装备栏】
#2020.4.13 更新内容#################
# 1.重构装备提示系统,可自动判断具体几号角色负重超出上限
# 2.新的备注功能<炒鸡生命值>
#添加该功能后该角色最大生命值将变为自身最大负重 - 装备负重【就是一般来说的装备武器会降低血限】
#并且添加该功能的角色将额外获得当前生命值的额外装备负重 但并不会造成实际影响(详情请查看装备栏)
#==============================================================================
# ★ 2020.4.17 更新 ★
#==============================================================================
# 1.角色体力可超过体力上限
# 2.新的全局方法【体力超限清除】
#使用方法 脚本直接输入该中文 执行后即可使全体队员体力高于上限的减至与上限相等
# 3.新的常量设置【HPTIPS】
#队伍中每有角色体力超出上限时并进行对话提醒后 将执行该编号的公共事件
# 4.新的方法  
#$game_party.物品重量(物品ID,增减重量)
#$game_party.武器重量(物品ID,增减重量)
#$game_party.护甲重量(物品ID,增减重量)
#使用后可以随意增减对应ID的重量 例:$game_party.物品重量(1,-100)
# 5.更改了最大体力计算公式与装备栏的体力显示
# 6.添加数位缩进  例:负重达到【10000】时将显示为【1万】
#可使原来空间不足的窗口兼容五位数负重数值
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:load] = 20140919
#==============================================================================
# ★ 设定部分 ★
#==============================================================================
module  VIPArcher end
module  VIPArcher::Load
  Default_Load = 1    #物品的默认负重
  Default_Equip = 0  #每名角色默认装备重量上限 ###########################
#若不想使用默认负重则需数据库角色备注里添加文本 例: <负重 50>


  EQUIPZHONG = 0      #每件装备的初始负重加成  ps:装备栏中该属性若为0则不进行显示
#若不想使用默认负重则需数据库装备备注里添加文本 例: <负重加成 50>  
  
  HPTIPS =  1   #当有角色HP超出体力上限时执行的公共事件编号
  
  Width = 150         #负重信息窗口宽度
  
  $shuwei=["","万","亿","兆","京","垓","秭","穰","沟","涧","正","载","极","阿僧第","那由他","恒河沙","不可思议","无量","系修"]
  #数位缩进
  
  Load_Name = "负重:" #负重前显示的文字
  
  LoadJC_Name = "负重加成:" #装备栏中负重加成属性显示的文字
  
  Load_Var = 0        #作为队伍负重上限的变量ID,为0禁用变量作为负重上限,变成
                      #累计每个角色的负重能力来计算负重上限
                     
  EQUIPSWLOAD  = true     #true 使用 / false 不使用
  # 用于是否显示装备栏的负重信息#####################

  #装备负重的超重提示是否开启 #true 使用 / false 不使用
  EQUIP_TIPS = true
  #物品负重的超重提示是否开启  #true 使用 / false 不使用
  ITEM_TIPS  = true   
  
  
  $equip_map = true   #装备负重的提示开关初始状态
  $item_map  = true    #物品负重的提示开关初始状态
  
  Load_Eval = "((mhp + mmp) * @level / agi) * [hp_rate,0.5].max"
  # 每个角色的负重计算公式(eval)
  
  Stop_SW = false       #true 使用 / false 不使用
  # 事件中调用增减道具/武器/防具时,如果会导致超过负重上限,是否执行中断事件处理
  # 推荐不使用,因为新加的功能就有一个是当超过负重时限制角色移动,开启这个
  # 的话这个限制移动就无效了的说·3·

  Movable =  false       #true 使用 / false 不使用
  # 满负重时降低移动速度(不使用时禁止移动连事件都无法启动,只能丢弃/使用物品)
  
  
  Move_Speed = 2 # 满负重时的移动速度
  
  # 负重超过上限时的提示内容
  Message = "\\i[4]物品负重超过可承受的范围,\n移动将变得\\c[10]十分艰难!\\c[0]
丢些没用的东西掉吧。"

  # 装备负重超过上限时的提示内容
#  Message2 = "\\i[4]检测到队伍中至少有一名角色装备负重\n\\c[10]超过可承受范围\\c[0],队伍行动将变得\\c[10]十分艰难!\\c[0]
#必要时请及时更换更轻便的装备哦。"
  Message2 = "\\i[4]检测到队伍中XX角色装备负重\n\\c[10]超过可承受范围\\c[0],队伍行动将变得\\c[10]十分艰难!\\c[0]
必要时请及时更换更轻便的装备哦。"

# 角色血量高于上限时的提示内容
  Message3 = "\\i[4]检测到队伍中XX角色生命值\\c[10]超出负荷\\c[0],\n队伍将无法行动"

  # 装备超重信息默认显示位置
  Messset = 1  #0 上 / 1 中 / 2 下
  
  # 物品超重信息默认显示位置
  Messset2 = 1  #0 上 / 1 中 / 2 下
  
  # 按X键(A键)是否可以丢弃道具
  # 如果你另外使用了丢弃道具的脚本请关闭
  Lose_SW = true       #true 使用 / false 不使用

  # 是否在帮助窗口内自动添加负重信息
  Help_SW = true       #true 使用 / false 不使用

  # 装备在身上的装备是否算入负重
  Equip_SW = false      #true 计算 / false 不计算
  #         "★★★★★★ 注意 ★★★★★★"
  # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
end
#==============================================================================
# ☆ 体力清除 ☆#######################
#==============================================================================
def 体力超限清除
  (1...$data_actors.size).each do |i|
    actor = $game_actors
    actor.hp = actor.mhp if actor.hp > actor.mhp
  end
end  
#==============================================================================
# ☆ 数位缩进☆#######################
#==============================================================================
def small(i)
   return "0" if i==0
   len=(i.abs.to_s).length
   if len%3==2 && len>3
   len=[(len-2)/3,0].max
   return sprintf("%.0f",(i*10/(10**(len*4))/10.0))+$shuwei[len]
  else
   len=[(len-2)/3,0].max
   return (i/(10**(len*4))).to_s+$shuwei[len]
   end
end
#==============================================================================
# ☆ 装备负重 ☆#######################
#==============================================================================
class Game_Actor
  include VIPArcher::Load
  attr_accessor :equip_weight      #已装备物品重量
  attr_accessor :equip_weightmax   #最大负重
  alias setup_plus setup
  alias refresh_plus refresh
  alias change_equip_plus change_equip
  #--------------------------------------------------------------------------
  # ● 设置
  #--------------------------------------------------------------------------
  def setup(actor_id)
    setup_plus(actor_id)
    @equip_weight =  equips.compact.inject(0) {|r, item| r += item.load }
    @equip_weightmax = loadmax
  end  
  #--------------------------------------------------------------------------
  # ● 获取能力重定义
  #--------------------------------------------------------------------------
  def param(param_id)
   return loadnew if $data_actors[id].note =~ /<炒鸡生命值>/ && param_id == 0   
    value = param_base(param_id) + param_plus(param_id) #基础+额外
    value *= param_rate(param_id) * param_buff_rate(param_id)
    [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  end
  #--------------------------------------------------------------------------
  # ● 获取能力原方法
  #--------------------------------------------------------------------------
  def used_param(param_id)
    value = param_base(param_id) + param_plus(param_id) #基础+额外
    value *= param_rate(param_id) * param_buff_rate(param_id)
    [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  end  
  #--------------------------------------------------------------------------
  # ● 获取队伍角色基础负重
  #--------------------------------------------------------------------------
  def jichuload
    return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
    return Default_Equip
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍角色可使用负重
  #--------------------------------------------------------------------------
  def trueload
   return [((@equip_weightmax - @equip_weight)/10).to_i,0].max if @equip_weightmax && @equip_weight
  end  
  #--------------------------------------------------------------------------
  # ● 获取备注了<炒鸡生命值>的队伍角色最大体力公式
  #--------------------------------------------------------------------------
  def loadnew
    return trueload + used_param(0) if  used_param(0) > 100 && trueload
    return trueload
  end  
  #--------------------------------------------------------------------------
  # ● 获取队伍角色最大负重
  #--------------------------------------------------------------------------
  def loadmax
    return jichuload  + equips.compact.inject(0) {|r, item| r += item.zhong }
  end  
  #--------------------------------------------------------------------------
  # ● 更换装备
  #     slot_id : 装备栏 ID
  #     item    : 武器/护甲(为 nil 时装备解除)
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
  change_equip_plus(slot_id, item)
  $equip_map = true  
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    a = equips.compact.inject(0) {|r, item| r += item.load }
   if @equip_weight != a
    @equip_weight = a
  end
   mhp if mhp != trueload
   @equip_weightmax = loadmax if @equip_weightmax != loadmax
   refresh_plus
  end
end
#==============================================================================
#  ☆ 超重提示 ☆#######################
#==============================================================================
class Scene_Map < Scene_Base
include  VIPArcher::Load
alias start_plus start
def start
   start_plus
   tipss
end  
  #--------------------------------------------------------------------------
  # ● 超重提示
  #--------------------------------------------------------------------------
  def tipss
    a=""
    b=""
    @tips=Message2.clone
    @hptips=Message3.clone
    data=[]
    data2=[]
     if EQUIP_TIPS && $equip_map
        #####装备超重提示######
      (1..$data_system.party_members.size).each do |i|
       actor = $game_actors
      data.push("#{i}号") if actor.equip_weight > actor.equip_weightmax
      data2.push("#{i}号") if actor.hp > actor.mhp
    end
     for i in 1..$data_system.party_members.size
       actor = $game_actors
    if actor.equip_weight > actor.equip_weightmax
      $game_message.position = Messset
      $equip_map = false
      for j in 0...data.size
     a+=data[j]
     end  
     @tips.sub!(/\XX/)  {"\\c[10]#{a}\\c[0]"}
    return $game_message.texts.push(@tips)
  end
end
    #HP超重 #####################
    for i in 1..$data_system.party_members.size
      actor = $game_actors
     if  actor.hp > actor.mhp
     $game_message.position = Messset

     for j in 0...data2.size
      b+=data2[j]
     end
     @hptips.sub!(/\XX/) {"\\c[10]#{b}\\c[0]"}
     $game_message.texts.push(@hptips)
     return $game_temp.reserve_common_event(HPTIPS)
   end
  end
end
    #####物品超重提示#######
    if ITEM_TIPS && $item_map
  if $game_party.current_load > $game_party.total_load  
      $game_message.position = Messset2
      $item_map = false
     return $game_message.texts.push("#{Message}")
   end  
  end
end
  #--------------------------------------------------------------------------
  # ● 超重按键提示
  #--------------------------------------------------------------------------
  def input_tips
   if Input.trigger?(:UP) or Input.trigger?(:DOWN) or Input.trigger?(:RIGHT) or Input.trigger? (:LEFT)
    (1..$data_system.party_members.size).each do |i|
    actor=$game_actors
    if actor.equip_weight > actor.equip_weightmax
      $game_message.position = Messset2
      return $game_message.texts.push(@tips)
    end
     if actor.hp > actor.mhp
      $game_message.position = Messset2
      return $game_message.texts.push(@hptips)
    end  
   end
end
end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  alias update_plus update
  def update
    update_plus
    input_tips
  end  
end
#==============================================================================
# ■ Game_BattlerBase###################
#------------------------------------------------------------------------------
#  管理战斗者的类。主要含有能力值计算的方法。Game_Battler 类的父类。
#==============================================================================
class Game_BattlerBase
  alias hp_rateplus hp_rate
  def refresh
    state_resist_set.each {|state_id| erase_state(state_id) }
    @hp = @hp#[[@hp, mhp].min, 0].max
    @mp = [[@mp, mmp].min, 0].max
    @hp == 0 ? add_state(death_state_id) : remove_state(death_state_id)#生成死亡 #接触死亡
  end  
    def hp_rate
    mhp != 0 ? hp_rateplus : 0
  end
end  
#==============================================================================
#  ☆ 能力窗口 ☆#######################
#==============================================================================
class Window_EquipStatus
  include VIPArcher::Load #继承了该模块
  alias refresh_plus refresh
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
  refresh_plus
  if EQUIPSWLOAD
  contents.font.size = 16 ;contents.font.color = text_color(21)
if @actor !=nil
  id = @actor.id
  x=70;x2=85
  y=25
  load = @actor.equip_weight + @actor.hp
   contents.draw_text(x,0,100,16,"负重:")
        if $data_actors[id].note =~ /<炒鸡生命值>/
         contents.font.color = text_color(10)
       if @actor.hp != @actor.used_param(0)
      if load > @actor.equip_weightmax
       a = load - @actor.equip_weightmax
     contents.draw_text(x2-30,y,100,16,"超重")
     contents.draw_text(x2-27,y+16,100,16,small(a))
    end
    else ############如果体力相等时
     if @actor.equip_weight > @actor.equip_weightmax
     a = @actor.equip_weight - @actor.equip_weightmax
     contents.draw_text(x2-30,y,100,16,"超重")
     contents.draw_text(x2-27,y+16,100,16,small(a))  
    end
  end
   contents.font.color = text_color(3);contents.font.size = 11
   contents.draw_text(x+50,15,85,16,"("+"#{@actor.hp}"+")") if @actor.hp != @actor.used_param(0)
   contents.font.size = 16
  contents.font.color = text_color(0)
  @actor.hp != @actor.used_param(0) ? contents.draw_text(x+42,0,85,16,"#{small(load)}/#{small(@actor.equip_weightmax)}") : contents.draw_text(x+42,0,85,16,"#{small(@actor.equip_weight)}/#{small(@actor.equip_weightmax)}")
   else ####################未使用炒鸡系统
    if @actor.equip_weight > @actor.equip_weightmax
   a = @actor.equip_weight - @actor.equip_weightmax
   contents.font.color = text_color(10)
   contents.draw_text(x2-30,y,100,16,"超重")
   contents.draw_text(x2-27,y+16,100,16,a)
   end
  contents.font.color = text_color(0)
  contents.draw_text(x+42,0,85,16,"#{small(@actor.equip_weight)}/#{small(@actor.equip_weightmax)}")
   end  ####################正则判断结束
end  
  contents.font.size = 22
  end
end
end  
#==============================================================================
# ☆ 设定结束 ☆
#==============================================================================
class RPG::BaseItem
  include VIPArcher::Load #继承了该模块
  #--------------------------------------------------------------------------
  # ● 获取道具的重量
  #--------------------------------------------------------------------------
  def load
    return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
    @note =~ /<(?:load|负重|負重)\s*(\d+)>/i ? a=$1.to_i : a=Default_Load#若备注没有 <负重 (数字)> 则自动替换为该常量
    b = a + $game_party.load(:item,@id) if self.is_a?(RPG::Item)
    b = a + $game_party.load(:armor,@id) if self.is_a?(RPG::Armor)
    b = a + $game_party.load(:weapon,@id) if self.is_a?(RPG::Weapon)
    return b
  end
  #--------------------------------------------------------------------------
  # ● 获取道具的属性加成
  #--------------------------------------------------------------------------
  def zhong
    return unless self.is_a?(RPG::EquipItem)
    return $1.to_i if @note =~ /<(?:load加成|负重加成|負重加成)\s*(\d+)>/i
    return EQUIPZHONG #若备注没有 <负重加成 (数字)> 则自动替换为该常量
  end  
  #--------------------------------------------------------------------------
  # ● 新增负重帮助内容
  #--------------------------------------------------------------------------
  def description
    if Help_SW && load && load != 0
     return @description + "\n\\}重量:#{load} #{LoadJC_Name}#{zhong}"  if zhong && zhong != 0
     return @description + "\n\\}重量:#{load}"
   else######################################
     return @description + "\n\\}#{LoadJC_Name}#{zhong}" if zhong && zhong != 0
     return @description
    end
  end unless $VIPArcherScript[:help_ex]
end
#==============================================================================
#  显示当前负重信息的窗口
#==============================================================================
class Window_Load < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(Graphics.width - window_width, 72, window_width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    Width
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    contents.font.size - 4
    draw_text(0, 0, window_width - 64, 24,load_name,0)
    draw_text(0, 0, window_width - 24, 24, weight,2)
    @temp_load = $game_party.current_load
  end
  #--------------------------------------------------------------------------
  # ● 获取当前负重信息
  #--------------------------------------------------------------------------
  def weight
    "#{$game_party.current_load}/#{$game_party.total_load}"
  end
  #--------------------------------------------------------------------------
  # ● 获取负重前显示文字
  #--------------------------------------------------------------------------
  def load_name
    Load_Name
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    refresh if @temp_load != $game_party.current_load
  end
end
#-------------------------------------------------------------------------------
class Window_ItemCategory < Window_HorzCommand
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    scene_item_is? ? Graphics.width - Width : Graphics.width
  end
  #--------------------------------------------------------------------------
  # ● 获取列数
  #--------------------------------------------------------------------------
  def col_max
    return scene_item_is? ? 3 : 4
  end
  #--------------------------------------------------------------------------
  # ● 判断是否为物品栏场景
  #--------------------------------------------------------------------------
  def scene_item_is?
    return SceneManager.scene_is?(Scene_Item)
  end
end
#==============================================================================
# ■ 物品界面显示负重栏
#==============================================================================
class Scene_Item < Scene_ItemBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  alias load_start start
  def start
    load_start
    @load_window = Window_Load.new
    @load_window.viewport = @viewport
    $item_map = true
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  alias load_terminate terminate
  def terminate
    load_terminate
    @load_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  alias load_update update
  def update
    #--------------------------------------------------------------------------
    # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
    #--------------------------------------------------------------------------
    if Input.trigger?(Input::X) && Lose_SW
      item = @item_window.item
      if item.is_a?(RPG::Item) && item.key_item?
        Sound.play_buzzer
      else
        Sound.play_cancel
        $game_party.lose_item(item, 1)
        @item_window.refresh
      end unless item == nil
    end
    @load_window.update
    load_update
  end
end
#-------------------------------------------------------------------------------
class Window_ShopNumber < Window_Selectable
  include VIPArcher::Load
  attr_accessor :buy_or_sell                    #买入的标志
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopnumber_refresh refresh
  def refresh
    vip_shopnumber_refresh
    draw_current_weight(@item)
  end
  #--------------------------------------------------------------------------
  # ○ 买卖时重量变化的描绘
  #--------------------------------------------------------------------------
  def draw_current_weight(item)
    current = $game_party.current_load
    weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
    width = contents_width - 8
    cx = text_size(@currency_unit).width
    change_color(system_color)
    draw_text(4, y + 60, width, line_height, "#{Load_Name}")
    change_color(normal_color)
    wt = "#{weight} / #{$game_party.total_load}"
    draw_text(4, y + 60, width, line_height, wt, 2)
  end
end
#-------------------------------------------------------------------------------
class Window_ShopStatus < Window_Base
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  alias vip_shopstatus_refresh refresh
  def refresh
    vip_shopstatus_refresh
    draw_weight_occupy(4, 24)
  end
  #--------------------------------------------------------------------------
  # ● 绘制持负重信息
  #--------------------------------------------------------------------------
  def draw_weight_occupy(x, y)
    rect = Rect.new(x, y, contents.width - 4 - x, line_height)
    change_color(system_color)
    draw_text(rect, "#{Load_Name}", 3)
    change_color(normal_color)
    weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
    draw_text(rect, weight, 2)
    @temp_load = $game_party.current_load
  end
end
#==============================================================================
# ■ 获取队伍最大负重
#==============================================================================
class Game_Party < Game_Unit
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_accessor :current_load, :load_trade_item     #负重
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias load_initialize initialize
   def initialize
    load_initialize
    total_load
    @current_load = 0
    @total_load = 0
    @tmload=[0]*$data_items.size #物品储存
    @wnload=[0]*$data_weapons.size #武器储存
    @arload=[0]*$data_armors.size #护甲储存
end
def load(type,id,load=0)
   load = {
     :item =>   {id => 物品重量(id)},
     :weapon => {id => 武器重量(id)},
     :armor =>  {id => 护甲重量(id)},
     }
    return load[type][id]
  end  
  def 物品重量(id,load=0)
    @tmload[id] = @tmload[id]+load
  end
  
  def 武器重量(id,load=0)
    @wnload[id] = @wnload[id]+load
  end
  
  def 护甲重量(id,load=0)
    @arload[id] = @arload[id]+load
  end  
  #--------------------------------------------------------------------------
  # ● 获取队伍最大负重
  #--------------------------------------------------------------------------
  def total_load
    return $game_variables[Load_Var] if Load_Var > 0
    all_members.inject(0) {|total,actor| total + actor.load }
  end
  #--------------------------------------------------------------------------
  # ● 判断物品负重是否已满
  #--------------------------------------------------------------------------
  def load_max?
    return false if @current_load == 0
    @current_load > total_load
  end
  #--------------------------------------------------------------------------
  # ● 获取队伍的总装备重量
  #--------------------------------------------------------------------------
#  def equiptotal
#    load=0
#    for i in 1..$data_system.party_members.clone.size
#    load += $game_actors.equip_weight
#    end
#    return load
#  end  
  #--------------------------------------------------------------------------
  # ● 判断装备负重是否已满##################################
  #--------------------------------------------------------------------------
  def eload_max?
   max=0
   max2=0
  for i in 1..$data_system.party_members.size
    actor = $game_actors
   max+=1 if actor.equip_weight <= actor.equip_weightmax
   max2+=1 if actor.hp <= actor.mhp
   return false if max == $data_system.party_members.size and max2 == $data_system.party_members.size
   end
end  
  #--------------------------------------------------------------------------
  # ● 增加/减少物品时计算负重
  #--------------------------------------------------------------------------
  alias load_gain_item gain_item
  def gain_item(item, n, include_equip = false)
    return if item.nil?
    load_gain_item(item, n, include_equip)
    @current_load += item.load * n if !@load_trade_item
  end
end
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 装备时不计算负重的增减 * 方法覆盖
  #     new_item : 取出的物品
  #     old_item : 放入的物品
  #--------------------------------------------------------------------------
  def trade_item_with_party(new_item, old_item)
    return false if new_item && !$game_party.has_item?(new_item)
    $game_party.load_trade_item = true if Equip_SW == true
    $game_party.gain_item(old_item, 1)
    $game_party.lose_item(new_item, 1)
    $game_party.load_trade_item = false if Equip_SW == true
    return true
  end
  #--------------------------------------------------------------------------
  # ● 获取角色的负重上限
  #--------------------------------------------------------------------------
  def load
    eval(Load_Eval).to_i
  end
end
#==============================================================================
# ■ 增减物品时判断负重
#==============================================================================
class Game_Interpreter
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 增减道具
  #--------------------------------------------------------------------------
  alias load_command_126 command_126
  def command_126
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 0, n) && Stop_SW
    load_command_126
  end
  #--------------------------------------------------------------------------
  # ● 增減武器
  #--------------------------------------------------------------------------
  alias load_command_127 command_127
  def command_127
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 1, n) && Stop_SW
    load_command_127
  end
  #--------------------------------------------------------------------------
  # ● 增減防具
  #--------------------------------------------------------------------------
  alias load_command_128 command_128
  def command_128
    n = operate_value(@params[1], @params[2], @params[3])
    return command_115 if check_load(@params[0], 2, n) && Stop_SW
    load_command_128
  end
  #--------------------------------------------------------------------------
  # ● 增减物品超重时提示
  #--------------------------------------------------------------------------
  def check_load(item_id, type, n)
    case type
    when 0; item = $data_items[item_id]
    when 1; item = $data_weapons[item_id]
    when 2; item = $data_armors[item_id]
    end
    if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
      $game_message.texts.push("#{Message}") if $game_message.visible != true
      $game_message.visible = true
    end
    return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  end
  #--------------------------------------------------------------------------
  # ● 更改负重
  #--------------------------------------------------------------------------
  def current_load(current_load,assign = false)
    if assign
      $game_party.current_load = current_load
    else
      $game_party.current_load += current_load
    end
  end
end
#==============================================================================
# ★ 满负重时限制行动 ★
#==============================================================================
class Game_Player < Game_Character
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 判定是否可以移动###################
  #--------------------------------------------------------------------------
  alias load_movable? movable?
  def movable?
    return false if $game_party.load_max? && !Movable
    return false if $game_party.eload_max? && !Movable ###################
    load_movable?
  end
end
#==============================================================================
# ★ 满负重时降低移动速度 ★
#==============================================================================
class Game_CharacterBase
  include VIPArcher::Load
  #--------------------------------------------------------------------------
  # ● 获取移动速度(判断是否跑步)################
  #--------------------------------------------------------------------------
  alias load_real_move_speed real_move_speed
  def real_move_speed
    return Move_Speed if $game_party.load_max? && Movable
    return Move_Speed if $game_party.eload_max? && Movable ################
    load_real_move_speed
  end
end
#==============================================================================
# ★ 满负重时限制购买 ★
#==============================================================================
class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 查询商品是否可买
  #--------------------------------------------------------------------------
  alias load_enable? enable?
  def enable?(item)
    load_enable?(item) && !$game_party.load_max?
  end
end
#==============================================================================
# ★ 根据负重设定可购买的物品数量 ★
#==============================================================================
class Scene_Shop < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 指令“买入”
  #--------------------------------------------------------------------------
  alias vip_load_command_buy command_buy
  def command_buy
    vip_load_command_buy
    @number_window.buy_or_sell = true
  end
  #--------------------------------------------------------------------------
  # ● 指令“卖出”
  #--------------------------------------------------------------------------
  alias vip_load_command_sell command_sell
  def command_sell
    vip_load_command_sell
    @number_window.buy_or_sell = false
  end
  #--------------------------------------------------------------------------
  # ● 获取可以买入的最大值
  #--------------------------------------------------------------------------
  alias load_max_buy max_buy
  def max_buy
    vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
    $game_party.current_load) / @item.load
    [load_max_buy,vip].min
  end
end
[/pre]

评分

参与人数 4星屑 +150 赞 +3 收起 理由
VIPArcher + 150 认可答案
xyzgwx + 1 认可答案
白嫩白嫩的 + 1 精品文章
gqxastg + 1 塞糖

查看全部评分

********
回复

使用道具 举报

梦石
0
星屑
640
在线时间
888 小时
注册时间
2007-4-3
回帖
53
 楼主| 发表于 2020-4-7 22:51:03 | 显示全部楼层
本帖最后由 xyzgwx 于 2020-4-7 23:09 编辑
Cupidk爱呗茶 发表于 2020-4-3 20:10
满负重是否可移动在61行可以设置 false为不可移动 true为可移动 根据LZ的需求默认已改为false了哦
角色有初 ...


抱歉,因为网络问题,现在才回复

脚本很好,谢谢解答


还有两个问题,希望能够解答

当持有的武器总重小于队伍总负重(设定总负重不计入角色已装备品,总负重用变量决定),但大于某个角色最大负重时(这个角色已装备品低于这个角色最大负重),角色可以移动,但仍会有提示超重的系统对话(除此之外一切正常),能否修改,使其不提示超重?

还有一个可能麻烦的问题,能否用角色HP+装备的道具来控制这个角色的最大负重?例如角色HP400,防具备注<负重+50>,角色最大负重就是400+50

谢谢答主
回复

使用道具 举报

梦石
3
星屑
7336
在线时间
608 小时
注册时间
2019-9-15
回帖
112

R考场第七期金奖

发表于 2020-4-8 02:24:59 | 显示全部楼层
xyzgwx 发表于 2020-4-7 22:51
抱歉,因为网络问题,现在才回复

脚本很好,谢谢解答

啊哈哈 没关系没关系 不过今天有点累了 刚看到消息 明天看一下吧【

评分

参与人数 1赞 +1 收起 理由
xyzgwx + 1 塞糖

查看全部评分

********
回复

使用道具 举报

梦石
0
星屑
40
在线时间
20 小时
注册时间
2019-6-26
回帖
12
发表于 2020-4-8 16:07:54 | 显示全部楼层
弱弱的问一下,物品栏中显示的负重 怎么调整高度啊
回复

使用道具 举报

梦石
3
星屑
7336
在线时间
608 小时
注册时间
2019-9-15
回帖
112

R考场第七期金奖

发表于 2020-4-8 16:15:10 | 显示全部楼层
1114905982 发表于 2020-4-8 16:07
弱弱的问一下,物品栏中显示的负重 怎么调整高度啊

这个分别是在
177行 (负重:)
180行 (超重!)
183行 (获取当前重量与最大重量)
高度的话就是 改上下位置的那里就行了
contents.draw_text(左右位置,上下位置,100,16,"超重!")
********
回复

使用道具 举报

梦石
0
星屑
40
在线时间
20 小时
注册时间
2019-6-26
回帖
12
发表于 2020-4-8 16:37:18 | 显示全部楼层
Cupidk爱呗茶 发表于 2020-4-8 16:15
这个分别是在
177行 (负重:)
180行 (超重!)

QQ截图20200408163617.png 大佬我是想修改这个地方     之前测试了您说的几行代码   都没有成功          还有请问这个物品栏中的总负重在哪里修改   
回复

使用道具 举报

梦石
3
星屑
7336
在线时间
608 小时
注册时间
2019-9-15
回帖
112

R考场第七期金奖

发表于 2020-4-8 17:01:19 | 显示全部楼层
本帖最后由 Cupidk爱呗茶 于 2020-4-8 17:09 编辑
1114905982 发表于 2020-4-8 16:37
大佬我是想修改这个地方     之前测试了您说的几行代码   都没有成功          还有请问这个物品栏中的 ...


啊啊啊真是不好意思 我理解错意思了 那些是装备栏的负重窗口
这个窗口位置可以在294行后面设置的
添加一句@load_window.y = 想要的高度
总负重的话 就是在第53行的公式里设置奥 每有一名角色存在 负重就乘以几 比如说公式是1 当前队伍里有1名角色 那么总负重就是1。  当有4名队员时 总负重为1*4也就是4
********
回复

使用道具 举报

梦石
0
星屑
40
在线时间
20 小时
注册时间
2019-6-26
回帖
12
发表于 2020-4-8 17:29:56 | 显示全部楼层
  谢谢大佬指点   
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部