Project1
标题:
改进版负重脚本,如何让已装备品也计入负重?
[打印本页]
作者:
xyzgwx
时间:
2014-8-9 22:26
标题:
改进版负重脚本,如何让已装备品也计入负重?
这里第3楼
https://rpg.blue/thread-368485-1-1.html
是一个改进版负重脚本,但不论原移植版还是改进版,已装备上的道具都不计入负重值,要卸下才会计入
如何让已装备上的道具也计入负重值?
作者:
tseyik
时间:
2014-8-9 22:33
本帖最后由 tseyik 于 2014-8-9 22:34 编辑
用這個負重脚本巴
https://rpg.blue/thread-369538-1-1.html
7楼
作者:
xyzgwx
时间:
2014-8-9 22:53
tseyik 发表于 2014-8-9 22:33
用這個負重脚本巴
https://rpg.blue/thread-369538-1-1.html
7楼
这个和我用的那个仓库脚本不兼容
作者:
VIPArcher
时间:
2014-8-9 23:46
class RPG::BaseItem
def load
return if self.is_a?(RPG::Skill)
self.note.split(/[\r\n]+/).each { |line|
if line =~ /\[(?:load|负重|負重) (\w+)\]/
return $1.nil? ? 0 : $1.to_i
end}
return 0
end
end
class Scene_Item < Scene_ItemBase
alias load_start start
alias load_terminate terminate
alias load_update update
def start
load_start
@load_window = Window_Base.new(392, 0, 152, 56)
@load_window.viewport = @viewport
end
def terminate
@load_window.dispose
load_terminate
end
def update
@load_window.update
if @temp_load != $game_party.current_load
@load_window.contents.clear
@load_window.contents.draw_text(0, 0, 120, 24, "负重:#{$game_party.current_load}/#{$game_party.total_load}")
@temp_load = $game_party.current_load
end
if Input.trigger?(Input::X)
@item = @item_window.item
$game_party.lose_item(@item, 1)
@item_window.refresh
end
load_update
end
end
class Scene_Shop < Scene_MenuBase
alias load_start start
alias load_terminate terminate
alias load_update update
def start
load_start
@load_window = Window_Base.new(392, 0, 152, 56)
@load_window.viewport = @viewport
end
def terminate
@load_window.dispose
load_terminate
end
def update
@load_window.update
if @temp_load != $game_party.current_load
@load_window.contents.clear
@load_window.contents.draw_text(0, 0, 120, 24, "负重:#{$game_party.current_load}/#{$game_party.total_load}")
@temp_load = $game_party.current_load
end
load_update
end
end
class Game_Party < Game_Unit
attr_reader :current_load
alias load_initialize initialize
alias load_gain_item gain_item
def initialize
load_initialize
@current_load = 0
end
# 获取队伍最大负重
def total_load
party_load = 0
#members.size.times do |i|
for i in 0...members.size
actor = members[i]
party_load += actor.load
end
return party_load
end
def gain_item(item, n, include_equip = false)
return if item.nil?
load_gain_item(item, n, include_equip)
@current_load += item.load * n if $load_ok == false || $load_ok == nil
end
end
class Game_Actor < Game_Battler
# 获取队员负重
def load
return (mhp + mmp) * @level / agi
end
end
class Game_Interpreter
alias load_command_126 command_126
alias load_command_127 command_127
alias load_command_128 command_128
def command_126
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load(@params[0], 0, n)
load_command_126
end
#--------------------------------------------------------------------------
# ● 增減武器
#--------------------------------------------------------------------------
def command_127
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load(@params[0], 1, n)
load_command_127
end
#--------------------------------------------------------------------------
# ● 增減防具
#--------------------------------------------------------------------------
def command_128
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load(@params[0], 2, n)
load_command_128
end
def check_load(item_id, type, n)
case type
when 0; item = $data_items[item_id]
when 1; item = $data_weapons[item_id]
when 2; item = $data_armors[item_id]
end
if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
$game_message.texts.push("负重过重,现在无法移动!请丢弃部分物品") if $game_message.visible != true
$game_message.visible = true
end
return
end
end
class Game_Player < Game_Character
alias vipmovable? movable?
#--------------------------------------------------------------------------
# ● 判定是否负重已满
#--------------------------------------------------------------------------
def mfz_vip?
$game_party.total_load < $game_party.current_load
end
#--------------------------------------------------------------------------
# ● 判定是否可以移动
#--------------------------------------------------------------------------
def movable?
return false if mfz_vip?
vipmovable?
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 交换物品
# new_item : 取出的物品
# old_item : 放入的物品
#--------------------------------------------------------------------------
def trade_item_with_party(new_item, old_item)
return false if new_item && !$game_party.has_item?(new_item)
$load_ok = true
$game_party.gain_item(old_item, 1)
$game_party.lose_item(new_item, 1)
$load_ok = false
return true
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1