#==============================================================================
# ■ RMVA 简易多背包系统(VX移植)
#------------------------------------------------------------------------------
#
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#
# 作者:protosssonny
# 移植:喵呜喵5
#
#==============================================================================
#==============================================================================
# ■ 使用方法:
# 首先要设定背包的总数,本脚本中默认是3个背包。
# 使用事件以下脚本命令来调用,具体使用可以见本范例:
# load_package(n) #切换到n号背包
# clear_package(n) #清空n号背包以及n号背包的物品、金钱储存信息
# package_to_another(n) #将n号背包的物品、金钱转移到当前号背包中
# ■ 注意事项:
# 本脚本是使用变量来储存背包信息的,您的背包系统最多有n个背包,
# 那么1000号至1000+3*n号变量请勿使用。
# 例如,本脚本默认背包是3个,所以1000至1009号变量不能再使用。
#
#==============================================================================
#
#
#请在这里设定总背包数:
PACKAGES = 3
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 处理标题画面的类。
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 指令 : 新游戏
#--------------------------------------------------------------------------
=begin
def command_new_game
variable_initialize
confirm_player_location
Sound.play_decision
$game_party.setup_starting_members # 初期同伴
$game_map.setup($data_system.start_map_id) # 初期地图位置
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
close_command_window
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
=end
def command_new_game
DataManager.setup_new_game
close_command_window
fadeout_all
$game_map.autoplay
SceneManager.goto(Scene_Map)
variable_initialize
end
#--------------------------------------------------------------------------
# ● 初始化背包变量
#--------------------------------------------------------------------------
def variable_initialize
$game_variables[1000] = 1 #默认情况下背包1是当前背包
for i in 1..3*PACKAGES
$game_variables[1000+i] = [0,0,0]
for j in 0..999
$game_variables[1000+i][j] = 0
end
end
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# 执行事件命令的解释器。本类在 Game_Map 类、Game_Troop 类、
# Game_Event 类的内部使用。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 当清空n号背包物品、金钱及其存档
#--------------------------------------------------------------------------
def clear_package(n)
for i in 1..999
$game_variables[998+3*n][i] = 0
$game_variables[999+3*n][i] = 0
$game_variables[1000+3*n][i] = 0
end
for i in 1..999
$game_party.gain_item($data_weapons[i],-999,false)
$game_party.gain_item($data_armors[i],-999,false)
$game_party.gain_item($data_items[i],-999)
end
$game_variables[998+3*n][0] = 0
$game_party.gain_gold($game_variables[998+3*n][0] - $game_party.gold)
end
#--------------------------------------------------------------------------
# ● 当前背包的物品存档
#--------------------------------------------------------------------------
def save_package(n)
for i in 1..999
$game_variables[998+3*n][i] = $game_party.item_number($data_weapons[i])
$game_variables[999+3*n][i] = $game_party.item_number($data_armors[i])
$game_variables[1000+3*n][i] = $game_party.item_number($data_items[i])
end
$game_variables[998+3*n][0] = $game_party.gold
end
#--------------------------------------------------------------------------
# ● 切换到n号背包
#--------------------------------------------------------------------------
def load_package(n)
if $game_variables[1000] == n
$game_message.texts.push("无法切换,已经是当前背包!")
end
save_package($game_variables[1000])
$game_variables[1000] = n
for i in 1..999
$game_party.gain_item($data_weapons[i],-999,false)
$game_party.gain_item($data_armors[i],-999,false)
$game_party.gain_item($data_items[i],-999)
end
for j in 1..999
$game_party.gain_item($data_weapons[j],$game_variables[998+3*n][j],false)
$game_party.gain_item($data_armors[j],$game_variables[999+3*n][j],false)
$game_party.gain_item($data_items[j],$game_variables[1000+3*n][j])
end
$game_party.gain_gold($game_variables[998+3*n][0] - $game_party.gold)
end
#--------------------------------------------------------------------------
# ● 将n号背包的物品、金钱转移到当前号背包中
#--------------------------------------------------------------------------
def package_to_another(n)
save_package($game_variables[1000])
for j in 1..999
$game_party.gain_item($data_weapons[j],$game_variables[998+3*n][j],false)
$game_party.gain_item($data_armors[j],$game_variables[999+3*n][j],false)
$game_party.gain_item($data_items[j],$game_variables[1000+3*n][j])
end
$game_party.gain_gold($game_variables[998+3*n][0])
save_package($game_variables[1000])
end
end
#------------------------------------------------------------------------------
#
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#
# 作者:protosssonny
# 2011年9月23日
#==============================================================================