查看: 22099|回复: 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
星屑
7346
在线时间
609 小时
注册时间
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
星屑
7346
在线时间
609 小时
注册时间
2019-9-15
回帖
112

R考场第七期金奖

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

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

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

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

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

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

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

  80.   # 装备在身上的装备是否算入负重
  81.   Equip_SW = true      #true 计算 / false 不计算
  82.   #         "★★★★★★ 注意 ★★★★★★"
  83.   # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  84.   # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  85.   # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  86.   # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
  87. end
  88. #==============================================================================
  89. # ☆ 装备负重 ☆#######################
  90. #==============================================================================
  91. class Game_Actor
  92.   include VIPArcher::Load
  93.   attr_accessor :equip_weight      #已装备物品重量
  94.   attr_accessor :equip_weightmax   #最大负重
  95.   alias setup_plus setup
  96.   alias refresh_plus refresh
  97.   alias change_equip_plus change_equip
  98.   #--------------------------------------------------------------------------
  99.   # ● 设置
  100.   #--------------------------------------------------------------------------
  101.   def setup(actor_id)
  102.     setup_plus(actor_id)
  103.     @equip_weight = equips.compact.inject(0) {|r, item| r += item.load }
  104.     @equip_weightmax = loadmax
  105.   end  
  106.   #--------------------------------------------------------------------------
  107.   # ● 获取队伍角色最大负重
  108.   #--------------------------------------------------------------------------
  109.    def loadmax
  110.     return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  111.     return Default_Equip
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 更换装备
  115.   #     slot_id : 装备栏 ID
  116.   #     item    : 武器/护甲(为 nil 时装备解除)
  117.   #--------------------------------------------------------------------------
  118.   def change_equip(slot_id, item)
  119.   change_equip_plus(slot_id, item)
  120.   $equip_map = true  
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 刷新
  124.   #--------------------------------------------------------------------------
  125.   def refresh
  126. a = equips.compact.inject(0) {|r, item| r += item.load }
  127.    if @equip_weight != a
  128.     @equip_weight = a
  129.    end
  130.    refresh_plus
  131.   end
  132. end
  133. #==============================================================================
  134. #  ☆ 装备超重提示 ☆#######################
  135. #==============================================================================
  136. class Scene_Map < Scene_Base
  137. include  VIPArcher::Load
  138. alias start_plus start
  139. def start
  140.    start_plus
  141.    equiptips
  142. end  
  143.   #--------------------------------------------------------------------------
  144.   # ● 装备超重提示
  145.   #--------------------------------------------------------------------------
  146.   def equiptips
  147.       if $equip_map
  148.      for i in 1..$data_system.party_members.clone.size
  149.    if $game_actors[i].equip_weight > $game_actors[i].equip_weightmax
  150.       $game_message.position = Messset
  151.       $equip_map = false
  152.      return $game_message.texts.push("#{Message2}")
  153.     end
  154.    end
  155.   end
  156. end
  157. end   
  158. #==============================================================================
  159. #  ☆ 能力窗口 ☆#######################
  160. #==============================================================================
  161. class Window_EquipStatus
  162.   include VIPArcher::Load #继承了该模块
  163.   alias refresh_plus refresh
  164.   #--------------------------------------------------------------------------
  165.   # ● 刷新
  166.   #--------------------------------------------------------------------------
  167.   def refresh
  168.   refresh_plus
  169.   if EQUIPSWLOAD
  170.   contents.font.size = 16 ;contents.font.color = text_color(21)
  171. if @actor !=nil
  172.   x=80
  173.    contents.draw_text(x,0,100,16,"负重:")
  174.    if @actor.equip_weight > @actor.equip_weightmax
  175.    contents.font.color = text_color(10)
  176.    contents.draw_text(x-30,20,100,16,"超重!")
  177.    end
  178.   contents.font.color = text_color(0)
  179.   contents.draw_text(x+50,0,100,16,"#{@actor.equip_weight}/#{@actor.equip_weightmax}")
  180. end  
  181.   contents.font.size = 21
  182.   end
  183. end
  184. end  
  185. #==============================================================================
  186. # ☆ 设定结束 ☆
  187. #==============================================================================
  188. class RPG::BaseItem
  189.   include VIPArcher::Load #继承了该模块
  190.   #--------------------------------------------------------------------------
  191.   # ● 获取道具的重量
  192.   #--------------------------------------------------------------------------
  193.   def load
  194.     return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
  195.     return $1.to_i if @note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  196.     return Default_Load #若备注没有 <负重 (数字)> 则自动替换为该常量
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● 新增负重帮助内容
  200.   #--------------------------------------------------------------------------
  201.   def description
  202.     if Help_SW && load && load != 0
  203.       return @description + "\n\\}重量:#{load}"
  204.     else
  205.       return @description
  206.     end
  207.   end unless $VIPArcherScript[:help_ex]
  208. end
  209. #==============================================================================
  210. #  显示当前负重信息的窗口
  211. #==============================================================================
  212. class Window_Load < Window_Base
  213.   include VIPArcher::Load
  214.   #--------------------------------------------------------------------------
  215.   # ● 初始化对象
  216.   #--------------------------------------------------------------------------
  217.   def initialize
  218.     super(Graphics.width - window_width, 72, window_width, fitting_height(1))
  219.     refresh
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ● 获取窗口的宽度
  223.   #--------------------------------------------------------------------------
  224.   def window_width
  225.     Width
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 刷新
  229.   #--------------------------------------------------------------------------
  230.   def refresh
  231.     contents.clear
  232.     contents.font.size - 4
  233.     draw_text(0, 0, window_width - 64, 24,load_name,0)
  234.     draw_text(0, 0, window_width - 24, 24, weight,2)
  235.     @temp_load = $game_party.current_load
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 获取当前负重信息
  239.   #--------------------------------------------------------------------------
  240.   def weight
  241.     "#{$game_party.current_load}/#{$game_party.total_load}"
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● 获取负重前显示文字
  245.   #--------------------------------------------------------------------------
  246.   def load_name
  247.     Load_Name
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 更新画面
  251.   #--------------------------------------------------------------------------
  252.   def update
  253.     super
  254.     refresh if @temp_load != $game_party.current_load
  255.   end
  256. end
  257. #-------------------------------------------------------------------------------
  258. class Window_ItemCategory < Window_HorzCommand
  259.   include VIPArcher::Load
  260.   #--------------------------------------------------------------------------
  261.   # ● 获取窗口的宽度
  262.   #--------------------------------------------------------------------------
  263.   def window_width
  264.     scene_item_is? ? Graphics.width - Width : Graphics.width
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● 获取列数
  268.   #--------------------------------------------------------------------------
  269.   def col_max
  270.     return scene_item_is? ? 3 : 4
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # ● 判断是否为物品栏场景
  274.   #--------------------------------------------------------------------------
  275.   def scene_item_is?
  276.     return SceneManager.scene_is?(Scene_Item)
  277.   end
  278. end
  279. #==============================================================================
  280. # ■ 物品界面显示负重栏
  281. #==============================================================================
  282. class Scene_Item < Scene_ItemBase
  283.   include VIPArcher::Load
  284.   #--------------------------------------------------------------------------
  285.   # ● 开始处理
  286.   #--------------------------------------------------------------------------
  287.   alias load_start start
  288.   def start
  289.     load_start
  290.     @load_window = Window_Load.new
  291.     @load_window.viewport = @viewport
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● 结束处理
  295.   #--------------------------------------------------------------------------
  296.   alias load_terminate terminate
  297.   def terminate
  298.     load_terminate
  299.     @load_window.dispose
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 更新画面
  303.   #--------------------------------------------------------------------------
  304.   alias load_update update
  305.   def update
  306.     #--------------------------------------------------------------------------
  307.     # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
  308.     #--------------------------------------------------------------------------
  309.     if Input.trigger?(Input::X) && Lose_SW
  310.       item = @item_window.item
  311.       if item.is_a?(RPG::Item) && item.key_item?
  312.         Sound.play_buzzer
  313.       else
  314.         Sound.play_cancel
  315.         $game_party.lose_item(item, 1)
  316.         @item_window.refresh
  317.       end unless item == nil
  318.     end
  319.     @load_window.update
  320.     load_update
  321.   end
  322. end
  323. #-------------------------------------------------------------------------------
  324. class Window_ShopNumber < Window_Selectable
  325.   include VIPArcher::Load
  326.   attr_accessor :buy_or_sell                    #买入的标志
  327.   #--------------------------------------------------------------------------
  328.   # ● 刷新
  329.   #--------------------------------------------------------------------------
  330.   alias vip_shopnumber_refresh refresh
  331.   def refresh
  332.     vip_shopnumber_refresh
  333.     draw_current_weight(@item)
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ○ 买卖时重量变化的描绘
  337.   #--------------------------------------------------------------------------
  338.   def draw_current_weight(item)
  339.     current = $game_party.current_load
  340.     weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
  341.     width = contents_width - 8
  342.     cx = text_size(@currency_unit).width
  343.     change_color(system_color)
  344.     draw_text(4, y + 60, width, line_height, "#{Load_Name}")
  345.     change_color(normal_color)
  346.     wt = "#{weight} / #{$game_party.total_load}"
  347.     draw_text(4, y + 60, width, line_height, wt, 2)
  348.   end
  349. end
  350. #-------------------------------------------------------------------------------
  351. class Window_ShopStatus < Window_Base
  352.   include VIPArcher::Load
  353.   #--------------------------------------------------------------------------
  354.   # ● 刷新
  355.   #--------------------------------------------------------------------------
  356.   alias vip_shopstatus_refresh refresh
  357.   def refresh
  358.     vip_shopstatus_refresh
  359.     draw_weight_occupy(4, 24)
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # ● 绘制持负重信息
  363.   #--------------------------------------------------------------------------
  364.   def draw_weight_occupy(x, y)
  365.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  366.     change_color(system_color)
  367.     draw_text(rect, "#{Load_Name}", 3)
  368.     change_color(normal_color)
  369.     weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
  370.     draw_text(rect, weight, 2)
  371.     @temp_load = $game_party.current_load
  372.   end
  373. end
  374. #==============================================================================
  375. # ■ 获取队伍最大负重
  376. #==============================================================================
  377. class Game_Party < Game_Unit
  378.   include VIPArcher::Load
  379.   #--------------------------------------------------------------------------
  380.   # ● 定义实例变量
  381.   #--------------------------------------------------------------------------
  382.   attr_accessor :current_load, :load_trade_item     #负重
  383.   #--------------------------------------------------------------------------
  384.   # ● 初始化对象
  385.   #--------------------------------------------------------------------------
  386.   alias load_initialize initialize
  387.   def initialize
  388.     load_initialize
  389.     total_load
  390.     @current_load = 0
  391.     @total_load = 0
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # ● 获取队伍最大负重
  395.   #--------------------------------------------------------------------------
  396.   def total_load
  397.     return $game_variables[Load_Var] if Load_Var > 0
  398.     all_members.inject(0) {|total,actor| total + actor.load }
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 判断物品负重是否已满
  402.   #--------------------------------------------------------------------------
  403.   def load_max?
  404.     return false if @current_load == 0
  405.     @current_load >= total_load
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● 获取队伍的总装备重量
  409.   #--------------------------------------------------------------------------
  410. #  def equiptotal
  411. #    load=0
  412. #    for i in 1..$data_system.party_members.clone.size
  413. #    load += $game_actors[i].equip_weight
  414. #    end
  415. #    return load
  416. #  end  
  417.   #--------------------------------------------------------------------------
  418.   # ● 判断装备负重是否已满##################################
  419.   #--------------------------------------------------------------------------
  420.   def eload_max?
  421.    max=0
  422.    for i in 1..$data_system.party_members.clone.size
  423.    max+=1 if $game_actors[i].equip_weight <= $game_actors[i].equip_weightmax
  424.    return false if max == $data_system.party_members.clone.size
  425.    end
  426. end  
  427.   #--------------------------------------------------------------------------
  428.   # ● 增加/减少物品时计算负重
  429.   #--------------------------------------------------------------------------
  430.   alias load_gain_item gain_item
  431.   def gain_item(item, n, include_equip = false)
  432.     return if item.nil?
  433.     load_gain_item(item, n, include_equip)
  434.     @current_load += item.load * n if !@load_trade_item
  435.   end
  436. end
  437. #-------------------------------------------------------------------------------
  438. class Game_Actor < Game_Battler
  439.   include VIPArcher::Load
  440.   #--------------------------------------------------------------------------
  441.   # ● 装备时不计算负重的增减 * 方法覆盖
  442.   #     new_item : 取出的物品
  443.   #     old_item : 放入的物品
  444.   #--------------------------------------------------------------------------
  445.   def trade_item_with_party(new_item, old_item)
  446.     return false if new_item && !$game_party.has_item?(new_item)
  447.     $game_party.load_trade_item = true if Equip_SW == true
  448.     $game_party.gain_item(old_item, 1)
  449.     $game_party.lose_item(new_item, 1)
  450.     $game_party.load_trade_item = false if Equip_SW == true
  451.     return true
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ● 获取角色的负重上限
  455.   #--------------------------------------------------------------------------
  456.   def load
  457.     eval(Load_Eval).to_i
  458.   end
  459. end
  460. #==============================================================================
  461. # ■ 增减物品时判断负重
  462. #==============================================================================
  463. class Game_Interpreter
  464.   include VIPArcher::Load
  465.   #--------------------------------------------------------------------------
  466.   # ● 增减道具
  467.   #--------------------------------------------------------------------------
  468.   alias load_command_126 command_126
  469.   def command_126
  470.     n = operate_value(@params[1], @params[2], @params[3])
  471.     return command_115 if check_load(@params[0], 0, n) && Stop_SW
  472.     load_command_126
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # ● 增減武器
  476.   #--------------------------------------------------------------------------
  477.   alias load_command_127 command_127
  478.   def command_127
  479.     n = operate_value(@params[1], @params[2], @params[3])
  480.     return command_115 if check_load(@params[0], 1, n) && Stop_SW
  481.     load_command_127
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ● 增減防具
  485.   #--------------------------------------------------------------------------
  486.   alias load_command_128 command_128
  487.   def command_128
  488.     n = operate_value(@params[1], @params[2], @params[3])
  489.     return command_115 if check_load(@params[0], 2, n) && Stop_SW
  490.     load_command_128
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # ● 增减物品超重时提示
  494.   #--------------------------------------------------------------------------
  495.   def check_load(item_id, type, n)
  496.     case type
  497.     when 0; item = $data_items[item_id]
  498.     when 1; item = $data_weapons[item_id]
  499.     when 2; item = $data_armors[item_id]
  500.     end
  501.     if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  502.       $game_message.texts.push("#{Message}") if $game_message.visible != true
  503.       $game_message.visible = true
  504.     end
  505.     return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ● 更改负重
  509.   #--------------------------------------------------------------------------
  510.   def current_load(current_load,assign = false)
  511.     if assign
  512.       $game_party.current_load = current_load
  513.     else
  514.       $game_party.current_load += current_load
  515.     end
  516.   end
  517. end
  518. #==============================================================================
  519. # ★ 满负重时限制行动 ★
  520. #==============================================================================
  521. class Game_Player < Game_Character
  522.   include VIPArcher::Load
  523.   #--------------------------------------------------------------------------
  524.   # ● 判定是否可以移动###################
  525.   #--------------------------------------------------------------------------
  526.   alias load_movable? movable?
  527.   def movable?
  528.     return false if $game_party.load_max? && !Movable
  529.     return false if $game_party.eload_max? && !Movable ###################
  530.     load_movable?
  531.   end
  532. end
  533. #==============================================================================
  534. # ★ 满负重时降低移动速度 ★
  535. #==============================================================================
  536. class Game_CharacterBase
  537.   include VIPArcher::Load
  538.   #--------------------------------------------------------------------------
  539.   # ● 获取移动速度(判断是否跑步)################
  540.   #--------------------------------------------------------------------------
  541.   alias load_real_move_speed real_move_speed
  542.   def real_move_speed
  543.     return Move_Speed if $game_party.load_max? && Movable
  544.     return Move_Speed if $game_party.eload_max? && Movable ################
  545.     load_real_move_speed
  546.   end
  547. end
  548. #==============================================================================
  549. # ★ 满负重时限制购买 ★
  550. #==============================================================================
  551. class Window_ShopBuy < Window_Selectable
  552.   #--------------------------------------------------------------------------
  553.   # ● 查询商品是否可买
  554.   #--------------------------------------------------------------------------
  555.   alias load_enable? enable?
  556.   def enable?(item)
  557.     load_enable?(item) && !$game_party.load_max?
  558.   end
  559. end
  560. #==============================================================================
  561. # ★ 根据负重设定可购买的物品数量 ★
  562. #==============================================================================
  563. class Scene_Shop < Scene_MenuBase
  564.   #--------------------------------------------------------------------------
  565.   # ● 指令“买入”
  566.   #--------------------------------------------------------------------------
  567.   alias vip_load_command_buy command_buy
  568.   def command_buy
  569.     vip_load_command_buy
  570.     @number_window.buy_or_sell = true
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● 指令“卖出”
  574.   #--------------------------------------------------------------------------
  575.   alias vip_load_command_sell command_sell
  576.   def command_sell
  577.     vip_load_command_sell
  578.     @number_window.buy_or_sell = false
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # ● 获取可以买入的最大值
  582.   #--------------------------------------------------------------------------
  583.   alias load_max_buy max_buy
  584.   def max_buy
  585.     vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
  586.     $game_party.current_load) / @item.load
  587.     [load_max_buy,vip].min
  588.   end
  589. end
复制代码

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


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

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

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

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

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

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

  97.   # 装备在身上的装备是否算入负重
  98.   Equip_SW = false      #true 计算 / false 不计算
  99.   #         "★★★★★★ 注意 ★★★★★★"
  100.   # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  101.   # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  102.   # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  103.   # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
  104. end
  105. #==============================================================================
  106. # ☆ 装备负重 ☆#######################
  107. #==============================================================================
  108. class Game_Actor
  109.   include VIPArcher::Load
  110.   attr_accessor :equip_weight      #已装备物品重量
  111.   attr_accessor :equip_weightmax   #最大负重
  112.   alias setup_plus setup
  113.   alias refresh_plus refresh
  114.   alias change_equip_plus change_equip
  115.   #--------------------------------------------------------------------------
  116.   # ● 设置
  117.   #--------------------------------------------------------------------------
  118.   def setup(actor_id)
  119.     setup_plus(actor_id)
  120.     @equip_weight = equips.compact.inject(0) {|r, item| r += item.load }
  121.     @equip_weightmax = loadmax
  122.   end  
  123.   #--------------------------------------------------------------------------
  124.   # ● 获取队伍角色最大负重
  125.   #--------------------------------------------------------------------------
  126. #   def loadmax
  127. #    return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  128. #    return Default_Equip
  129. #  end
  130.   #--------------------------------------------------------------------------
  131.   # ● 获取队伍角色基础负重
  132.   #--------------------------------------------------------------------------
  133.   def jichuload
  134.     return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  135.     return Default_Equip
  136.   end
  137.     #--------------------------------------------------------------------------
  138.   # ● 获取队伍角色最大负重
  139.   #--------------------------------------------------------------------------
  140.   def loadmax
  141.     return jichuload  + equips.compact.inject(0) {|r, item| r += item.zhong }
  142.   end  
  143.   #--------------------------------------------------------------------------
  144.   # ● 更换装备
  145.   #     slot_id : 装备栏 ID
  146.   #     item    : 武器/护甲(为 nil 时装备解除)
  147.   #--------------------------------------------------------------------------
  148.   def change_equip(slot_id, item)
  149.   change_equip_plus(slot_id, item)
  150.   $equip_map = true  
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 刷新
  154.   #--------------------------------------------------------------------------
  155.   def refresh
  156. a = equips.compact.inject(0) {|r, item| r += item.load }
  157.    if @equip_weight != a
  158.     @equip_weight =  a
  159.   end
  160.    @equip_weightmax = loadmax if @equip_weightmax != loadmax
  161.     refresh_plus
  162.   end
  163. end
  164. #==============================================================================
  165. #  ☆ 超重提示 ☆#######################
  166. #==============================================================================
  167. class Scene_Map < Scene_Base
  168. include  VIPArcher::Load
  169. alias start_plus start
  170. def start
  171.    start_plus
  172.    tipss
  173. end  
  174.   #--------------------------------------------------------------------------
  175.   # ● 超重提示
  176.   #--------------------------------------------------------------------------
  177.   def tipss
  178.     #####装备超重提示######
  179.       if EQUIP_TIPS && $equip_map
  180.      for i in 1..$data_system.party_members.clone.size
  181.    if $game_actors[i].equip_weight > $game_actors[i].equip_weightmax
  182.       $game_message.position = Messset
  183.       $equip_map = false
  184.      return $game_message.texts.push("#{Message2}")
  185.     end
  186.    end
  187.   end
  188.     #####物品超重提示#######
  189.     if ITEM_TIPS && $item_map
  190.   if $game_party.current_load > $game_party.total_load  
  191.       $game_message.position = Messset2
  192.       $item_map = false
  193.      return $game_message.texts.push("#{Message}")
  194.    end  
  195.   end
  196. end
  197. end   
  198. #==============================================================================
  199. #  ☆ 能力窗口 ☆#######################
  200. #==============================================================================
  201. class Window_EquipStatus
  202.   include VIPArcher::Load #继承了该模块
  203.   alias refresh_plus refresh
  204.   #--------------------------------------------------------------------------
  205.   # ● 刷新
  206.   #--------------------------------------------------------------------------
  207.   def refresh
  208.   refresh_plus
  209.   if EQUIPSWLOAD
  210.   contents.font.size = 16 ;contents.font.color = text_color(21)
  211. if @actor !=nil
  212.   x=80
  213.    contents.draw_text(x,0,100,16,"负重:")
  214.    if @actor.equip_weight > @actor.equip_weightmax
  215.    contents.font.color = text_color(10)
  216.    contents.draw_text(x-30,20,100,16,"超重!")
  217.    end
  218.   contents.font.color = text_color(0)
  219.   contents.draw_text(x+50,0,100,16,"#{@actor.equip_weight}/#{@actor.equip_weightmax}")
  220. end  
  221.   contents.font.size = 21
  222.   end
  223. end
  224. end  
  225. #==============================================================================
  226. # ☆ 设定结束 ☆
  227. #==============================================================================
  228. class RPG::BaseItem
  229.   include VIPArcher::Load #继承了该模块
  230.   #--------------------------------------------------------------------------
  231.   # ● 获取道具的重量
  232.   #--------------------------------------------------------------------------
  233.   def load
  234.     return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
  235.     return $1.to_i if @note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  236.     return Default_Load #若备注没有 <负重 (数字)> 则自动替换为该常量
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 获取道具的属性加成
  240.   #--------------------------------------------------------------------------
  241.   def zhong
  242.     return unless self.is_a?(RPG::EquipItem)
  243.     return $1.to_i if @note =~ /<(?:load加成|负重加成|負重加成)\s*(\d+)>/i
  244.     return EQUIPZHONG #若备注没有 <负重加成 (数字)> 则自动替换为该常量
  245.   end  
  246.   #--------------------------------------------------------------------------
  247.   # ● 新增负重帮助内容
  248.   #--------------------------------------------------------------------------
  249.   def description
  250.     if Help_SW && load && load != 0
  251.      return @description + "\n\\}重量:#{load} #{LoadJC_Name}#{zhong}"  if zhong && zhong != 0
  252.      return @description + "\n\\}重量:#{load}"
  253.    else######################################
  254.      return @description + "\n\\}#{LoadJC_Name}#{zhong}" if zhong && zhong != 0
  255.      return @description
  256.     end
  257.   end unless $VIPArcherScript[:help_ex]
  258. end
  259. #==============================================================================
  260. #  显示当前负重信息的窗口
  261. #==============================================================================
  262. class Window_Load < Window_Base
  263.   include VIPArcher::Load
  264.   #--------------------------------------------------------------------------
  265.   # ● 初始化对象
  266.   #--------------------------------------------------------------------------
  267.   def initialize
  268.     super(Graphics.width - window_width, 72, window_width, fitting_height(1))
  269.     refresh
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 获取窗口的宽度
  273.   #--------------------------------------------------------------------------
  274.   def window_width
  275.     Width
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 刷新
  279.   #--------------------------------------------------------------------------
  280.   def refresh
  281.     contents.clear
  282.     contents.font.size - 4
  283.     draw_text(0, 0, window_width - 64, 24,load_name,0)
  284.     draw_text(0, 0, window_width - 24, 24, weight,2)
  285.     @temp_load = $game_party.current_load
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● 获取当前负重信息
  289.   #--------------------------------------------------------------------------
  290.   def weight
  291.     "#{$game_party.current_load}/#{$game_party.total_load}"
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● 获取负重前显示文字
  295.   #--------------------------------------------------------------------------
  296.   def load_name
  297.     Load_Name
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● 更新画面
  301.   #--------------------------------------------------------------------------
  302.   def update
  303.     super
  304.     refresh if @temp_load != $game_party.current_load
  305.   end
  306. end
  307. #-------------------------------------------------------------------------------
  308. class Window_ItemCategory < Window_HorzCommand
  309.   include VIPArcher::Load
  310.   #--------------------------------------------------------------------------
  311.   # ● 获取窗口的宽度
  312.   #--------------------------------------------------------------------------
  313.   def window_width
  314.     scene_item_is? ? Graphics.width - Width : Graphics.width
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 获取列数
  318.   #--------------------------------------------------------------------------
  319.   def col_max
  320.     return scene_item_is? ? 3 : 4
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 判断是否为物品栏场景
  324.   #--------------------------------------------------------------------------
  325.   def scene_item_is?
  326.     return SceneManager.scene_is?(Scene_Item)
  327.   end
  328. end
  329. #==============================================================================
  330. # ■ 物品界面显示负重栏
  331. #==============================================================================
  332. class Scene_Item < Scene_ItemBase
  333.   include VIPArcher::Load
  334.   #--------------------------------------------------------------------------
  335.   # ● 开始处理
  336.   #--------------------------------------------------------------------------
  337.   alias load_start start
  338.   def start
  339.     load_start
  340.     @load_window = Window_Load.new
  341.     @load_window.viewport = @viewport
  342.     $item_map = true
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 结束处理
  346.   #--------------------------------------------------------------------------
  347.   alias load_terminate terminate
  348.   def terminate
  349.     load_terminate
  350.     @load_window.dispose
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● 更新画面
  354.   #--------------------------------------------------------------------------
  355.   alias load_update update
  356.   def update
  357.     #--------------------------------------------------------------------------
  358.     # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
  359.     #--------------------------------------------------------------------------
  360.     if Input.trigger?(Input::X) && Lose_SW
  361.       item = @item_window.item
  362.       if item.is_a?(RPG::Item) && item.key_item?
  363.         Sound.play_buzzer
  364.       else
  365.         Sound.play_cancel
  366.         $game_party.lose_item(item, 1)
  367.         @item_window.refresh
  368.       end unless item == nil
  369.     end
  370.     @load_window.update
  371.     load_update
  372.   end
  373. end
  374. #-------------------------------------------------------------------------------
  375. class Window_ShopNumber < Window_Selectable
  376.   include VIPArcher::Load
  377.   attr_accessor :buy_or_sell                    #买入的标志
  378.   #--------------------------------------------------------------------------
  379.   # ● 刷新
  380.   #--------------------------------------------------------------------------
  381.   alias vip_shopnumber_refresh refresh
  382.   def refresh
  383.     vip_shopnumber_refresh
  384.     draw_current_weight(@item)
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # ○ 买卖时重量变化的描绘
  388.   #--------------------------------------------------------------------------
  389.   def draw_current_weight(item)
  390.     current = $game_party.current_load
  391.     weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
  392.     width = contents_width - 8
  393.     cx = text_size(@currency_unit).width
  394.     change_color(system_color)
  395.     draw_text(4, y + 60, width, line_height, "#{Load_Name}")
  396.     change_color(normal_color)
  397.     wt = "#{weight} / #{$game_party.total_load}"
  398.     draw_text(4, y + 60, width, line_height, wt, 2)
  399.   end
  400. end
  401. #-------------------------------------------------------------------------------
  402. class Window_ShopStatus < Window_Base
  403.   include VIPArcher::Load
  404.   #--------------------------------------------------------------------------
  405.   # ● 刷新
  406.   #--------------------------------------------------------------------------
  407.   alias vip_shopstatus_refresh refresh
  408.   def refresh
  409.     vip_shopstatus_refresh
  410.     draw_weight_occupy(4, 24)
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ● 绘制持负重信息
  414.   #--------------------------------------------------------------------------
  415.   def draw_weight_occupy(x, y)
  416.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  417.     change_color(system_color)
  418.     draw_text(rect, "#{Load_Name}", 3)
  419.     change_color(normal_color)
  420.     weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
  421.     draw_text(rect, weight, 2)
  422.     @temp_load = $game_party.current_load
  423.   end
  424. end
  425. #==============================================================================
  426. # ■ 获取队伍最大负重
  427. #==============================================================================
  428. class Game_Party < Game_Unit
  429.   include VIPArcher::Load
  430.   #--------------------------------------------------------------------------
  431.   # ● 定义实例变量
  432.   #--------------------------------------------------------------------------
  433.   attr_accessor :current_load, :load_trade_item     #负重
  434.   #--------------------------------------------------------------------------
  435.   # ● 初始化对象
  436.   #--------------------------------------------------------------------------
  437.   alias load_initialize initialize
  438.   def initialize
  439.     load_initialize
  440.     total_load
  441.     @current_load = 0
  442.     @total_load = 0
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● 获取队伍最大负重
  446.   #--------------------------------------------------------------------------
  447.   def total_load
  448.     return $game_variables[Load_Var] if Load_Var > 0
  449.     all_members.inject(0) {|total,actor| total + actor.load }
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 判断物品负重是否已满
  453.   #--------------------------------------------------------------------------
  454.   def load_max?
  455.     return false if @current_load == 0
  456.     @current_load > total_load
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● 获取队伍的总装备重量
  460.   #--------------------------------------------------------------------------
  461. #  def equiptotal
  462. #    load=0
  463. #    for i in 1..$data_system.party_members.clone.size
  464. #    load += $game_actors[i].equip_weight
  465. #    end
  466. #    return load
  467. #  end  
  468.   #--------------------------------------------------------------------------
  469.   # ● 判断装备负重是否已满##################################
  470.   #--------------------------------------------------------------------------
  471.   def eload_max?
  472.    max=0
  473.    for i in 1..$data_system.party_members.clone.size
  474.    max+=1 if $game_actors[i].equip_weight <= $game_actors[i].equip_weightmax
  475.    return false if max == $data_system.party_members.clone.size
  476.    end
  477. end  
  478.   #--------------------------------------------------------------------------
  479.   # ● 增加/减少物品时计算负重
  480.   #--------------------------------------------------------------------------
  481.   alias load_gain_item gain_item
  482.   def gain_item(item, n, include_equip = false)
  483.     return if item.nil?
  484.     load_gain_item(item, n, include_equip)
  485.     @current_load += item.load * n if !@load_trade_item
  486.   end
  487. end
  488. #-------------------------------------------------------------------------------
  489. class Game_Actor < Game_Battler
  490.   include VIPArcher::Load
  491.   #--------------------------------------------------------------------------
  492.   # ● 装备时不计算负重的增减 * 方法覆盖
  493.   #     new_item : 取出的物品
  494.   #     old_item : 放入的物品
  495.   #--------------------------------------------------------------------------
  496.   def trade_item_with_party(new_item, old_item)
  497.     return false if new_item && !$game_party.has_item?(new_item)
  498.     $game_party.load_trade_item = true if Equip_SW == true
  499.     $game_party.gain_item(old_item, 1)
  500.     $game_party.lose_item(new_item, 1)
  501.     $game_party.load_trade_item = false if Equip_SW == true
  502.     return true
  503.   end
  504.   #--------------------------------------------------------------------------
  505.   # ● 获取角色的负重上限
  506.   #--------------------------------------------------------------------------
  507.   def load
  508.     eval(Load_Eval).to_i
  509.   end
  510. end
  511. #==============================================================================
  512. # ■ 增减物品时判断负重
  513. #==============================================================================
  514. class Game_Interpreter
  515.   include VIPArcher::Load
  516.   #--------------------------------------------------------------------------
  517.   # ● 增减道具
  518.   #--------------------------------------------------------------------------
  519.   alias load_command_126 command_126
  520.   def command_126
  521.     n = operate_value(@params[1], @params[2], @params[3])
  522.     return command_115 if check_load(@params[0], 0, n) && Stop_SW
  523.     load_command_126
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ● 增減武器
  527.   #--------------------------------------------------------------------------
  528.   alias load_command_127 command_127
  529.   def command_127
  530.     n = operate_value(@params[1], @params[2], @params[3])
  531.     return command_115 if check_load(@params[0], 1, n) && Stop_SW
  532.     load_command_127
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # ● 增減防具
  536.   #--------------------------------------------------------------------------
  537.   alias load_command_128 command_128
  538.   def command_128
  539.     n = operate_value(@params[1], @params[2], @params[3])
  540.     return command_115 if check_load(@params[0], 2, n) && Stop_SW
  541.     load_command_128
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ● 增减物品超重时提示
  545.   #--------------------------------------------------------------------------
  546.   def check_load(item_id, type, n)
  547.     case type
  548.     when 0; item = $data_items[item_id]
  549.     when 1; item = $data_weapons[item_id]
  550.     when 2; item = $data_armors[item_id]
  551.     end
  552.     if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  553.       $game_message.texts.push("#{Message}") if $game_message.visible != true
  554.       $game_message.visible = true
  555.     end
  556.     return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # ● 更改负重
  560.   #--------------------------------------------------------------------------
  561.   def current_load(current_load,assign = false)
  562.     if assign
  563.       $game_party.current_load = current_load
  564.     else
  565.       $game_party.current_load += current_load
  566.     end
  567.   end
  568. end
  569. #==============================================================================
  570. # ★ 满负重时限制行动 ★
  571. #==============================================================================
  572. class Game_Player < Game_Character
  573.   include VIPArcher::Load
  574.   #--------------------------------------------------------------------------
  575.   # ● 判定是否可以移动###################
  576.   #--------------------------------------------------------------------------
  577.   alias load_movable? movable?
  578.   def movable?
  579.     return false if $game_party.load_max? && !Movable
  580.     return false if $game_party.eload_max? && !Movable ###################
  581.     load_movable?
  582.   end
  583. end
  584. #==============================================================================
  585. # ★ 满负重时降低移动速度 ★
  586. #==============================================================================
  587. class Game_CharacterBase
  588.   include VIPArcher::Load
  589.   #--------------------------------------------------------------------------
  590.   # ● 获取移动速度(判断是否跑步)################
  591.   #--------------------------------------------------------------------------
  592.   alias load_real_move_speed real_move_speed
  593.   def real_move_speed
  594.     return Move_Speed if $game_party.load_max? && Movable
  595.     return Move_Speed if $game_party.eload_max? && Movable ################
  596.     load_real_move_speed
  597.   end
  598. end
  599. #==============================================================================
  600. # ★ 满负重时限制购买 ★
  601. #==============================================================================
  602. class Window_ShopBuy < Window_Selectable
  603.   #--------------------------------------------------------------------------
  604.   # ● 查询商品是否可买
  605.   #--------------------------------------------------------------------------
  606.   alias load_enable? enable?
  607.   def enable?(item)
  608.     load_enable?(item) && !$game_party.load_max?
  609.   end
  610. end
  611. #==============================================================================
  612. # ★ 根据负重设定可购买的物品数量 ★
  613. #==============================================================================
  614. class Scene_Shop < Scene_MenuBase
  615.   #--------------------------------------------------------------------------
  616.   # ● 指令“买入”
  617.   #--------------------------------------------------------------------------
  618.   alias vip_load_command_buy command_buy
  619.   def command_buy
  620.     vip_load_command_buy
  621.     @number_window.buy_or_sell = true
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ● 指令“卖出”
  625.   #--------------------------------------------------------------------------
  626.   alias vip_load_command_sell command_sell
  627.   def command_sell
  628.     vip_load_command_sell
  629.     @number_window.buy_or_sell = false
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ● 获取可以买入的最大值
  633.   #--------------------------------------------------------------------------
  634.   alias load_max_buy max_buy
  635.   def max_buy
  636.     vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
  637.     $game_party.current_load) / @item.load
  638.     [load_max_buy,vip].min
  639.   end
  640. end
复制代码


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


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

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

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

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

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

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

  105.   # 装备在身上的装备是否算入负重
  106.   Equip_SW = false      #true 计算 / false 不计算
  107.   #         "★★★★★★ 注意 ★★★★★★"
  108.   # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  109.   # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  110.   # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  111.   # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
  112. end
  113. #==============================================================================
  114. # ☆ 装备负重 ☆#######################
  115. #==============================================================================
  116. class Game_Actor
  117.   include VIPArcher::Load
  118.   attr_accessor :equip_weight      #已装备物品重量
  119.   attr_accessor :equip_weightmax   #最大负重
  120.   alias setup_plus setup
  121.   alias refresh_plus refresh
  122.   alias change_equip_plus change_equip
  123.   #--------------------------------------------------------------------------
  124.   # ● 设置
  125.   #--------------------------------------------------------------------------
  126.   def setup(actor_id)
  127.     setup_plus(actor_id)
  128.     @equip_weight =  equips.compact.inject(0) {|r, item| r += item.load }
  129.     @equip_weightmax = loadmax
  130.   end  
  131.   #--------------------------------------------------------------------------
  132.   # ● 获取能力重定义
  133.   #--------------------------------------------------------------------------
  134.   def param(param_id)
  135.     return trueload if $data_actors[id].note =~ /<炒鸡生命值>/ && param_id == 0   
  136.     value = param_base(param_id) + param_plus(param_id) #基础+额外
  137.     value *= param_rate(param_id) * param_buff_rate(param_id)
  138.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 获取队伍角色基础负重
  142.   #--------------------------------------------------------------------------
  143.   def jichuload
  144.     return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  145.     return Default_Equip
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 获取队伍角色可使用负重
  149.   #--------------------------------------------------------------------------
  150.   def trueload
  151.    return [@equip_weightmax - @equip_weight,1].max if @equip_weightmax && @equip_weight
  152.   end  
  153.   #--------------------------------------------------------------------------
  154.   # ● 获取队伍角色最大负重
  155.   #--------------------------------------------------------------------------
  156.   def loadmax
  157.     return jichuload  + equips.compact.inject(0) {|r, item| r += item.zhong }
  158.   end  
  159.   #--------------------------------------------------------------------------
  160.   # ● 更换装备
  161.   #     slot_id : 装备栏 ID
  162.   #     item    : 武器/护甲(为 nil 时装备解除)
  163.   #--------------------------------------------------------------------------
  164.   def change_equip(slot_id, item)
  165.   change_equip_plus(slot_id, item)
  166.   $equip_map = true  
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 刷新
  170.   #--------------------------------------------------------------------------
  171.   def refresh
  172.     a = equips.compact.inject(0) {|r, item| r += item.load }
  173.    if @equip_weight != a
  174.     @equip_weight = a
  175.   end
  176.    mhp if mhp != trueload
  177.    @equip_weightmax = loadmax if @equip_weightmax != loadmax
  178.    refresh_plus
  179.   end
  180. end
  181. #==============================================================================
  182. #  ☆ 超重提示 ☆#######################
  183. #==============================================================================
  184. class Scene_Map < Scene_Base
  185. include  VIPArcher::Load
  186. alias start_plus start
  187. def start
  188.    start_plus
  189.    tipss
  190. end  
  191.   #--------------------------------------------------------------------------
  192.   # ● 超重提示
  193.   #--------------------------------------------------------------------------
  194.   def tipss
  195.     a=""
  196.     b=Message2.clone
  197.     data=[]
  198.      #####装备超重提示######
  199.       if EQUIP_TIPS && $equip_map
  200.       for i in 1..$data_system.party_members.clone.size
  201.       data.push("#{i}号") if $game_actors[i].equip_weight > $game_actors[i].equip_weightmax
  202.      end
  203.    
  204.      for i in 1..$data_system.party_members.clone.size
  205.     if $game_actors[i].equip_weight > $game_actors[i].equip_weightmax
  206.       $game_message.position = Messset
  207.       $equip_map = false
  208.       
  209.      for j in 0...data.size
  210.      a+=data[j]
  211.      end  
  212.      b.sub!(/\XX/)  {"\\c[10]#{a}\\c[0]"}
  213.     return $game_message.texts.push("#{b}")
  214.     end
  215.   end
  216. end
  217.     #####物品超重提示#######
  218.     if ITEM_TIPS && $item_map
  219.   if $game_party.current_load > $game_party.total_load  
  220.       $game_message.position = Messset2
  221.       $item_map = false
  222.      return $game_message.texts.push("#{Message}")
  223.    end  
  224.   end
  225. end
  226. end   
  227. #==============================================================================
  228. #  ☆ 能力窗口 ☆#######################
  229. #==============================================================================
  230. class Window_EquipStatus
  231.   include VIPArcher::Load #继承了该模块
  232.   alias refresh_plus refresh
  233.   #--------------------------------------------------------------------------
  234.   # ● 刷新
  235.   #--------------------------------------------------------------------------
  236.   def refresh
  237.   refresh_plus
  238.   if EQUIPSWLOAD
  239.   contents.font.size = 16 ;contents.font.color = text_color(21)
  240. if @actor !=nil
  241.   id = @actor.id
  242.   x=70;x2=85
  243.   y=25
  244.   load = @actor.equip_weight + @actor.hp
  245.   contents.draw_text(x,0,100,16,"负重:")
  246.   
  247.     if $data_actors[id].note =~ /<炒鸡生命值>/
  248.    if load > @actor.equip_weightmax
  249.    a = load - @actor.equip_weightmax
  250.    contents.font.color = text_color(10)
  251.    contents.draw_text(x2-30,y,100,16,"超重")
  252.    contents.draw_text(x2-27,y+16,100,16,a)
  253.   end
  254.    contents.font.color = text_color(3);contents.font.size = 11
  255.    contents.draw_text(x+50,15,85,16,"("+"#{@actor.hp}"+")");contents.font.size = 16
  256.    
  257.   contents.font.color = text_color(0)
  258.   contents.draw_text(x+42,0,85,16,"#{load}/#{@actor.equip_weightmax}")
  259.    else ####################未使用炒鸡系统
  260.     if @actor.equip_weight > @actor.equip_weightmax
  261.    a = @actor.equip_weight - @actor.equip_weightmax
  262.    contents.font.color = text_color(10)
  263.    contents.draw_text(x2-30,y,100,16,"超重")
  264.    contents.draw_text(x2-27,y+16,100,16,a)
  265.    end
  266.   
  267.   contents.font.color = text_color(0)
  268.   contents.draw_text(x+42,0,85,16,"#{@actor.equip_weight}/#{@actor.equip_weightmax}")
  269.    end  ####################正则判断结束
  270. end  
  271.   contents.font.size = 22
  272.   end
  273. end
  274. end  
  275. #==============================================================================
  276. # ☆ 设定结束 ☆
  277. #==============================================================================
  278. class RPG::BaseItem
  279.   include VIPArcher::Load #继承了该模块
  280.   #--------------------------------------------------------------------------
  281.   # ● 获取道具的重量
  282.   #--------------------------------------------------------------------------
  283.   def load
  284.     return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
  285.     return $1.to_i if @note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  286.     return Default_Load #若备注没有 <负重 (数字)> 则自动替换为该常量
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● 获取道具的属性加成
  290.   #--------------------------------------------------------------------------
  291.   def zhong
  292.     return unless self.is_a?(RPG::EquipItem)
  293.     return $1.to_i if @note =~ /<(?:load加成|负重加成|負重加成)\s*(\d+)>/i
  294.     return EQUIPZHONG #若备注没有 <负重加成 (数字)> 则自动替换为该常量
  295.   end  
  296.   #--------------------------------------------------------------------------
  297.   # ● 新增负重帮助内容
  298.   #--------------------------------------------------------------------------
  299.   def description
  300.     if Help_SW && load && load != 0
  301.      return @description + "\n\\}重量:#{load} #{LoadJC_Name}#{zhong}"  if zhong && zhong != 0
  302.      return @description + "\n\\}重量:#{load}"
  303.    else######################################
  304.      return @description + "\n\\}#{LoadJC_Name}#{zhong}" if zhong && zhong != 0
  305.      return @description
  306.     end
  307.   end unless $VIPArcherScript[:help_ex]
  308. end
  309. #==============================================================================
  310. #  显示当前负重信息的窗口
  311. #==============================================================================
  312. class Window_Load < Window_Base
  313.   include VIPArcher::Load
  314.   #--------------------------------------------------------------------------
  315.   # ● 初始化对象
  316.   #--------------------------------------------------------------------------
  317.   def initialize
  318.     super(Graphics.width - window_width, 72, window_width, fitting_height(1))
  319.     refresh
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● 获取窗口的宽度
  323.   #--------------------------------------------------------------------------
  324.   def window_width
  325.     Width
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ● 刷新
  329.   #--------------------------------------------------------------------------
  330.   def refresh
  331.     contents.clear
  332.     contents.font.size - 4
  333.     draw_text(0, 0, window_width - 64, 24,load_name,0)
  334.     draw_text(0, 0, window_width - 24, 24, weight,2)
  335.     @temp_load = $game_party.current_load
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 获取当前负重信息
  339.   #--------------------------------------------------------------------------
  340.   def weight
  341.     "#{$game_party.current_load}/#{$game_party.total_load}"
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● 获取负重前显示文字
  345.   #--------------------------------------------------------------------------
  346.   def load_name
  347.     Load_Name
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● 更新画面
  351.   #--------------------------------------------------------------------------
  352.   def update
  353.     super
  354.     refresh if @temp_load != $game_party.current_load
  355.   end
  356. end
  357. #-------------------------------------------------------------------------------
  358. class Window_ItemCategory < Window_HorzCommand
  359.   include VIPArcher::Load
  360.   #--------------------------------------------------------------------------
  361.   # ● 获取窗口的宽度
  362.   #--------------------------------------------------------------------------
  363.   def window_width
  364.     scene_item_is? ? Graphics.width - Width : Graphics.width
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● 获取列数
  368.   #--------------------------------------------------------------------------
  369.   def col_max
  370.     return scene_item_is? ? 3 : 4
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 判断是否为物品栏场景
  374.   #--------------------------------------------------------------------------
  375.   def scene_item_is?
  376.     return SceneManager.scene_is?(Scene_Item)
  377.   end
  378. end
  379. #==============================================================================
  380. # ■ 物品界面显示负重栏
  381. #==============================================================================
  382. class Scene_Item < Scene_ItemBase
  383.   include VIPArcher::Load
  384.   #--------------------------------------------------------------------------
  385.   # ● 开始处理
  386.   #--------------------------------------------------------------------------
  387.   alias load_start start
  388.   def start
  389.     load_start
  390.     @load_window = Window_Load.new
  391.     @load_window.viewport = @viewport
  392.     $item_map = true
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ● 结束处理
  396.   #--------------------------------------------------------------------------
  397.   alias load_terminate terminate
  398.   def terminate
  399.     load_terminate
  400.     @load_window.dispose
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # ● 更新画面
  404.   #--------------------------------------------------------------------------
  405.   alias load_update update
  406.   def update
  407.     #--------------------------------------------------------------------------
  408.     # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
  409.     #--------------------------------------------------------------------------
  410.     if Input.trigger?(Input::X) && Lose_SW
  411.       item = @item_window.item
  412.       if item.is_a?(RPG::Item) && item.key_item?
  413.         Sound.play_buzzer
  414.       else
  415.         Sound.play_cancel
  416.         $game_party.lose_item(item, 1)
  417.         @item_window.refresh
  418.       end unless item == nil
  419.     end
  420.     @load_window.update
  421.     load_update
  422.   end
  423. end
  424. #-------------------------------------------------------------------------------
  425. class Window_ShopNumber < Window_Selectable
  426.   include VIPArcher::Load
  427.   attr_accessor :buy_or_sell                    #买入的标志
  428.   #--------------------------------------------------------------------------
  429.   # ● 刷新
  430.   #--------------------------------------------------------------------------
  431.   alias vip_shopnumber_refresh refresh
  432.   def refresh
  433.     vip_shopnumber_refresh
  434.     draw_current_weight(@item)
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ○ 买卖时重量变化的描绘
  438.   #--------------------------------------------------------------------------
  439.   def draw_current_weight(item)
  440.     current = $game_party.current_load
  441.     weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
  442.     width = contents_width - 8
  443.     cx = text_size(@currency_unit).width
  444.     change_color(system_color)
  445.     draw_text(4, y + 60, width, line_height, "#{Load_Name}")
  446.     change_color(normal_color)
  447.     wt = "#{weight} / #{$game_party.total_load}"
  448.     draw_text(4, y + 60, width, line_height, wt, 2)
  449.   end
  450. end
  451. #-------------------------------------------------------------------------------
  452. class Window_ShopStatus < Window_Base
  453.   include VIPArcher::Load
  454.   #--------------------------------------------------------------------------
  455.   # ● 刷新
  456.   #--------------------------------------------------------------------------
  457.   alias vip_shopstatus_refresh refresh
  458.   def refresh
  459.     vip_shopstatus_refresh
  460.     draw_weight_occupy(4, 24)
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ● 绘制持负重信息
  464.   #--------------------------------------------------------------------------
  465.   def draw_weight_occupy(x, y)
  466.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  467.     change_color(system_color)
  468.     draw_text(rect, "#{Load_Name}", 3)
  469.     change_color(normal_color)
  470.     weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
  471.     draw_text(rect, weight, 2)
  472.     @temp_load = $game_party.current_load
  473.   end
  474. end
  475. #==============================================================================
  476. # ■ 获取队伍最大负重
  477. #==============================================================================
  478. class Game_Party < Game_Unit
  479.   include VIPArcher::Load
  480.   #--------------------------------------------------------------------------
  481.   # ● 定义实例变量
  482.   #--------------------------------------------------------------------------
  483.   attr_accessor :current_load, :load_trade_item     #负重
  484.   #--------------------------------------------------------------------------
  485.   # ● 初始化对象
  486.   #--------------------------------------------------------------------------
  487.   alias load_initialize initialize
  488.   def initialize
  489.     load_initialize
  490.     total_load
  491.     @current_load = 0
  492.     @total_load = 0
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 获取队伍最大负重
  496.   #--------------------------------------------------------------------------
  497.   def total_load
  498.     return $game_variables[Load_Var] if Load_Var > 0
  499.     all_members.inject(0) {|total,actor| total + actor.load }
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 判断物品负重是否已满
  503.   #--------------------------------------------------------------------------
  504.   def load_max?
  505.     return false if @current_load == 0
  506.     @current_load > total_load
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # ● 获取队伍的总装备重量
  510.   #--------------------------------------------------------------------------
  511. #  def equiptotal
  512. #    load=0
  513. #    for i in 1..$data_system.party_members.clone.size
  514. #    load += $game_actors[i].equip_weight
  515. #    end
  516. #    return load
  517. #  end  
  518.   #--------------------------------------------------------------------------
  519.   # ● 判断装备负重是否已满##################################
  520.   #--------------------------------------------------------------------------
  521.   def eload_max?
  522.    max=0
  523.    for i in 1..$data_system.party_members.clone.size
  524.    max+=1 if $game_actors[i].equip_weight <= $game_actors[i].equip_weightmax
  525.    return false if max == $data_system.party_members.clone.size
  526.    end
  527. end  
  528.   #--------------------------------------------------------------------------
  529.   # ● 增加/减少物品时计算负重
  530.   #--------------------------------------------------------------------------
  531.   alias load_gain_item gain_item
  532.   def gain_item(item, n, include_equip = false)
  533.     return if item.nil?
  534.     load_gain_item(item, n, include_equip)
  535.     @current_load += item.load * n if !@load_trade_item
  536.   end
  537. end
  538. #-------------------------------------------------------------------------------
  539. class Game_Actor < Game_Battler
  540.   include VIPArcher::Load
  541.   #--------------------------------------------------------------------------
  542.   # ● 装备时不计算负重的增减 * 方法覆盖
  543.   #     new_item : 取出的物品
  544.   #     old_item : 放入的物品
  545.   #--------------------------------------------------------------------------
  546.   def trade_item_with_party(new_item, old_item)
  547.     return false if new_item && !$game_party.has_item?(new_item)
  548.     $game_party.load_trade_item = true if Equip_SW == true
  549.     $game_party.gain_item(old_item, 1)
  550.     $game_party.lose_item(new_item, 1)
  551.     $game_party.load_trade_item = false if Equip_SW == true
  552.     return true
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 获取角色的负重上限
  556.   #--------------------------------------------------------------------------
  557.   def load
  558.     eval(Load_Eval).to_i
  559.   end
  560. end
  561. #==============================================================================
  562. # ■ 增减物品时判断负重
  563. #==============================================================================
  564. class Game_Interpreter
  565.   include VIPArcher::Load
  566.   #--------------------------------------------------------------------------
  567.   # ● 增减道具
  568.   #--------------------------------------------------------------------------
  569.   alias load_command_126 command_126
  570.   def command_126
  571.     n = operate_value(@params[1], @params[2], @params[3])
  572.     return command_115 if check_load(@params[0], 0, n) && Stop_SW
  573.     load_command_126
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● 增減武器
  577.   #--------------------------------------------------------------------------
  578.   alias load_command_127 command_127
  579.   def command_127
  580.     n = operate_value(@params[1], @params[2], @params[3])
  581.     return command_115 if check_load(@params[0], 1, n) && Stop_SW
  582.     load_command_127
  583.   end
  584.   #--------------------------------------------------------------------------
  585.   # ● 增減防具
  586.   #--------------------------------------------------------------------------
  587.   alias load_command_128 command_128
  588.   def command_128
  589.     n = operate_value(@params[1], @params[2], @params[3])
  590.     return command_115 if check_load(@params[0], 2, n) && Stop_SW
  591.     load_command_128
  592.   end
  593.   #--------------------------------------------------------------------------
  594.   # ● 增减物品超重时提示
  595.   #--------------------------------------------------------------------------
  596.   def check_load(item_id, type, n)
  597.     case type
  598.     when 0; item = $data_items[item_id]
  599.     when 1; item = $data_weapons[item_id]
  600.     when 2; item = $data_armors[item_id]
  601.     end
  602.     if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  603.       $game_message.texts.push("#{Message}") if $game_message.visible != true
  604.       $game_message.visible = true
  605.     end
  606.     return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● 更改负重
  610.   #--------------------------------------------------------------------------
  611.   def current_load(current_load,assign = false)
  612.     if assign
  613.       $game_party.current_load = current_load
  614.     else
  615.       $game_party.current_load += current_load
  616.     end
  617.   end
  618. end
  619. #==============================================================================
  620. # ★ 满负重时限制行动 ★
  621. #==============================================================================
  622. class Game_Player < Game_Character
  623.   include VIPArcher::Load
  624.   #--------------------------------------------------------------------------
  625.   # ● 判定是否可以移动###################
  626.   #--------------------------------------------------------------------------
  627.   alias load_movable? movable?
  628.   def movable?
  629.     return false if $game_party.load_max? && !Movable
  630.     return false if $game_party.eload_max? && !Movable ###################
  631.     load_movable?
  632.   end
  633. end
  634. #==============================================================================
  635. # ★ 满负重时降低移动速度 ★
  636. #==============================================================================
  637. class Game_CharacterBase
  638.   include VIPArcher::Load
  639.   #--------------------------------------------------------------------------
  640.   # ● 获取移动速度(判断是否跑步)################
  641.   #--------------------------------------------------------------------------
  642.   alias load_real_move_speed real_move_speed
  643.   def real_move_speed
  644.     return Move_Speed if $game_party.load_max? && Movable
  645.     return Move_Speed if $game_party.eload_max? && Movable ################
  646.     load_real_move_speed
  647.   end
  648. end
  649. #==============================================================================
  650. # ★ 满负重时限制购买 ★
  651. #==============================================================================
  652. class Window_ShopBuy < Window_Selectable
  653.   #--------------------------------------------------------------------------
  654.   # ● 查询商品是否可买
  655.   #--------------------------------------------------------------------------
  656.   alias load_enable? enable?
  657.   def enable?(item)
  658.     load_enable?(item) && !$game_party.load_max?
  659.   end
  660. end
  661. #==============================================================================
  662. # ★ 根据负重设定可购买的物品数量 ★
  663. #==============================================================================
  664. class Scene_Shop < Scene_MenuBase
  665.   #--------------------------------------------------------------------------
  666.   # ● 指令“买入”
  667.   #--------------------------------------------------------------------------
  668.   alias vip_load_command_buy command_buy
  669.   def command_buy
  670.     vip_load_command_buy
  671.     @number_window.buy_or_sell = true
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ● 指令“卖出”
  675.   #--------------------------------------------------------------------------
  676.   alias vip_load_command_sell command_sell
  677.   def command_sell
  678.     vip_load_command_sell
  679.     @number_window.buy_or_sell = false
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ● 获取可以买入的最大值
  683.   #--------------------------------------------------------------------------
  684.   alias load_max_buy max_buy
  685.   def max_buy
  686.     vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
  687.     $game_party.current_load) / @item.load
  688.     [load_max_buy,vip].min
  689.   end
  690. end
复制代码

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


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

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

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

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

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

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

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

  126.   # 装备在身上的装备是否算入负重
  127.   Equip_SW = false      #true 计算 / false 不计算
  128.   #         "★★★★★★ 注意 ★★★★★★"
  129.   # 如果你的角色初始装备有占负重并且开启上面的功能,那么你必须
  130.   # 在游戏一开始时为当前负重赋值(自己算到底有多少负重·3·)
  131.   # 当有新队员加入队伍并且也带有负重的装备那么你也需要为当前负重加上对应的重量,
  132.   # 例如:事件脚本运行 current_load(10) 就是加上10的当前负重
  133. end
  134. #==============================================================================
  135. # ☆ 体力清除 ☆#######################
  136. #==============================================================================
  137. def 体力超限清除
  138.   (1...$data_actors.size).each do |i|
  139.     actor = $game_actors[i]
  140.     actor.hp = actor.mhp if actor.hp > actor.mhp
  141.   end
  142. end  
  143. #==============================================================================
  144. # ☆ 数位缩进☆#######################
  145. #==============================================================================
  146. def small(i)
  147.    return "0" if i==0
  148.    len=(i.abs.to_s).length
  149.    if len%3==2 && len>3
  150.    len=[(len-2)/3,0].max
  151.    return sprintf("%.0f",(i*10/(10**(len*4))/10.0))+$shuwei[len]
  152.   else
  153.    len=[(len-2)/3,0].max
  154.    return (i/(10**(len*4))).to_s+$shuwei[len]
  155.    end
  156. end
  157. #==============================================================================
  158. # ☆ 装备负重 ☆#######################
  159. #==============================================================================
  160. class Game_Actor
  161.   include VIPArcher::Load
  162.   attr_accessor :equip_weight      #已装备物品重量
  163.   attr_accessor :equip_weightmax   #最大负重
  164.   alias setup_plus setup
  165.   alias refresh_plus refresh
  166.   alias change_equip_plus change_equip
  167.   #--------------------------------------------------------------------------
  168.   # ● 设置
  169.   #--------------------------------------------------------------------------
  170.   def setup(actor_id)
  171.     setup_plus(actor_id)
  172.     @equip_weight =  equips.compact.inject(0) {|r, item| r += item.load }
  173.     @equip_weightmax = loadmax
  174.   end  
  175.   #--------------------------------------------------------------------------
  176.   # ● 获取能力重定义
  177.   #--------------------------------------------------------------------------
  178.   def param(param_id)
  179.    return loadnew if $data_actors[id].note =~ /<炒鸡生命值>/ && param_id == 0   
  180.     value = param_base(param_id) + param_plus(param_id) #基础+额外
  181.     value *= param_rate(param_id) * param_buff_rate(param_id)
  182.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● 获取能力原方法
  186.   #--------------------------------------------------------------------------
  187.   def used_param(param_id)
  188.     value = param_base(param_id) + param_plus(param_id) #基础+额外
  189.     value *= param_rate(param_id) * param_buff_rate(param_id)
  190.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  191.   end  
  192.   #--------------------------------------------------------------------------
  193.   # ● 获取队伍角色基础负重
  194.   #--------------------------------------------------------------------------
  195.   def jichuload
  196.     return $1.to_i if $data_actors[id].note =~ /<(?:load|负重|負重)\s*(\d+)>/i
  197.     return Default_Equip
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● 获取队伍角色可使用负重
  201.   #--------------------------------------------------------------------------
  202.   def trueload
  203.    return [((@equip_weightmax - @equip_weight)/10).to_i,0].max if @equip_weightmax && @equip_weight
  204.   end  
  205.   #--------------------------------------------------------------------------
  206.   # ● 获取备注了<炒鸡生命值>的队伍角色最大体力公式
  207.   #--------------------------------------------------------------------------
  208.   def loadnew
  209.     return trueload + used_param(0) if  used_param(0) > 100 && trueload
  210.     return trueload
  211.   end  
  212.   #--------------------------------------------------------------------------
  213.   # ● 获取队伍角色最大负重
  214.   #--------------------------------------------------------------------------
  215.   def loadmax
  216.     return jichuload  + equips.compact.inject(0) {|r, item| r += item.zhong }
  217.   end  
  218.   #--------------------------------------------------------------------------
  219.   # ● 更换装备
  220.   #     slot_id : 装备栏 ID
  221.   #     item    : 武器/护甲(为 nil 时装备解除)
  222.   #--------------------------------------------------------------------------
  223.   def change_equip(slot_id, item)
  224.   change_equip_plus(slot_id, item)
  225.   $equip_map = true  
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 刷新
  229.   #--------------------------------------------------------------------------
  230.   def refresh
  231.     a = equips.compact.inject(0) {|r, item| r += item.load }
  232.    if @equip_weight != a
  233.     @equip_weight = a
  234.   end
  235.    mhp if mhp != trueload
  236.    @equip_weightmax = loadmax if @equip_weightmax != loadmax
  237.    refresh_plus
  238.   end
  239. end
  240. #==============================================================================
  241. #  ☆ 超重提示 ☆#######################
  242. #==============================================================================
  243. class Scene_Map < Scene_Base
  244. include  VIPArcher::Load
  245. alias start_plus start
  246. def start
  247.    start_plus
  248.    tipss
  249. end  
  250.   #--------------------------------------------------------------------------
  251.   # ● 超重提示
  252.   #--------------------------------------------------------------------------
  253.   def tipss
  254.     a=""
  255.     b=""
  256.     @tips=Message2.clone
  257.     @hptips=Message3.clone
  258.     data=[]
  259.     data2=[]
  260.      if EQUIP_TIPS && $equip_map
  261.         #####装备超重提示######
  262.       (1..$data_system.party_members.size).each do |i|
  263.        actor = $game_actors[i]
  264.       data.push("#{i}号") if actor.equip_weight > actor.equip_weightmax
  265.       data2.push("#{i}号") if actor.hp > actor.mhp
  266.     end
  267.      for i in 1..$data_system.party_members.size
  268.        actor = $game_actors[i]
  269.     if actor.equip_weight > actor.equip_weightmax
  270.       $game_message.position = Messset
  271.       $equip_map = false
  272.       for j in 0...data.size
  273.      a+=data[j]
  274.      end  
  275.      @tips.sub!(/\XX/)  {"\\c[10]#{a}\\c[0]"}
  276.     return $game_message.texts.push(@tips)
  277.   end
  278. end
  279.     #HP超重 #####################
  280.     for i in 1..$data_system.party_members.size
  281.       actor = $game_actors[i]
  282.      if  actor.hp > actor.mhp
  283.      $game_message.position = Messset

  284.      for j in 0...data2.size
  285.       b+=data2[j]
  286.      end
  287.      @hptips.sub!(/\XX/) {"\\c[10]#{b}\\c[0]"}
  288.      $game_message.texts.push(@hptips)
  289.      return $game_temp.reserve_common_event(HPTIPS)
  290.    end
  291.   end
  292. end
  293.     #####物品超重提示#######
  294.     if ITEM_TIPS && $item_map
  295.   if $game_party.current_load > $game_party.total_load  
  296.       $game_message.position = Messset2
  297.       $item_map = false
  298.      return $game_message.texts.push("#{Message}")
  299.    end  
  300.   end
  301. end
  302.   #--------------------------------------------------------------------------
  303.   # ● 超重按键提示
  304.   #--------------------------------------------------------------------------
  305.   def input_tips
  306.    if Input.trigger?(:UP) or Input.trigger?(:DOWN) or Input.trigger?(:RIGHT) or Input.trigger? (:LEFT)
  307.     (1..$data_system.party_members.size).each do |i|
  308.     actor=$game_actors[i]
  309.     if actor.equip_weight > actor.equip_weightmax
  310.       $game_message.position = Messset2
  311.       return $game_message.texts.push(@tips)
  312.     end
  313.      if actor.hp > actor.mhp
  314.       $game_message.position = Messset2
  315.       return $game_message.texts.push(@hptips)
  316.     end  
  317.    end
  318. end
  319. end
  320.   #--------------------------------------------------------------------------
  321.   # ● 更新画面
  322.   #--------------------------------------------------------------------------
  323.   alias update_plus update
  324.   def update
  325.     update_plus
  326.     input_tips
  327.   end  
  328. end
  329. #==============================================================================
  330. # ■ Game_BattlerBase###################
  331. #------------------------------------------------------------------------------
  332. #  管理战斗者的类。主要含有能力值计算的方法。Game_Battler 类的父类。
  333. #==============================================================================
  334. class Game_BattlerBase
  335.   alias hp_rateplus hp_rate
  336.   def refresh
  337.     state_resist_set.each {|state_id| erase_state(state_id) }
  338.     @hp = @hp#[[@hp, mhp].min, 0].max
  339.     @mp = [[@mp, mmp].min, 0].max
  340.     @hp == 0 ? add_state(death_state_id) : remove_state(death_state_id)#生成死亡 #接触死亡
  341.   end  
  342.     def hp_rate
  343.     mhp != 0 ? hp_rateplus : 0
  344.   end
  345. end  
  346. #==============================================================================
  347. #  ☆ 能力窗口 ☆#######################
  348. #==============================================================================
  349. class Window_EquipStatus
  350.   include VIPArcher::Load #继承了该模块
  351.   alias refresh_plus refresh
  352.   #--------------------------------------------------------------------------
  353.   # ● 刷新
  354.   #--------------------------------------------------------------------------
  355.   def refresh
  356.   refresh_plus
  357.   if EQUIPSWLOAD
  358.   contents.font.size = 16 ;contents.font.color = text_color(21)
  359. if @actor !=nil
  360.   id = @actor.id
  361.   x=70;x2=85
  362.   y=25
  363.   load = @actor.equip_weight + @actor.hp
  364.    contents.draw_text(x,0,100,16,"负重:")
  365.         if $data_actors[id].note =~ /<炒鸡生命值>/
  366.          contents.font.color = text_color(10)
  367.        if @actor.hp != @actor.used_param(0)
  368.       if load > @actor.equip_weightmax
  369.        a = load - @actor.equip_weightmax
  370.      contents.draw_text(x2-30,y,100,16,"超重")
  371.      contents.draw_text(x2-27,y+16,100,16,small(a))
  372.     end
  373.     else ############如果体力相等时
  374.      if @actor.equip_weight > @actor.equip_weightmax
  375.      a = @actor.equip_weight - @actor.equip_weightmax
  376.      contents.draw_text(x2-30,y,100,16,"超重")
  377.      contents.draw_text(x2-27,y+16,100,16,small(a))  
  378.     end
  379.   end
  380.    contents.font.color = text_color(3);contents.font.size = 11
  381.    contents.draw_text(x+50,15,85,16,"("+"#{@actor.hp}"+")") if @actor.hp != @actor.used_param(0)
  382.    contents.font.size = 16
  383.   contents.font.color = text_color(0)
  384.   @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)}")
  385.    else ####################未使用炒鸡系统
  386.     if @actor.equip_weight > @actor.equip_weightmax
  387.    a = @actor.equip_weight - @actor.equip_weightmax
  388.    contents.font.color = text_color(10)
  389.    contents.draw_text(x2-30,y,100,16,"超重")
  390.    contents.draw_text(x2-27,y+16,100,16,a)
  391.    end
  392.   contents.font.color = text_color(0)
  393.   contents.draw_text(x+42,0,85,16,"#{small(@actor.equip_weight)}/#{small(@actor.equip_weightmax)}")
  394.    end  ####################正则判断结束
  395. end  
  396.   contents.font.size = 22
  397.   end
  398. end
  399. end  
  400. #==============================================================================
  401. # ☆ 设定结束 ☆
  402. #==============================================================================
  403. class RPG::BaseItem
  404.   include VIPArcher::Load #继承了该模块
  405.   #--------------------------------------------------------------------------
  406.   # ● 获取道具的重量
  407.   #--------------------------------------------------------------------------
  408.   def load
  409.     return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
  410.     @note =~ /<(?:load|负重|負重)\s*(\d+)>/i ? a=$1.to_i : a=Default_Load#若备注没有 <负重 (数字)> 则自动替换为该常量
  411.     b = a + $game_party.load(:item,@id) if self.is_a?(RPG::Item)
  412.     b = a + $game_party.load(:armor,@id) if self.is_a?(RPG::Armor)
  413.     b = a + $game_party.load(:weapon,@id) if self.is_a?(RPG::Weapon)
  414.     return b
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● 获取道具的属性加成
  418.   #--------------------------------------------------------------------------
  419.   def zhong
  420.     return unless self.is_a?(RPG::EquipItem)
  421.     return $1.to_i if @note =~ /<(?:load加成|负重加成|負重加成)\s*(\d+)>/i
  422.     return EQUIPZHONG #若备注没有 <负重加成 (数字)> 则自动替换为该常量
  423.   end  
  424.   #--------------------------------------------------------------------------
  425.   # ● 新增负重帮助内容
  426.   #--------------------------------------------------------------------------
  427.   def description
  428.     if Help_SW && load && load != 0
  429.      return @description + "\n\\}重量:#{load} #{LoadJC_Name}#{zhong}"  if zhong && zhong != 0
  430.      return @description + "\n\\}重量:#{load}"
  431.    else######################################
  432.      return @description + "\n\\}#{LoadJC_Name}#{zhong}" if zhong && zhong != 0
  433.      return @description
  434.     end
  435.   end unless $VIPArcherScript[:help_ex]
  436. end
  437. #==============================================================================
  438. #  显示当前负重信息的窗口
  439. #==============================================================================
  440. class Window_Load < Window_Base
  441.   include VIPArcher::Load
  442.   #--------------------------------------------------------------------------
  443.   # ● 初始化对象
  444.   #--------------------------------------------------------------------------
  445.   def initialize
  446.     super(Graphics.width - window_width, 72, window_width, fitting_height(1))
  447.     refresh
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ● 获取窗口的宽度
  451.   #--------------------------------------------------------------------------
  452.   def window_width
  453.     Width
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 刷新
  457.   #--------------------------------------------------------------------------
  458.   def refresh
  459.     contents.clear
  460.     contents.font.size - 4
  461.     draw_text(0, 0, window_width - 64, 24,load_name,0)
  462.     draw_text(0, 0, window_width - 24, 24, weight,2)
  463.     @temp_load = $game_party.current_load
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● 获取当前负重信息
  467.   #--------------------------------------------------------------------------
  468.   def weight
  469.     "#{$game_party.current_load}/#{$game_party.total_load}"
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 获取负重前显示文字
  473.   #--------------------------------------------------------------------------
  474.   def load_name
  475.     Load_Name
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ● 更新画面
  479.   #--------------------------------------------------------------------------
  480.   def update
  481.     super
  482.     refresh if @temp_load != $game_party.current_load
  483.   end
  484. end
  485. #-------------------------------------------------------------------------------
  486. class Window_ItemCategory < Window_HorzCommand
  487.   include VIPArcher::Load
  488.   #--------------------------------------------------------------------------
  489.   # ● 获取窗口的宽度
  490.   #--------------------------------------------------------------------------
  491.   def window_width
  492.     scene_item_is? ? Graphics.width - Width : Graphics.width
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 获取列数
  496.   #--------------------------------------------------------------------------
  497.   def col_max
  498.     return scene_item_is? ? 3 : 4
  499.   end
  500.   #--------------------------------------------------------------------------
  501.   # ● 判断是否为物品栏场景
  502.   #--------------------------------------------------------------------------
  503.   def scene_item_is?
  504.     return SceneManager.scene_is?(Scene_Item)
  505.   end
  506. end
  507. #==============================================================================
  508. # ■ 物品界面显示负重栏
  509. #==============================================================================
  510. class Scene_Item < Scene_ItemBase
  511.   include VIPArcher::Load
  512.   #--------------------------------------------------------------------------
  513.   # ● 开始处理
  514.   #--------------------------------------------------------------------------
  515.   alias load_start start
  516.   def start
  517.     load_start
  518.     @load_window = Window_Load.new
  519.     @load_window.viewport = @viewport
  520.     $item_map = true
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ● 结束处理
  524.   #--------------------------------------------------------------------------
  525.   alias load_terminate terminate
  526.   def terminate
  527.     load_terminate
  528.     @load_window.dispose
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ● 更新画面
  532.   #--------------------------------------------------------------------------
  533.   alias load_update update
  534.   def update
  535.     #--------------------------------------------------------------------------
  536.     # ★ 按X键(A键)丢弃道具 - 贵重物品无法丢弃 ★修改:VIPArcher
  537.     #--------------------------------------------------------------------------
  538.     if Input.trigger?(Input::X) && Lose_SW
  539.       item = @item_window.item
  540.       if item.is_a?(RPG::Item) && item.key_item?
  541.         Sound.play_buzzer
  542.       else
  543.         Sound.play_cancel
  544.         $game_party.lose_item(item, 1)
  545.         @item_window.refresh
  546.       end unless item == nil
  547.     end
  548.     @load_window.update
  549.     load_update
  550.   end
  551. end
  552. #-------------------------------------------------------------------------------
  553. class Window_ShopNumber < Window_Selectable
  554.   include VIPArcher::Load
  555.   attr_accessor :buy_or_sell                    #买入的标志
  556.   #--------------------------------------------------------------------------
  557.   # ● 刷新
  558.   #--------------------------------------------------------------------------
  559.   alias vip_shopnumber_refresh refresh
  560.   def refresh
  561.     vip_shopnumber_refresh
  562.     draw_current_weight(@item)
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ○ 买卖时重量变化的描绘
  566.   #--------------------------------------------------------------------------
  567.   def draw_current_weight(item)
  568.     current = $game_party.current_load
  569.     weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
  570.     width = contents_width - 8
  571.     cx = text_size(@currency_unit).width
  572.     change_color(system_color)
  573.     draw_text(4, y + 60, width, line_height, "#{Load_Name}")
  574.     change_color(normal_color)
  575.     wt = "#{weight} / #{$game_party.total_load}"
  576.     draw_text(4, y + 60, width, line_height, wt, 2)
  577.   end
  578. end
  579. #-------------------------------------------------------------------------------
  580. class Window_ShopStatus < Window_Base
  581.   include VIPArcher::Load
  582.   #--------------------------------------------------------------------------
  583.   # ● 刷新
  584.   #--------------------------------------------------------------------------
  585.   alias vip_shopstatus_refresh refresh
  586.   def refresh
  587.     vip_shopstatus_refresh
  588.     draw_weight_occupy(4, 24)
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ● 绘制持负重信息
  592.   #--------------------------------------------------------------------------
  593.   def draw_weight_occupy(x, y)
  594.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  595.     change_color(system_color)
  596.     draw_text(rect, "#{Load_Name}", 3)
  597.     change_color(normal_color)
  598.     weight = "#{$game_party.current_load}/#{$game_party.total_load}"  #重量/MAX重量
  599.     draw_text(rect, weight, 2)
  600.     @temp_load = $game_party.current_load
  601.   end
  602. end
  603. #==============================================================================
  604. # ■ 获取队伍最大负重
  605. #==============================================================================
  606. class Game_Party < Game_Unit
  607.   include VIPArcher::Load
  608.   #--------------------------------------------------------------------------
  609.   # ● 定义实例变量
  610.   #--------------------------------------------------------------------------
  611.   attr_accessor :current_load, :load_trade_item     #负重
  612.   #--------------------------------------------------------------------------
  613.   # ● 初始化对象
  614.   #--------------------------------------------------------------------------
  615.   alias load_initialize initialize
  616.    def initialize
  617.     load_initialize
  618.     total_load
  619.     @current_load = 0
  620.     @total_load = 0
  621.     @tmload=[0]*$data_items.size #物品储存
  622.     @wnload=[0]*$data_weapons.size #武器储存
  623.     @arload=[0]*$data_armors.size #护甲储存
  624. end
  625. def load(type,id,load=0)
  626.    load = {
  627.      :item =>   {id => 物品重量(id)},
  628.      :weapon => {id => 武器重量(id)},
  629.      :armor =>  {id => 护甲重量(id)},
  630.      }
  631.     return load[type][id]
  632.   end  
  633.   def 物品重量(id,load=0)
  634.     @tmload[id] = @tmload[id]+load
  635.   end
  636.   
  637.   def 武器重量(id,load=0)
  638.     @wnload[id] = @wnload[id]+load
  639.   end
  640.   
  641.   def 护甲重量(id,load=0)
  642.     @arload[id] = @arload[id]+load
  643.   end  
  644.   #--------------------------------------------------------------------------
  645.   # ● 获取队伍最大负重
  646.   #--------------------------------------------------------------------------
  647.   def total_load
  648.     return $game_variables[Load_Var] if Load_Var > 0
  649.     all_members.inject(0) {|total,actor| total + actor.load }
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # ● 判断物品负重是否已满
  653.   #--------------------------------------------------------------------------
  654.   def load_max?
  655.     return false if @current_load == 0
  656.     @current_load > total_load
  657.   end
  658.   #--------------------------------------------------------------------------
  659.   # ● 获取队伍的总装备重量
  660.   #--------------------------------------------------------------------------
  661. #  def equiptotal
  662. #    load=0
  663. #    for i in 1..$data_system.party_members.clone.size
  664. #    load += $game_actors[i].equip_weight
  665. #    end
  666. #    return load
  667. #  end  
  668.   #--------------------------------------------------------------------------
  669.   # ● 判断装备负重是否已满##################################
  670.   #--------------------------------------------------------------------------
  671.   def eload_max?
  672.    max=0
  673.    max2=0
  674.   for i in 1..$data_system.party_members.size
  675.     actor = $game_actors[i]
  676.    max+=1 if actor.equip_weight <= actor.equip_weightmax
  677.    max2+=1 if actor.hp <= actor.mhp
  678.    return false if max == $data_system.party_members.size and max2 == $data_system.party_members.size
  679.    end
  680. end  
  681.   #--------------------------------------------------------------------------
  682.   # ● 增加/减少物品时计算负重
  683.   #--------------------------------------------------------------------------
  684.   alias load_gain_item gain_item
  685.   def gain_item(item, n, include_equip = false)
  686.     return if item.nil?
  687.     load_gain_item(item, n, include_equip)
  688.     @current_load += item.load * n if !@load_trade_item
  689.   end
  690. end
  691. #-------------------------------------------------------------------------------
  692. class Game_Actor < Game_Battler
  693.   include VIPArcher::Load
  694.   #--------------------------------------------------------------------------
  695.   # ● 装备时不计算负重的增减 * 方法覆盖
  696.   #     new_item : 取出的物品
  697.   #     old_item : 放入的物品
  698.   #--------------------------------------------------------------------------
  699.   def trade_item_with_party(new_item, old_item)
  700.     return false if new_item && !$game_party.has_item?(new_item)
  701.     $game_party.load_trade_item = true if Equip_SW == true
  702.     $game_party.gain_item(old_item, 1)
  703.     $game_party.lose_item(new_item, 1)
  704.     $game_party.load_trade_item = false if Equip_SW == true
  705.     return true
  706.   end
  707.   #--------------------------------------------------------------------------
  708.   # ● 获取角色的负重上限
  709.   #--------------------------------------------------------------------------
  710.   def load
  711.     eval(Load_Eval).to_i
  712.   end
  713. end
  714. #==============================================================================
  715. # ■ 增减物品时判断负重
  716. #==============================================================================
  717. class Game_Interpreter
  718.   include VIPArcher::Load
  719.   #--------------------------------------------------------------------------
  720.   # ● 增减道具
  721.   #--------------------------------------------------------------------------
  722.   alias load_command_126 command_126
  723.   def command_126
  724.     n = operate_value(@params[1], @params[2], @params[3])
  725.     return command_115 if check_load(@params[0], 0, n) && Stop_SW
  726.     load_command_126
  727.   end
  728.   #--------------------------------------------------------------------------
  729.   # ● 增減武器
  730.   #--------------------------------------------------------------------------
  731.   alias load_command_127 command_127
  732.   def command_127
  733.     n = operate_value(@params[1], @params[2], @params[3])
  734.     return command_115 if check_load(@params[0], 1, n) && Stop_SW
  735.     load_command_127
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● 增減防具
  739.   #--------------------------------------------------------------------------
  740.   alias load_command_128 command_128
  741.   def command_128
  742.     n = operate_value(@params[1], @params[2], @params[3])
  743.     return command_115 if check_load(@params[0], 2, n) && Stop_SW
  744.     load_command_128
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ● 增减物品超重时提示
  748.   #--------------------------------------------------------------------------
  749.   def check_load(item_id, type, n)
  750.     case type
  751.     when 0; item = $data_items[item_id]
  752.     when 1; item = $data_weapons[item_id]
  753.     when 2; item = $data_armors[item_id]
  754.     end
  755.     if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  756.       $game_message.texts.push("#{Message}") if $game_message.visible != true
  757.       $game_message.visible = true
  758.     end
  759.     return (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # ● 更改负重
  763.   #--------------------------------------------------------------------------
  764.   def current_load(current_load,assign = false)
  765.     if assign
  766.       $game_party.current_load = current_load
  767.     else
  768.       $game_party.current_load += current_load
  769.     end
  770.   end
  771. end
  772. #==============================================================================
  773. # ★ 满负重时限制行动 ★
  774. #==============================================================================
  775. class Game_Player < Game_Character
  776.   include VIPArcher::Load
  777.   #--------------------------------------------------------------------------
  778.   # ● 判定是否可以移动###################
  779.   #--------------------------------------------------------------------------
  780.   alias load_movable? movable?
  781.   def movable?
  782.     return false if $game_party.load_max? && !Movable
  783.     return false if $game_party.eload_max? && !Movable ###################
  784.     load_movable?
  785.   end
  786. end
  787. #==============================================================================
  788. # ★ 满负重时降低移动速度 ★
  789. #==============================================================================
  790. class Game_CharacterBase
  791.   include VIPArcher::Load
  792.   #--------------------------------------------------------------------------
  793.   # ● 获取移动速度(判断是否跑步)################
  794.   #--------------------------------------------------------------------------
  795.   alias load_real_move_speed real_move_speed
  796.   def real_move_speed
  797.     return Move_Speed if $game_party.load_max? && Movable
  798.     return Move_Speed if $game_party.eload_max? && Movable ################
  799.     load_real_move_speed
  800.   end
  801. end
  802. #==============================================================================
  803. # ★ 满负重时限制购买 ★
  804. #==============================================================================
  805. class Window_ShopBuy < Window_Selectable
  806.   #--------------------------------------------------------------------------
  807.   # ● 查询商品是否可买
  808.   #--------------------------------------------------------------------------
  809.   alias load_enable? enable?
  810.   def enable?(item)
  811.     load_enable?(item) && !$game_party.load_max?
  812.   end
  813. end
  814. #==============================================================================
  815. # ★ 根据负重设定可购买的物品数量 ★
  816. #==============================================================================
  817. class Scene_Shop < Scene_MenuBase
  818.   #--------------------------------------------------------------------------
  819.   # ● 指令“买入”
  820.   #--------------------------------------------------------------------------
  821.   alias vip_load_command_buy command_buy
  822.   def command_buy
  823.     vip_load_command_buy
  824.     @number_window.buy_or_sell = true
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # ● 指令“卖出”
  828.   #--------------------------------------------------------------------------
  829.   alias vip_load_command_sell command_sell
  830.   def command_sell
  831.     vip_load_command_sell
  832.     @number_window.buy_or_sell = false
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # ● 获取可以买入的最大值
  836.   #--------------------------------------------------------------------------
  837.   alias load_max_buy max_buy
  838.   def max_buy
  839.     vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
  840.     $game_party.current_load) / @item.load
  841.     [load_max_buy,vip].min
  842.   end
  843. end
复制代码

评分

参与人数 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
星屑
7346
在线时间
609 小时
注册时间
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
星屑
7346
在线时间
609 小时
注册时间
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
星屑
7346
在线时间
609 小时
注册时间
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.

在本版发帖返回顶部