02-17-2010, 07:27 PM
Sorry about the wait, a few posting restrictions and features were keeping me from posting anymore.
Fukuyama's Custom Save Menu (With edits from Wachuga to remove < > tags):
Instructions:
Ok, this script will take any "<>" tags out of the map name, that was Wachunga's edit. Now, make a new class above "Main" and name it Custom Save Menu then put this into it:
Makeamidget's Battle Warning Script:
Instructions:
This script will put a bar over your head that will have an encounter bar in it. The size depends on the encounter rate and when the bar gets to the very end you will be attacked by monsters. First go to 'Scene_Map' and add this under the 'main' command:
Now, make a new class above 'Main' and call it Encounter Bar and put this into it:
Momomomo's Item Book Script (Translated by Mcdohl):
Instructions:
Installation:
Make a new class called Item Book above 'Main' and put the spoiler code into it.
Usage:
It is a very long script indeed lol, but don't be worried, its not too hard to use.
First off, go to your Database in your game after you get this script in and go to the system tab. In the bottom left hand corner in the element/attribute tab, add new slots. Now, the stuff in these lines:
Is what you put in those new elements/attributes you just made. Note that I have customized this to my needs, if you want to get rid of the quest items, and quests, just delete all instances of each out of those lines above that are in the script. You can add new ones in the same way as well.
Now, go to the items and armor tabs in your database and, lets say were in the armor tab, we go to Bronze Shield and check the 'armor' element/attribute. We go to Power Ring and check the accessories element/attribute. this places that item in that section. You do the same for items.
Common Items are what the defaults are, or what you want of course, then you can add sections or other items, and armors. Weapons are already listed, you don't need to make an element/attribute for them.
Now, to call this from the menu or a call script use this:
Fukuyama's Custom Save Menu (With edits from Wachuga to remove < > tags):
Instructions:
Ok, this script will take any "<>" tags out of the map name, that was Wachunga's edit. Now, make a new class above "Main" and name it Custom Save Menu then put this into it:
Custom Save Menu
#================================================
# ====Create a new script above main and put all that code in it. ======
#================================================
#
#
#
#
#
# ? Window_SaveFile
#------------------------------------------------------------------------------
# ????????????????????????????????????
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_reader :filename # ?????
attr_reader :selected # ????
#--------------------------------------------------------------------------
# ? ?????????
# file_index : ?????????????? (0?3)
# filename : ?????
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 64 + file_index % 4 * 104, 640, 104)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@game_party_leader = ""
#@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
# @time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
@game_party = Marshal.load(file)
@game_map_name = Marshal.load(file)
@game_party_leader = @game_party.actors[0].name
end
refresh
@selected = false
rescue
file.close
@selected = false
@file_exist = false
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# ?????????
self.contents.font.color = normal_color
if @game_party_leader == ""
name = "File #{@file_index + 1}"
else
name = "File #{@file_index + 1} : " + @game_party_leader
end
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
# ??????????????
if @file_exist
# ?????????
for i in 0...@characters.size
bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @characters.size * 32 + i * 64 - cw / 2
self.contents.blt(x, 68 - ch, bitmap, src_rect)
end
# ????????
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 8, 600, 32, time_string, 2)
# ??????????
self.contents.font.color = normal_color
# time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
# self.contents.draw_text(4, 40, 600, 32, time_string, 2)
self.contents.draw_text(4, 40, 600, 32, @game_map_name[0...@game_map_name.index('<')], 2)
end
end
#--------------------------------------------------------------------------
# ? ???????
# selected : ??????? (true=?? false=???)
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
update_cursor_rect
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_cursor_rect
if @selected
self.cursor_rect.set(0, 0, @name_width + 8, 32)
else
self.cursor_rect.empty
end
end
end
#====================================================#==========================
# ? Scene_Save
#------------------------------------------------------------------------------
# ??????????????????
#====================================================#==========================
class Scene_Save < Scene_File
# -----------------------------
def initialize
super("Save in which slot?")
@confirm_window = Window_Base.new(120, 188, 400, 64)
@confirm_window.contents = Bitmap.new(368, 32)
string = "Sure you want to overwrite this file?"
@confirm_window.contents.font.name = "OldEnglish"
@confirm_window.contents.font.size = 20
@confirm_window.contents.draw_text(4, 0, 368, 32, string)
@yes_no_window = Window_Command.new(100, ["Yes", "No"])
@confirm_window.visible = false
@confirm_window.z = 1500
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.index = 1
@yes_no_window.x = 270
@yes_no_window.y = 252
@yes_no_window.z = 1500
@mode = 0
end
# -----------------------------
def on_decision(filename)
if FileTest.exist?(filename)
@confirm_window.visible = true
@yes_no_window.visible = true
@yes_no_window.active = true
@mode = 1
else
$game_system.se_play($data_system.save_se)
file = File.open(filename, "wb")
write_save_data(file)
file.close
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
end
# -----------------------------
def update
if @mode == 0
super
else
@help_window.update
@yes_no_window.update
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if @yes_no_window.index == 0
filename = make_filename(@file_index)
$game_system.se_play($data_system.save_se)
file = File.open(filename, "wb")
write_save_data(file)
file.close
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(4)
end
else
@confirm_window.visible = false
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.index = 1
@mode = 0
end
end
if Input.trigger?(Input::B)
@confirm_window.visible = false
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.index = 1
@mode = 0
return
end
end
end
# -----------------------------
def on_cancel
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
# -----------------------------
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_party, file)
Marshal.dump($game_map.name, file)
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_map, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_player, file)
end
end
#==============================================================================
# ? Scene_Load
#------------------------------------------------------------------------------
# ??????????????????
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
# ???????????????
$game_temp = Game_Temp.new
# ??????????????????
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("Which file do you wish to load from?")
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def on_decision(filename)
# ????????????
unless FileTest.exist?(filename)
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ??? SE ???
$game_system.se_play($data_system.load_se)
# ???????????
file = File.open(filename, "rb")
read_save_data(file)
file.close
# BGM?BGS ???
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# ?????? (????????)
$game_map.update
# ??????????
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def on_cancel
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
# ???????????
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
# ? ???????????
# file : ??????????????? (??????)
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_party = Marshal.load(file)
@game_map_name = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_map = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_player = Marshal.load(file)
# ???????????????????
# (?????????????????)
if $game_system.magic_number != $data_system.magic_number
# ????????
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# ???????????????
$game_party.refresh
end
end
#==============================================================================
# ? Scene_File
#------------------------------------------------------------------------------
# ?????????????????????????
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
# ? ?????????
# help_text : ????????????????
#--------------------------------------------------------------------------
def initialize(help_text)
@help_text = help_text
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ???????????
@help_window = Window_Help.new
@help_window.set_text(@help_text)
# ???????????????
@savefile_windows = []
for i in 0..3
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
# ??????????????
@file_index = $game_temp.last_file_index
@savefile_windows[@file_index].selected = true
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@help_window.dispose
for i in @savefile_windows
i.dispose
end
if self.is_a?(Scene_Save)
@confirm_window.dispose
@yes_no_window.dispose
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ????????
@help_window.update
for i in @savefile_windows
i.update
end
# C ??????????
if Input.trigger?(Input::C)
# ???? on_decision (??????) ???
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
# B ??????????
if Input.trigger?(Input::B)
# ???? on_cancel (??????) ???
on_cancel
return
end
# ??????????????
if Input.repeat?(Input::DOWN)
# ????????????????????????
# ?????????? 3 ??????
if Input.trigger?(Input::DOWN) or @file_index < 3
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ?????????
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 1) % 4
@savefile_windows[@file_index].selected = true
return
end
end
# ??????????????
if Input.repeat?(Input::UP)
# ????????????????????????
# ?????????? 0 ???????
if Input.trigger?(Input::UP) or @file_index > 0
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ?????????
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 3) % 4
@savefile_windows[@file_index].selected = true
return
end
end
end
#--------------------------------------------------------------------------
# ? ????????
# file_index : ?????????????? (0?3)
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
end
end
#
# Map Name Script ver.1.03.3
# by: fukuyama
# Japanese Comments Removed By: K-Anator
# http://www.rpg-reborn.tk
# This only gives the game_map.name method
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
alias xrxs20_main main
def main
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
xrxs20_main
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
def name
$map_infos[@map_id]
end
end
# ====Create a new script above main and put all that code in it. ======
#================================================
#
#
#
#
#
# ? Window_SaveFile
#------------------------------------------------------------------------------
# ????????????????????????????????????
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_reader :filename # ?????
attr_reader :selected # ????
#--------------------------------------------------------------------------
# ? ?????????
# file_index : ?????????????? (0?3)
# filename : ?????
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 64 + file_index % 4 * 104, 640, 104)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@game_party_leader = ""
#@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
# @time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
@game_party = Marshal.load(file)
@game_map_name = Marshal.load(file)
@game_party_leader = @game_party.actors[0].name
end
refresh
@selected = false
rescue
file.close
@selected = false
@file_exist = false
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# ?????????
self.contents.font.color = normal_color
if @game_party_leader == ""
name = "File #{@file_index + 1}"
else
name = "File #{@file_index + 1} : " + @game_party_leader
end
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
# ??????????????
if @file_exist
# ?????????
for i in 0...@characters.size
bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @characters.size * 32 + i * 64 - cw / 2
self.contents.blt(x, 68 - ch, bitmap, src_rect)
end
# ????????
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 8, 600, 32, time_string, 2)
# ??????????
self.contents.font.color = normal_color
# time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
# self.contents.draw_text(4, 40, 600, 32, time_string, 2)
self.contents.draw_text(4, 40, 600, 32, @game_map_name[0...@game_map_name.index('<')], 2)
end
end
#--------------------------------------------------------------------------
# ? ???????
# selected : ??????? (true=?? false=???)
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
update_cursor_rect
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_cursor_rect
if @selected
self.cursor_rect.set(0, 0, @name_width + 8, 32)
else
self.cursor_rect.empty
end
end
end
#====================================================#==========================
# ? Scene_Save
#------------------------------------------------------------------------------
# ??????????????????
#====================================================#==========================
class Scene_Save < Scene_File
# -----------------------------
def initialize
super("Save in which slot?")
@confirm_window = Window_Base.new(120, 188, 400, 64)
@confirm_window.contents = Bitmap.new(368, 32)
string = "Sure you want to overwrite this file?"
@confirm_window.contents.font.name = "OldEnglish"
@confirm_window.contents.font.size = 20
@confirm_window.contents.draw_text(4, 0, 368, 32, string)
@yes_no_window = Window_Command.new(100, ["Yes", "No"])
@confirm_window.visible = false
@confirm_window.z = 1500
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.index = 1
@yes_no_window.x = 270
@yes_no_window.y = 252
@yes_no_window.z = 1500
@mode = 0
end
# -----------------------------
def on_decision(filename)
if FileTest.exist?(filename)
@confirm_window.visible = true
@yes_no_window.visible = true
@yes_no_window.active = true
@mode = 1
else
$game_system.se_play($data_system.save_se)
file = File.open(filename, "wb")
write_save_data(file)
file.close
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
end
# -----------------------------
def update
if @mode == 0
super
else
@help_window.update
@yes_no_window.update
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if @yes_no_window.index == 0
filename = make_filename(@file_index)
$game_system.se_play($data_system.save_se)
file = File.open(filename, "wb")
write_save_data(file)
file.close
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(4)
end
else
@confirm_window.visible = false
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.index = 1
@mode = 0
end
end
if Input.trigger?(Input::B)
@confirm_window.visible = false
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.index = 1
@mode = 0
return
end
end
end
# -----------------------------
def on_cancel
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
# -----------------------------
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_party, file)
Marshal.dump($game_map.name, file)
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_map, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_player, file)
end
end
#==============================================================================
# ? Scene_Load
#------------------------------------------------------------------------------
# ??????????????????
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
# ???????????????
$game_temp = Game_Temp.new
# ??????????????????
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("Which file do you wish to load from?")
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def on_decision(filename)
# ????????????
unless FileTest.exist?(filename)
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ??? SE ???
$game_system.se_play($data_system.load_se)
# ???????????
file = File.open(filename, "rb")
read_save_data(file)
file.close
# BGM?BGS ???
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# ?????? (????????)
$game_map.update
# ??????????
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def on_cancel
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
# ???????????
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
# ? ???????????
# file : ??????????????? (??????)
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_party = Marshal.load(file)
@game_map_name = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_map = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_player = Marshal.load(file)
# ???????????????????
# (?????????????????)
if $game_system.magic_number != $data_system.magic_number
# ????????
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# ???????????????
$game_party.refresh
end
end
#==============================================================================
# ? Scene_File
#------------------------------------------------------------------------------
# ?????????????????????????
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
# ? ?????????
# help_text : ????????????????
#--------------------------------------------------------------------------
def initialize(help_text)
@help_text = help_text
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ???????????
@help_window = Window_Help.new
@help_window.set_text(@help_text)
# ???????????????
@savefile_windows = []
for i in 0..3
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
# ??????????????
@file_index = $game_temp.last_file_index
@savefile_windows[@file_index].selected = true
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@help_window.dispose
for i in @savefile_windows
i.dispose
end
if self.is_a?(Scene_Save)
@confirm_window.dispose
@yes_no_window.dispose
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ????????
@help_window.update
for i in @savefile_windows
i.update
end
# C ??????????
if Input.trigger?(Input::C)
# ???? on_decision (??????) ???
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
# B ??????????
if Input.trigger?(Input::B)
# ???? on_cancel (??????) ???
on_cancel
return
end
# ??????????????
if Input.repeat?(Input::DOWN)
# ????????????????????????
# ?????????? 3 ??????
if Input.trigger?(Input::DOWN) or @file_index < 3
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ?????????
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 1) % 4
@savefile_windows[@file_index].selected = true
return
end
end
# ??????????????
if Input.repeat?(Input::UP)
# ????????????????????????
# ?????????? 0 ???????
if Input.trigger?(Input::UP) or @file_index > 0
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ?????????
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 3) % 4
@savefile_windows[@file_index].selected = true
return
end
end
end
#--------------------------------------------------------------------------
# ? ????????
# file_index : ?????????????? (0?3)
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
end
end
#
# Map Name Script ver.1.03.3
# by: fukuyama
# Japanese Comments Removed By: K-Anator
# http://www.rpg-reborn.tk
# This only gives the game_map.name method
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
alias xrxs20_main main
def main
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
xrxs20_main
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
def name
$map_infos[@map_id]
end
end
Makeamidget's Battle Warning Script:
Instructions:
This script will put a bar over your head that will have an encounter bar in it. The size depends on the encounter rate and when the bar gets to the very end you will be attacked by monsters. First go to 'Scene_Map' and add this under the 'main' command:
Quote:unless $game_system.encounter_disabled
@encounter = Encounter.new(0,0,($game_map.encounter_step + 30))
@encounter.x = ($game_player.real_x - $game_map.display_x) / 4 - 19
@encounter.y = ($game_player.real_y - $game_map.display_y) / 4 - 60
end
Now, make a new class above 'Main' and call it Encounter Bar and put this into it:
Battle Warning Script
#=================================================
# The amazing Battle Warning thing by makeamidget
#=================================================
class Encounter < Window_Base
def initialize(x=0,y=0,width=200,height=45)
if width > 640
width = 640
end
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Help" window font
self.contents.font.size = $defaultfontsize
self.opacity = 0#change if you want to see the box
refresh
end
def refresh
self.contents.clear
draw_encounter(0,0)
end
def draw_encounter( x=200, y=200, width = $game_map.encounter_step, height=20)
self.contents.font.color = normal_color
self.contents.font.size = 17
self.contents.fill_rect(x-1, y+1, width+2,11, Color.new(0, 0, 0, 255))
w = width * $game_player.encounter_count / $game_map.encounter_step
self.contents.fill_rect(x, y+2, w,1, Color.new(0, 0, 100,255))
self.contents.fill_rect(x, y+3, w,1, Color.new(4, 4, 106, 255))
self.contents.fill_rect(x, y+4, w,1, Color.new(8, 8, 112, 255))
self.contents.fill_rect(x, y+5, w,1, Color.new(12, 12, 118, 255))
self.contents.fill_rect(x, y+6, w,1, Color.new(16, 16, 124, 255))
self.contents.fill_rect(x, y+7, w,1, Color.new(20, 20, 130, 255))
self.contents.fill_rect(x, y+8, w,1, Color.new(24, 24, 136, 255))
self.contents.fill_rect(x, y+9, w,1, Color.new(28, 28, 142, 255))
self.contents.fill_rect(x, y+10, w,1, Color.new(32, 32, 148, 255))
end
end
# The amazing Battle Warning thing by makeamidget
#=================================================
class Encounter < Window_Base
def initialize(x=0,y=0,width=200,height=45)
if width > 640
width = 640
end
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Help" window font
self.contents.font.size = $defaultfontsize
self.opacity = 0#change if you want to see the box
refresh
end
def refresh
self.contents.clear
draw_encounter(0,0)
end
def draw_encounter( x=200, y=200, width = $game_map.encounter_step, height=20)
self.contents.font.color = normal_color
self.contents.font.size = 17
self.contents.fill_rect(x-1, y+1, width+2,11, Color.new(0, 0, 0, 255))
w = width * $game_player.encounter_count / $game_map.encounter_step
self.contents.fill_rect(x, y+2, w,1, Color.new(0, 0, 100,255))
self.contents.fill_rect(x, y+3, w,1, Color.new(4, 4, 106, 255))
self.contents.fill_rect(x, y+4, w,1, Color.new(8, 8, 112, 255))
self.contents.fill_rect(x, y+5, w,1, Color.new(12, 12, 118, 255))
self.contents.fill_rect(x, y+6, w,1, Color.new(16, 16, 124, 255))
self.contents.fill_rect(x, y+7, w,1, Color.new(20, 20, 130, 255))
self.contents.fill_rect(x, y+8, w,1, Color.new(24, 24, 136, 255))
self.contents.fill_rect(x, y+9, w,1, Color.new(28, 28, 142, 255))
self.contents.fill_rect(x, y+10, w,1, Color.new(32, 32, 148, 255))
end
end
Momomomo's Item Book Script (Translated by Mcdohl):
Instructions:
Installation:
Make a new class called Item Book above 'Main' and put the spoiler code into it.
Usage:
It is a very long script indeed lol, but don't be worried, its not too hard to use.
First off, go to your Database in your game after you get this script in and go to the system tab. In the bottom left hand corner in the element/attribute tab, add new slots. Now, the stuff in these lines:
Quote:
@item_kind_name = ["Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@armor_kind_name = ["Armor", "Accessories"]
@kind_row = ["Items",
"Status_Inflicting_Items",
"Status Increasing Items",
"Quest_Items",
"Weapons",
"Armor",
"Accessories",
"Quests"]
@item_kind_element_name = ["Common Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@weapon_kind_element_name = []
@armor_kind_element_name = ["Armor", "Accessories"]
Is what you put in those new elements/attributes you just made. Note that I have customized this to my needs, if you want to get rid of the quest items, and quests, just delete all instances of each out of those lines above that are in the script. You can add new ones in the same way as well.
Now, go to the items and armor tabs in your database and, lets say were in the armor tab, we go to Bronze Shield and check the 'armor' element/attribute. We go to Power Ring and check the accessories element/attribute. this places that item in that section. You do the same for items.
Common Items are what the defaults are, or what you want of course, then you can add sections or other items, and armors. Weapons are already listed, you don't need to make an element/attribute for them.
Now, to call this from the menu or a call script use this:
Quote: $scene = Scene_ItemBook.new
Item Book Script
#================================
# Item_Book by momomomo?
# http://f53.aaa.livedoor.jp/%7Emomomo/sou...ource.html
#----------------------------------------------------------------
#-Translated by Mcdohl
#----------------------------------------------------------------
#================================
# English is not my main language, so I'm sorry if you can't understand some of my comments.
# 11.18.2005
# Script translated, known bugs:
# -Won't display items you have equipped at start until you unequip them. This is because the
# script detects items until you get them on the "item" menu, not the Equipment menu. A way
# to fix this is to start with nothing equipped, then add the items and equip them in an auto-start
# event.
# This script will add all the items you acquire throughout the game into a "Book."
# In this book you can see the stats, price, element, etc. Works great with KGC's Item
# Grouping Script.
module Item_Book_Config
# The following line (SHOW_COMPLETE_TYPE =) is very important. It will define how are
# the items counted. (The item count appears on the upper right corner, in the help window.
# Use "0" to display nothing.
# Use "1" to display it in a "items found so far/total" format.
# Use "2" to use percentage completion.
# Use "3" Method 1+2
SHOW_COMPLETE_TYPE = 1
end
class Data_ItemBook
attr_reader :item_kind_name
attr_reader :weapon_kind_name
attr_reader :armor_kind_name
attr_reader :kind_row
attr_reader :item_id_data
attr_reader :weapon_id_data
attr_reader :armor_id_data
attr_reader :item_kind_element_name
attr_reader :weapon_kind_element_name
attr_reader :armor_kind_element_name
#--------------------------------------------------------------------------
# ? Setup
#--------------------------------------------------------------------------
def initialize
# Name the item, weapon and armor categories. If your key items are in the Item index in the
# database, then type it inside the item_kind_name brackets and so on. Got it? I hope so. ^^
@item_kind_name = ["Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@weapon_kind_name = ["Weapons"]
@armor_kind_name = ["Armor", "Accessories"]
# Next is the menu setup. It's a vertical list. List the categories in any order you want.
# Note: The categories below must coincide with the categories you listed above.
@kind_row = ["Items",
"Status_Inflicting_Items",
"Status Increasing Items",
"Quest_Items",
"Weapons",
"Armor",
"Accessories",
"Quests"]
# Now write the element setups. It's easier to understand this if you're already using KGC's
# item grouping script. You need to add elements in the Database (in the System Tab). For
# example, if you want to use a Key Item category, go make an element called "Key Item" and
# then apply it to all the items you want them to appear under the Key Item category!
# If you're not going to categorize a kind of item, like in this case "Weapons" then just type the
# brackets with nothing inside.
@item_kind_element_name = ["Common Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@weapon_kind_element_name = []
@armor_kind_element_name = ["Armor", "Accessories"]
# Reading Database data.
@item_id_data = item_book_id_set
@weapon_id_data = weapon_book_id_set
@armor_id_data = armor_book_id_set
end
#--------------------------------------------------------------------------
# ? Defining Kinds
#--------------------------------------------------------------------------
def kind_search(name)
if @item_kind_name.include?(name)
return [0, @item_kind_name.index(name)]
elsif @weapon_kind_name.include?(name)
return [1, @weapon_kind_name.index(name)]
elsif @armor_kind_name.include?(name)
return [2, @armor_kind_name.index(name)]
end
end
#--------------------------------------------------------------------------
# ? ??????????? <----No idea
#--------------------------------------------------------------------------
def no_add_element
no_add = 0
# ???????ID???
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /??????/
no_add = i
break
end
end
return no_add
end
#--------------------------------------------------------------------------
# ? ?????????ID??? <-----No idea
#--------------------------------------------------------------------------
def element_search(element_name)
return nil if element_name == nil
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /^#{element_name}/
return i
end
end
end
#--------------------------------------------------------------------------
# ? Item Database
#--------------------------------------------------------------------------
def item_book_id_set
data = []
no_add = no_add_element
if @item_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_items.size
item = $data_items[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@item_kind_element_name.size
data[i] = [0]
element_id = element_search(@item_kind_element_name[i])
for j in 1...$data_items.size
item = $data_items[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
#--------------------------------------------------------------------------
# ? Weapon Database
#--------------------------------------------------------------------------
def weapon_book_id_set
data = []
no_add = no_add_element
if @weapon_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_weapons.size
item = $data_weapons[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@weapon_kind_element_name.size
data[i] = [0]
element_id = element_search(@weapon_kind_element_name[i])
for j in 1...$data_weapons.size
item = $data_weapons[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
#--------------------------------------------------------------------------
# ? Armor Database
#--------------------------------------------------------------------------
def armor_book_id_set
data = []
no_add = no_add_element
if @armor_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_armors.size
item = $data_armors[i]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@armor_kind_element_name.size
data[i] = [0]
element_id = element_search(@armor_kind_element_name[i])
for j in 1...$data_armors.size
item = $data_armors[j]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
if item.guard_element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ? Element Set Up
# NOTE: Default RTP elements were used.
#--------------------------------------------------------------------------
def draw_attack_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("Fire") if elem == "Fire"
elem_temp.push("Ice") if elem == "Ice"
elem_temp.push("Thunder") if elem == "Thunder"
elem_temp.push("Water") if elem == "Water"
elem_temp.push("Earth") if elem == "Earth"
elem_temp.push("Wind") if elem == "Wind"
elem_temp.push("Light") if elem == "Light"
elem_temp.push("Darkness") if elem == "Darkness"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ?????? <---No idea
#--------------------------------------------------------------------------
def draw_attack_wp_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("?") if elem == "?"
elem_temp.push("?") if elem == "?"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "??")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ?????? <-------No idea
#--------------------------------------------------------------------------
def draw_attack_weak_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? States (Status Abnormalities, like Poison, etc.)
#--------------------------------------------------------------------------
def draw_attack_add_state(x, y, plus_state_set)
state_temp = []
for i in plus_state_set
state = $data_states[i]
state_temp.push(state.name) if state.name != ""
end
if state_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
oy = 0
for name in state_temp
cx = self.contents.text_size(name).width
if ox + cx + 4 >= self.contents.width - 128
ox = 0
oy += 1
end
self.contents.draw_text(x+ox, y+oy*32, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ??????? <-------No idea
#--------------------------------------------------------------------------
def draw_scope(scope)
case scope
when 0
return ""
when 1
return "???"
when 2
return "???"
when 3
return "????"
when 4
return "????"
when 5
return "????"
when 6
return "????"
when 7
return "???"
end
end
end
class Game_Temp
attr_accessor :item_book_data
alias temp_item_book_data_initialize initialize
def initialize
temp_item_book_data_initialize
@item_book_data = Data_ItemBook.new
end
end
class Game_Party
attr_accessor :item_count # ????????(???)
attr_accessor :weapon_count # ??????(???)
attr_accessor :armor_count # ??????(???)
#--------------------------------------------------------------------------
# ? Registers items when you obtain them
#--------------------------------------------------------------------------
alias item_book_info_initialize initialize
def initialize
item_book_info_initialize
@item_count = {}
@weapon_count = {}
@armor_count = {}
end
alias item_book_gain_item gain_item
def gain_item(item_id, n)
add_item_count(item_id, 0) if n > 0
item_book_gain_item(item_id, n)
end
alias item_book_gain_weapon gain_weapon
def gain_weapon(item_id, n)
add_weapon_count(item_id, 0) if n > 0
item_book_gain_weapon(item_id, n)
end
alias item_book_gain_armor gain_armor
def gain_armor(item_id, n)
add_armor_count(item_id, 0) if n > 0
item_book_gain_armor(item_id, n)
end
def add_item_count(item_id, type = 0)
if type == -1
@item_count[item_id] = 0
else
@item_count[item_id] = 1
end
end
def add_weapon_count(weapon_id, type = 0)
if type == -1
@weapon_count[weapon_id] = 0
else
@weapon_count[weapon_id] = 1
end
end
def add_armor_count(armor_id, type = 0)
if type == -1
@armor_count[armor_id] = 0
else
@armor_count[armor_id] = 1
end
end
#--------------------------------------------------------------------------
# ? ???????????????
#--------------------------------------------------------------------------
def item_book_max
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_max(kind)
end
end
return size
end
#--------------------------------------------------------------------------
# ? ???????????????
#--------------------------------------------------------------------------
def item_book_now
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_now(kind)
end
end
return size
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def item_book_complete_percentage
i_max = item_book_max.to_f
i_now = item_book_now.to_f
comp = i_now / i_max * 100
return comp.truncate
end
#--------------------------------------------------------------------------
# ? ?????????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_max(category)
kind_data = $game_temp.item_book_data.kind_search(category)
case kind_data[0]
when 0
id_data = $game_temp.item_book_data.item_id_data.dup
when 1
id_data = $game_temp.item_book_data.weapon_id_data.dup
when 2
id_data = $game_temp.item_book_data.armor_id_data.dup
end
index = kind_data[1]
size = id_data[index].size - 1
return size
end
#--------------------------------------------------------------------------
# ? ?????????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_now(category)
kind_data = $game_temp.item_book_data.kind_search(category)
index = kind_data[1]
case kind_data[0]
when 0
now_item_info = @item_count.keys
elename = $game_temp.item_book_data.item_kind_element_name[index]
item_set = $data_items
when 1
now_item_info = @weapon_count.keys
elename = $game_temp.item_book_data.weapon_kind_element_name[index]
item_set = $data_weapons
when 2
now_item_info = @armor_count.keys
elename = $game_temp.item_book_data.armor_kind_element_name[index]
item_set = $data_armors
end
# ???????ID???
no_add = $game_temp.item_book_data.no_add_element
element_id = $game_temp.item_book_data.element_search(elename)
new_item_info = []
for i in now_item_info
item = item_set[i]
next if item == nil
next if item.name == ""
case item
when RPG::Item
ele_set = item.element_set
when RPG::Weapon
ele_set = item.element_set
when RPG::Armor
ele_set = item.guard_element_set
end
next if ele_set.include?(no_add)
if element_id == nil or ele_set.include?(element_id)
new_item_info.push(item.id)
end
end
return new_item_info.size
end
#--------------------------------------------------------------------------
# ? ???????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_complete_percentage(category)
i_max = item_book_category_max(category).to_f
i_now = item_book_category_now(category).to_f
comp = i_now / i_max * 100
end
end
class Interpreter
def item_book_max(category=nil)
if category == nil
return $game_party.item_book_max
else
return $game_party.item_book_category_max(category)
end
end
def item_book_now(category=nil)
if category == nil
return $game_party.item_book_now
else
return $game_party.item_book_category_now(category)
end
end
def item_book_comp(category=nil)
if category == nil
return $game_party.item_book_complete_percentage
else
return $game_party.item_book_category_complete_percentage(category)
end
end
end
class Window_ItemBook < Window_Selectable
attr_reader :data
attr_reader :item_kind
attr_reader :item_index
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize(index=0)
super(0, 64, 640, 416)
@column_max = 2
@book_data = $game_temp.item_book_data
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
@item_kind = index
self.index = 0
#refresh
end
def new_data_set(index)
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def data_set(index)
kind_row_data = @book_data.kind_search(@book_data.kind_row[index])
@item_kind = kind_row_data[0]
@item_index = kind_row_data[1]
data = []
case @item_kind
when 0
data = @book_data.item_id_data[@item_index].dup
when 1
data = @book_data.weapon_id_data[@item_index].dup
when 2
data = @book_data.armor_id_data[@item_index].dup
end
return data
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def show?(kind, id)
case kind
when 0
if $game_party.item_count[id] == 0 or $game_party.item_count[id] == nil
return false
else
return true
end
when 1
if $game_party.weapon_count[id] == 0 or $game_party.weapon_count[id] == nil
return false
else
return true
end
when 2
if $game_party.armor_count[id] == 0 or $game_party.armor_count[id] == nil
return false
else
return true
end
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
#???? 0 ??????????????????????
return if @item_max == 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
case @item_kind
when 0
item = $data_items[@data[index]]
id = @book_data.item_id_data[@item_index].index(item.id)
when 1
item = $data_weapons[@data[index]]
id = @book_data.weapon_id_data[@item_index].index(item.id)
when 2
item = $data_armors[@data[index]]
id = @book_data.armor_id_data[@item_index].index(item.id)
end
return if item == nil
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 32, 32, id.to_s)
if show?(@item_kind, item.id)
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x+48, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x+48 + 28, y, 212, 32, item.name, 0)
else
# The "??" are used for the blank spaces. (The spaces of the items you have not obtained yet.)
self.contents.draw_text(x+48 + 28, y, 212, 32, "??", 0)
return
end
end
end
class Window_ItemBook_Info < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 0+64+64, 640, 480-64-64)
@book_data = $game_temp.item_book_data
self.contents = Bitmap.new(width - 32, height - 32)
self.index = -1
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh(item_id, item_kind, item_index)
self.contents.clear
self.contents.font.size = 22
case item_kind
when 0
draw_item_info(item_id, item_index)
when 1
draw_weapon_info(item_id, item_index)
when 2
draw_armor_info(item_id, item_index)
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def draw_item_info(item_id, item_index)
item = $data_items[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.item_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = normal_color
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def draw_weapon_info(item_id, item_index)
item = $data_weapons[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.weapon_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = text_color(2)
self.contents.draw_text(4, 32, 48, 32, "ATK", 0)
self.contents.font.color = text_color(4)
self.contents.draw_text(4+128, 32, 48, 32, "DEF", 0)
self.contents.font.color = text_color(6)
self.contents.draw_text(4+256, 32, 48, 32, "MDF", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 32, 48, 32, item.atk.to_s, 2)
self.contents.draw_text(4+48+128, 32, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(4+48+256, 32, 48, 32, item.mdef.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 48, 32, "STR", 0)
self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0)
self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0)
self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 96, 96, 32, "Element Add")
# I don't understand Line 815!!!
self.contents.draw_text(4, 128, 96, 32, "")
self.contents.draw_text(4, 160, 96, 32, "State Add")
#self.contents.draw_text(4, 128, 96, 32, "????")
self.contents.font.color = normal_color
draw_attack_element(4+96+16, 96, item.element_set)
draw_attack_weak_element(4+96+16, 128, item.element_set)
draw_attack_add_state(4+96+16, 160, item.plus_state_set)
#draw_attack_wp_element(4+96+16, 128, item.element_set)
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def draw_armor_info(item_id, item_index)
item = $data_armors[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.armor_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = text_color(4)
self.contents.draw_text(4, 32, 48, 32, "DEF", 0)
self.contents.font.color = text_color(6)
self.contents.draw_text(4+128, 32, 48, 32, "MDF", 0)
self.contents.font.color = system_color
self.contents.draw_text(4+256, 32, 48, 32, "EVA", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 32, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(4+48+128, 32, 48, 32, item.mdef.to_s, 2)
self.contents.draw_text(4+48+256, 32, 48, 32, item.eva.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 48, 32, "STR", 0)
self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0)
self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0)
self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 96, 96, 32, "Element Guard")
# I don't understand line 868!!!
self.contents.draw_text(4, 128, 96, 32, "")
self.contents.draw_text(4, 160, 96, 32, "State Guard")
#self.contents.draw_text(4, 128, 96, 32, "????")
self.contents.font.color = normal_color
draw_attack_element(4+96+16, 96, item.guard_element_set)
draw_attack_weak_element(4+96+16, 128, item.guard_element_set)
draw_attack_add_state(4+96+16, 160, item.guard_state_set)
#draw_attack_wp_element(4+96+16, 128, item.guard_element_set)
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
#???
end
end
class Scene_ItemBook
include Item_Book_Config
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ????????
@title_window = Window_Base.new(0, 0, 640, 64)
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
# Your book's title.
@title_window.contents.draw_text(4, 0, 320, 32, "Item Book", 0)
draw_comp
@main_window = Window_ItemBook.new
@main_window.active = false
@main_window.index = -1
@help_window = Window_Help.new
@help_window.z = 110
@help_window.y = 64
@help_window.visible = false
command = $game_temp.item_book_data.kind_row
@kind_window = Window_Command.new(160, command)
@kind_window.z = 110
@kind_window.x = 320 - @kind_window.width / 2
@kind_window.y = 240 - @kind_window.height / 2
@kind_window.active = true
# ???????????? (?????????????)
@info_window = Window_ItemBook_Info.new
@info_window.z = 110
@info_window.visible = false
@info_window.active = false
# ?????????????
@info_window.help_window = @help_window
@visible_index = 0
@now_kind = nil
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@title_window.dispose
@help_window.dispose
@main_window.dispose
@kind_window.dispose
@info_window.dispose
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ????????
#@help_window.update
@main_window.update
@kind_window.update
@info_window.update
if @info_window.active
update_info
return
end
# ?????????????????: update_target ???
if @main_window.active
update_main
return
end
# ????????????????: update_kind ???
if @kind_window.active
update_kind
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????)
#--------------------------------------------------------------------------
def update_kind
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
if @now_kind != @kind_window.index
@main_window.new_data_set(@kind_window.index)
@main_window.refresh
@now_kind = @kind_window.index
end
subtitle = $game_temp.item_book_data.kind_row[@kind_window.index]
# This is, when you enter a sub-menu. (for example Armors). Armors is the subtitle, so you
# write a text to go before Armors. The default said "Item Book:" that way it would look this
# way when you scroll through the Armor Section..."Item Book: Armors."
title = ""+subtitle
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, title, 0)
draw_comp(subtitle)
@kind_window.active = false
@kind_window.visible = false
@main_window.active = true
@main_window.index = 0
return
end
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (?????????????????)
#--------------------------------------------------------------------------
def update_main
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = false
@kind_window.active = true
@kind_window.visible = true
@main_window.index = -1
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "??????", 0)
draw_comp
return
end
# C ??????????
if Input.trigger?(Input::C)
if @main_window.item == nil or
@main_window.show?(@main_window.item_kind, @main_window.item) == false
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ?? SE ???
$game_system.se_play($data_system.decision_se)
@main_window.active = false
@info_window.active = true
@info_window.visible = true
@visible_index = @main_window.index
@info_window.refresh(@main_window.item, @main_window.item_kind, @main_window.item_index)
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (??????????????????)
#--------------------------------------------------------------------------
def update_info
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = true
@info_window.active = false
@info_window.visible = false
@help_window.visible = false
return
end
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
return
end
if Input.trigger?(Input::L)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != 0
@visible_index -= 1
else
@visible_index = @main_window.data.size - 1
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
if Input.trigger?(Input::R)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != @main_window.data.size - 1
@visible_index += 1
else
@visible_index = 0
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
end
def draw_comp(category=nil)
if SHOW_COMPLETE_TYPE != 0
if category == nil
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_complete_percentage
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
comp = $game_party.item_book_complete_percentage
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
else
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_category_complete_percentage(category)
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
comp = $game_party.item_book_category_complete_percentage(category)
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
end
if text != nil
@title_window.contents.draw_text(320, 0, 288, 32, text, 2)
end
end
end
end
# Item_Book by momomomo?
# http://f53.aaa.livedoor.jp/%7Emomomo/sou...ource.html
#----------------------------------------------------------------
#-Translated by Mcdohl
#----------------------------------------------------------------
#================================
# English is not my main language, so I'm sorry if you can't understand some of my comments.
# 11.18.2005
# Script translated, known bugs:
# -Won't display items you have equipped at start until you unequip them. This is because the
# script detects items until you get them on the "item" menu, not the Equipment menu. A way
# to fix this is to start with nothing equipped, then add the items and equip them in an auto-start
# event.
# This script will add all the items you acquire throughout the game into a "Book."
# In this book you can see the stats, price, element, etc. Works great with KGC's Item
# Grouping Script.
module Item_Book_Config
# The following line (SHOW_COMPLETE_TYPE =) is very important. It will define how are
# the items counted. (The item count appears on the upper right corner, in the help window.
# Use "0" to display nothing.
# Use "1" to display it in a "items found so far/total" format.
# Use "2" to use percentage completion.
# Use "3" Method 1+2
SHOW_COMPLETE_TYPE = 1
end
class Data_ItemBook
attr_reader :item_kind_name
attr_reader :weapon_kind_name
attr_reader :armor_kind_name
attr_reader :kind_row
attr_reader :item_id_data
attr_reader :weapon_id_data
attr_reader :armor_id_data
attr_reader :item_kind_element_name
attr_reader :weapon_kind_element_name
attr_reader :armor_kind_element_name
#--------------------------------------------------------------------------
# ? Setup
#--------------------------------------------------------------------------
def initialize
# Name the item, weapon and armor categories. If your key items are in the Item index in the
# database, then type it inside the item_kind_name brackets and so on. Got it? I hope so. ^^
@item_kind_name = ["Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@weapon_kind_name = ["Weapons"]
@armor_kind_name = ["Armor", "Accessories"]
# Next is the menu setup. It's a vertical list. List the categories in any order you want.
# Note: The categories below must coincide with the categories you listed above.
@kind_row = ["Items",
"Status_Inflicting_Items",
"Status Increasing Items",
"Quest_Items",
"Weapons",
"Armor",
"Accessories",
"Quests"]
# Now write the element setups. It's easier to understand this if you're already using KGC's
# item grouping script. You need to add elements in the Database (in the System Tab). For
# example, if you want to use a Key Item category, go make an element called "Key Item" and
# then apply it to all the items you want them to appear under the Key Item category!
# If you're not going to categorize a kind of item, like in this case "Weapons" then just type the
# brackets with nothing inside.
@item_kind_element_name = ["Common Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@weapon_kind_element_name = []
@armor_kind_element_name = ["Armor", "Accessories"]
# Reading Database data.
@item_id_data = item_book_id_set
@weapon_id_data = weapon_book_id_set
@armor_id_data = armor_book_id_set
end
#--------------------------------------------------------------------------
# ? Defining Kinds
#--------------------------------------------------------------------------
def kind_search(name)
if @item_kind_name.include?(name)
return [0, @item_kind_name.index(name)]
elsif @weapon_kind_name.include?(name)
return [1, @weapon_kind_name.index(name)]
elsif @armor_kind_name.include?(name)
return [2, @armor_kind_name.index(name)]
end
end
#--------------------------------------------------------------------------
# ? ??????????? <----No idea
#--------------------------------------------------------------------------
def no_add_element
no_add = 0
# ???????ID???
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /??????/
no_add = i
break
end
end
return no_add
end
#--------------------------------------------------------------------------
# ? ?????????ID??? <-----No idea
#--------------------------------------------------------------------------
def element_search(element_name)
return nil if element_name == nil
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /^#{element_name}/
return i
end
end
end
#--------------------------------------------------------------------------
# ? Item Database
#--------------------------------------------------------------------------
def item_book_id_set
data = []
no_add = no_add_element
if @item_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_items.size
item = $data_items[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@item_kind_element_name.size
data[i] = [0]
element_id = element_search(@item_kind_element_name[i])
for j in 1...$data_items.size
item = $data_items[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
#--------------------------------------------------------------------------
# ? Weapon Database
#--------------------------------------------------------------------------
def weapon_book_id_set
data = []
no_add = no_add_element
if @weapon_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_weapons.size
item = $data_weapons[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@weapon_kind_element_name.size
data[i] = [0]
element_id = element_search(@weapon_kind_element_name[i])
for j in 1...$data_weapons.size
item = $data_weapons[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
#--------------------------------------------------------------------------
# ? Armor Database
#--------------------------------------------------------------------------
def armor_book_id_set
data = []
no_add = no_add_element
if @armor_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_armors.size
item = $data_armors[i]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@armor_kind_element_name.size
data[i] = [0]
element_id = element_search(@armor_kind_element_name[i])
for j in 1...$data_armors.size
item = $data_armors[j]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
if item.guard_element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ? Element Set Up
# NOTE: Default RTP elements were used.
#--------------------------------------------------------------------------
def draw_attack_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("Fire") if elem == "Fire"
elem_temp.push("Ice") if elem == "Ice"
elem_temp.push("Thunder") if elem == "Thunder"
elem_temp.push("Water") if elem == "Water"
elem_temp.push("Earth") if elem == "Earth"
elem_temp.push("Wind") if elem == "Wind"
elem_temp.push("Light") if elem == "Light"
elem_temp.push("Darkness") if elem == "Darkness"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ?????? <---No idea
#--------------------------------------------------------------------------
def draw_attack_wp_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("?") if elem == "?"
elem_temp.push("?") if elem == "?"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "??")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ?????? <-------No idea
#--------------------------------------------------------------------------
def draw_attack_weak_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? States (Status Abnormalities, like Poison, etc.)
#--------------------------------------------------------------------------
def draw_attack_add_state(x, y, plus_state_set)
state_temp = []
for i in plus_state_set
state = $data_states[i]
state_temp.push(state.name) if state.name != ""
end
if state_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
oy = 0
for name in state_temp
cx = self.contents.text_size(name).width
if ox + cx + 4 >= self.contents.width - 128
ox = 0
oy += 1
end
self.contents.draw_text(x+ox, y+oy*32, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ??????? <-------No idea
#--------------------------------------------------------------------------
def draw_scope(scope)
case scope
when 0
return ""
when 1
return "???"
when 2
return "???"
when 3
return "????"
when 4
return "????"
when 5
return "????"
when 6
return "????"
when 7
return "???"
end
end
end
class Game_Temp
attr_accessor :item_book_data
alias temp_item_book_data_initialize initialize
def initialize
temp_item_book_data_initialize
@item_book_data = Data_ItemBook.new
end
end
class Game_Party
attr_accessor :item_count # ????????(???)
attr_accessor :weapon_count # ??????(???)
attr_accessor :armor_count # ??????(???)
#--------------------------------------------------------------------------
# ? Registers items when you obtain them
#--------------------------------------------------------------------------
alias item_book_info_initialize initialize
def initialize
item_book_info_initialize
@item_count = {}
@weapon_count = {}
@armor_count = {}
end
alias item_book_gain_item gain_item
def gain_item(item_id, n)
add_item_count(item_id, 0) if n > 0
item_book_gain_item(item_id, n)
end
alias item_book_gain_weapon gain_weapon
def gain_weapon(item_id, n)
add_weapon_count(item_id, 0) if n > 0
item_book_gain_weapon(item_id, n)
end
alias item_book_gain_armor gain_armor
def gain_armor(item_id, n)
add_armor_count(item_id, 0) if n > 0
item_book_gain_armor(item_id, n)
end
def add_item_count(item_id, type = 0)
if type == -1
@item_count[item_id] = 0
else
@item_count[item_id] = 1
end
end
def add_weapon_count(weapon_id, type = 0)
if type == -1
@weapon_count[weapon_id] = 0
else
@weapon_count[weapon_id] = 1
end
end
def add_armor_count(armor_id, type = 0)
if type == -1
@armor_count[armor_id] = 0
else
@armor_count[armor_id] = 1
end
end
#--------------------------------------------------------------------------
# ? ???????????????
#--------------------------------------------------------------------------
def item_book_max
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_max(kind)
end
end
return size
end
#--------------------------------------------------------------------------
# ? ???????????????
#--------------------------------------------------------------------------
def item_book_now
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_now(kind)
end
end
return size
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def item_book_complete_percentage
i_max = item_book_max.to_f
i_now = item_book_now.to_f
comp = i_now / i_max * 100
return comp.truncate
end
#--------------------------------------------------------------------------
# ? ?????????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_max(category)
kind_data = $game_temp.item_book_data.kind_search(category)
case kind_data[0]
when 0
id_data = $game_temp.item_book_data.item_id_data.dup
when 1
id_data = $game_temp.item_book_data.weapon_id_data.dup
when 2
id_data = $game_temp.item_book_data.armor_id_data.dup
end
index = kind_data[1]
size = id_data[index].size - 1
return size
end
#--------------------------------------------------------------------------
# ? ?????????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_now(category)
kind_data = $game_temp.item_book_data.kind_search(category)
index = kind_data[1]
case kind_data[0]
when 0
now_item_info = @item_count.keys
elename = $game_temp.item_book_data.item_kind_element_name[index]
item_set = $data_items
when 1
now_item_info = @weapon_count.keys
elename = $game_temp.item_book_data.weapon_kind_element_name[index]
item_set = $data_weapons
when 2
now_item_info = @armor_count.keys
elename = $game_temp.item_book_data.armor_kind_element_name[index]
item_set = $data_armors
end
# ???????ID???
no_add = $game_temp.item_book_data.no_add_element
element_id = $game_temp.item_book_data.element_search(elename)
new_item_info = []
for i in now_item_info
item = item_set[i]
next if item == nil
next if item.name == ""
case item
when RPG::Item
ele_set = item.element_set
when RPG::Weapon
ele_set = item.element_set
when RPG::Armor
ele_set = item.guard_element_set
end
next if ele_set.include?(no_add)
if element_id == nil or ele_set.include?(element_id)
new_item_info.push(item.id)
end
end
return new_item_info.size
end
#--------------------------------------------------------------------------
# ? ???????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_complete_percentage(category)
i_max = item_book_category_max(category).to_f
i_now = item_book_category_now(category).to_f
comp = i_now / i_max * 100
end
end
class Interpreter
def item_book_max(category=nil)
if category == nil
return $game_party.item_book_max
else
return $game_party.item_book_category_max(category)
end
end
def item_book_now(category=nil)
if category == nil
return $game_party.item_book_now
else
return $game_party.item_book_category_now(category)
end
end
def item_book_comp(category=nil)
if category == nil
return $game_party.item_book_complete_percentage
else
return $game_party.item_book_category_complete_percentage(category)
end
end
end
class Window_ItemBook < Window_Selectable
attr_reader :data
attr_reader :item_kind
attr_reader :item_index
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize(index=0)
super(0, 64, 640, 416)
@column_max = 2
@book_data = $game_temp.item_book_data
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
@item_kind = index
self.index = 0
#refresh
end
def new_data_set(index)
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def data_set(index)
kind_row_data = @book_data.kind_search(@book_data.kind_row[index])
@item_kind = kind_row_data[0]
@item_index = kind_row_data[1]
data = []
case @item_kind
when 0
data = @book_data.item_id_data[@item_index].dup
when 1
data = @book_data.weapon_id_data[@item_index].dup
when 2
data = @book_data.armor_id_data[@item_index].dup
end
return data
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def show?(kind, id)
case kind
when 0
if $game_party.item_count[id] == 0 or $game_party.item_count[id] == nil
return false
else
return true
end
when 1
if $game_party.weapon_count[id] == 0 or $game_party.weapon_count[id] == nil
return false
else
return true
end
when 2
if $game_party.armor_count[id] == 0 or $game_party.armor_count[id] == nil
return false
else
return true
end
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
#???? 0 ??????????????????????
return if @item_max == 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
case @item_kind
when 0
item = $data_items[@data[index]]
id = @book_data.item_id_data[@item_index].index(item.id)
when 1
item = $data_weapons[@data[index]]
id = @book_data.weapon_id_data[@item_index].index(item.id)
when 2
item = $data_armors[@data[index]]
id = @book_data.armor_id_data[@item_index].index(item.id)
end
return if item == nil
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 32, 32, id.to_s)
if show?(@item_kind, item.id)
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x+48, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x+48 + 28, y, 212, 32, item.name, 0)
else
# The "??" are used for the blank spaces. (The spaces of the items you have not obtained yet.)
self.contents.draw_text(x+48 + 28, y, 212, 32, "??", 0)
return
end
end
end
class Window_ItemBook_Info < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 0+64+64, 640, 480-64-64)
@book_data = $game_temp.item_book_data
self.contents = Bitmap.new(width - 32, height - 32)
self.index = -1
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh(item_id, item_kind, item_index)
self.contents.clear
self.contents.font.size = 22
case item_kind
when 0
draw_item_info(item_id, item_index)
when 1
draw_weapon_info(item_id, item_index)
when 2
draw_armor_info(item_id, item_index)
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def draw_item_info(item_id, item_index)
item = $data_items[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.item_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = normal_color
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def draw_weapon_info(item_id, item_index)
item = $data_weapons[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.weapon_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = text_color(2)
self.contents.draw_text(4, 32, 48, 32, "ATK", 0)
self.contents.font.color = text_color(4)
self.contents.draw_text(4+128, 32, 48, 32, "DEF", 0)
self.contents.font.color = text_color(6)
self.contents.draw_text(4+256, 32, 48, 32, "MDF", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 32, 48, 32, item.atk.to_s, 2)
self.contents.draw_text(4+48+128, 32, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(4+48+256, 32, 48, 32, item.mdef.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 48, 32, "STR", 0)
self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0)
self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0)
self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 96, 96, 32, "Element Add")
# I don't understand Line 815!!!
self.contents.draw_text(4, 128, 96, 32, "")
self.contents.draw_text(4, 160, 96, 32, "State Add")
#self.contents.draw_text(4, 128, 96, 32, "????")
self.contents.font.color = normal_color
draw_attack_element(4+96+16, 96, item.element_set)
draw_attack_weak_element(4+96+16, 128, item.element_set)
draw_attack_add_state(4+96+16, 160, item.plus_state_set)
#draw_attack_wp_element(4+96+16, 128, item.element_set)
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def draw_armor_info(item_id, item_index)
item = $data_armors[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.armor_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = text_color(4)
self.contents.draw_text(4, 32, 48, 32, "DEF", 0)
self.contents.font.color = text_color(6)
self.contents.draw_text(4+128, 32, 48, 32, "MDF", 0)
self.contents.font.color = system_color
self.contents.draw_text(4+256, 32, 48, 32, "EVA", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 32, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(4+48+128, 32, 48, 32, item.mdef.to_s, 2)
self.contents.draw_text(4+48+256, 32, 48, 32, item.eva.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 48, 32, "STR", 0)
self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0)
self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0)
self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 96, 96, 32, "Element Guard")
# I don't understand line 868!!!
self.contents.draw_text(4, 128, 96, 32, "")
self.contents.draw_text(4, 160, 96, 32, "State Guard")
#self.contents.draw_text(4, 128, 96, 32, "????")
self.contents.font.color = normal_color
draw_attack_element(4+96+16, 96, item.guard_element_set)
draw_attack_weak_element(4+96+16, 128, item.guard_element_set)
draw_attack_add_state(4+96+16, 160, item.guard_state_set)
#draw_attack_wp_element(4+96+16, 128, item.guard_element_set)
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
#???
end
end
class Scene_ItemBook
include Item_Book_Config
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ????????
@title_window = Window_Base.new(0, 0, 640, 64)
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
# Your book's title.
@title_window.contents.draw_text(4, 0, 320, 32, "Item Book", 0)
draw_comp
@main_window = Window_ItemBook.new
@main_window.active = false
@main_window.index = -1
@help_window = Window_Help.new
@help_window.z = 110
@help_window.y = 64
@help_window.visible = false
command = $game_temp.item_book_data.kind_row
@kind_window = Window_Command.new(160, command)
@kind_window.z = 110
@kind_window.x = 320 - @kind_window.width / 2
@kind_window.y = 240 - @kind_window.height / 2
@kind_window.active = true
# ???????????? (?????????????)
@info_window = Window_ItemBook_Info.new
@info_window.z = 110
@info_window.visible = false
@info_window.active = false
# ?????????????
@info_window.help_window = @help_window
@visible_index = 0
@now_kind = nil
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@title_window.dispose
@help_window.dispose
@main_window.dispose
@kind_window.dispose
@info_window.dispose
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ????????
#@help_window.update
@main_window.update
@kind_window.update
@info_window.update
if @info_window.active
update_info
return
end
# ?????????????????: update_target ???
if @main_window.active
update_main
return
end
# ????????????????: update_kind ???
if @kind_window.active
update_kind
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????)
#--------------------------------------------------------------------------
def update_kind
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
if @now_kind != @kind_window.index
@main_window.new_data_set(@kind_window.index)
@main_window.refresh
@now_kind = @kind_window.index
end
subtitle = $game_temp.item_book_data.kind_row[@kind_window.index]
# This is, when you enter a sub-menu. (for example Armors). Armors is the subtitle, so you
# write a text to go before Armors. The default said "Item Book:" that way it would look this
# way when you scroll through the Armor Section..."Item Book: Armors."
title = ""+subtitle
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, title, 0)
draw_comp(subtitle)
@kind_window.active = false
@kind_window.visible = false
@main_window.active = true
@main_window.index = 0
return
end
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (?????????????????)
#--------------------------------------------------------------------------
def update_main
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = false
@kind_window.active = true
@kind_window.visible = true
@main_window.index = -1
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "??????", 0)
draw_comp
return
end
# C ??????????
if Input.trigger?(Input::C)
if @main_window.item == nil or
@main_window.show?(@main_window.item_kind, @main_window.item) == false
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ?? SE ???
$game_system.se_play($data_system.decision_se)
@main_window.active = false
@info_window.active = true
@info_window.visible = true
@visible_index = @main_window.index
@info_window.refresh(@main_window.item, @main_window.item_kind, @main_window.item_index)
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (??????????????????)
#--------------------------------------------------------------------------
def update_info
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = true
@info_window.active = false
@info_window.visible = false
@help_window.visible = false
return
end
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
return
end
if Input.trigger?(Input::L)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != 0
@visible_index -= 1
else
@visible_index = @main_window.data.size - 1
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
if Input.trigger?(Input::R)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != @main_window.data.size - 1
@visible_index += 1
else
@visible_index = 0
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
end
def draw_comp(category=nil)
if SHOW_COMPLETE_TYPE != 0
if category == nil
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_complete_percentage
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
comp = $game_party.item_book_complete_percentage
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
else
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_category_complete_percentage(category)
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
comp = $game_party.item_book_category_complete_percentage(category)
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
end
if text != nil
@title_window.contents.draw_text(320, 0, 288, 32, text, 2)
end
end
end
end