Of course, the script follows below:
[spoiler="Script"]
CODE
#==============================================================================#
# [RGSS2] Monster Album (Bestiary System) #
#------------------------------------------------------------------------------#
# $RafiScripts.by = Rafidelis(Rafis) #
# $RafiScripts.version = 1.2 #
# $RafiScripts.release_date = 31/08/09 (d/m/y) #
# $RafiScripts.email = Rafa_Fidelis@hotmail.com or Rafa_Fidelis@yahoo.com.br #
# $RafiScripts.website = www.ReinoRPG.com or www.ReinoRPG.com/forum #
#==============================================================================#
#==============================================================================#
# [** $RafiScripts.versions **] // Versões do Script/ Script Versions #
#------------------------------------------------------------------------------#
# 30/08/09 - Version 1.0 Released #
#==============================================================================#
#==============================================================================#
# [** $RafiScripts.desc **] // Sobre o Script / About Script #
#------------------------------------------------------------------------------#
# This script create a Monster Album(Bestiary),where are displayed the monsters#
# datas.This script's easily customizable. #
# ** Features #
# (*) Show a background image for each monster. #
# (*) Show a default background image,for the monsters that don't received one #
# separated background image. #
# (*) If you don't want to use images,is used the option 'create portrayal' #
# than make a picture with borders at monsters battlers. #
# (*) Window with bestiary data and informations #
# (*) Easy bestiary monsters description creation(See Instructions) #
# (*) Very easy and quickly script customization. #
#==============================================================================#
#==============================================================================#
# [** $RafiScripts.instr ] // Instructions: #
#------------------------------------------------------------------------------#
# 1° Paste above Main #
# 2° After,edit the Constants at Rafidelis::Bestiary_System module if you want #
# 3° -> For add a monster in bestiary,without battle necessity. #
# At 'Call Script' command,type: #
# $data_beestiary.add(monster id) #
# Nota: If the monster id,to be included in Excluded_Monsters Constant,in the #
# Rafidelis::Bestiary_System module,the monster don't be added. #
# 4°-> For remove a determinate bestiary monster,At 'Call Script' use: #
# $data_bestiary.remove(monster id) #
# 5°-> For add all monsters in the bestiary,at 'Call Script' type : #
# $data_bestiary.all_monsters_discovered! #
# Nota: The monsters with id's included in Excluded_Monsters Constant,in the #
# Rafidelis::Bestiary_System modulo,don't be added. #
# 6° -> For reset,and remove all bestiary monsters,in 'Call Script' type: #
# $data_bestiary.reset #
#------------------------------------------------------------------------------#
# [** Creation of a determinate monster description **] #
#------------------------------------------------------------------------------#
# 1° With RPGMakerVX opened,press the key F9 or open the Database by the icon #
# at RPGMakerVX Toolbar,then select the Enemie Tab #
# 2° At the 'Historic',write the monster description of followings modes: #
# Note: if you yet use any script that use the 'Historic' command,and you want #
# another mode of monster description creation,please contact me. #
# #
# (1°) - "This is the monster description,with only 1 line." #
# #
# With this mode,the monster description occupy only one line,this a #
# pratic and simple mode of add description. #
#------------------------------------------------------------------------------#
# (2°) - d = [] # Never forgot of add this line #
# d[0] = "This is the first line of the monster description" #
# d[1] = "This is the line two of the monster description" #
# d # Also,never forgot of add this line #
# #
# With this mode,the monster description can have until 2 lines,see that first #
# and last line always be write. The # are ignored,it's used only for comment. #
#==============================================================================#
#==============================================================================#
# ::. Model for 2 lines description .:: #
#------------------------------------------------------------------------------#
# d = [] #
# d[1] = "Description Line 1" #
# d[2] = "Description Line 2" #
# d #
#==============================================================================#
#==============================================================================#
# [** $RafiScripts.conf_start ] \\ Inicio das Configurações #
#------------------------------------------------------------------------------#
#==============================================================================#
# [** Module Rafidelis ] #
#[**Modulo necessario para rodar os Scripts criados por Rafidelis(RafiScripts)]#
#==============================================================================#
module Rafidelis
#==============================================================================#
# Rafidelis.add_script - Name : Name of Script - Version : Version of Script #
#------------------------------------------------------------------------------#
def self.add_script(name,version)
$RafiScripts = [] if $RafiScripts.nil?
$RafiScripts.push("Name : #{name} - Version: #{version}")
end
#==============================================================================#
# Rafidelis.script_exist? - Name : Name of Script - Version : Version of Script#
#------------------------------------------------------------------------------#
def self.script_exist?(name,version)
$RafiScripts = [] if $RafiScripts.nil?
return $RafiScripts.include?("Name : #{name} - Version: #{version}")
end
#==============================================================================#
# Rafidelis.scripts - Return all script create by Rafidelis(RafiScripts) #
#------------------------------------------------------------------------------#
def self.scripts
print $RafiScripts
end
#==============================================================================#
# Rafidelis.create_txt - Create a .txt with all Rafidelis(RafiScripts) scripts #
#------------------------------------------------------------------------------#
def self.create_txt(filename="RafideliScripts")
file = File.open("#{filename}.txt","wb")
for i in 0...$RafiScripts.size
file.write("#{$RafiScripts[i]}\r\n")
end
end
#==========================================================================
====#
# Rafidelis Bestiary System Options #
#------------------------------------------------------------------------------#
module Bestiary_System
# Adding the script at the system.Don't Modify
name = "Monster Album (Bestiary System)"
version = "1.0"
Rafidelis.add_script(name,version)
# Script added at the System.
# Monsters that don't added in the Bestiary
Excluded_Monsters = []
# Text displayed in the Monster Status Window
# Only translate for your language,don't add or remove any text
Enemies_Captions = [
"Name:",
"HP:",
"MP:",
"Atk:",
"Def:",
"Spi:",
"Agi:",
"Hit:",
"Eva:",
"Exp:",
"Treasure:",
"Drop Item 1:",
"Drop Item 2:",
"Description:"]
# Font Properties of Enemies Texts
# Enemies_Captions_Font_Properties = [Font Color,Bold,Italic]
Enemies_Captions_Font_Properties = [2,true,false]
# Font Properties of Enemies Data Texts,like monster description,monster hp,etc.
# Enemies_Datas_Font_Properties = [Font Color,Bold,Italic]
Enemies_Datas_Font_Properties = [0,true,false]
# Info_Captions = ['Text',Icon ID]
# 'Text' => Displayed Text.
# ID do Icone => Icon displayed be the side of the Info Window Text
# Only translate for your language,don't add or remove any text
Info_Captions = [
["Completed:",62],
["Total Bestiary Monsters:",149],
["Total Discovered Monsters:",63],
["Total Defeated Monsters:",131],
["Total Player Escapes:",49],
["Total Player Defeates:",157]]
# Font Properties of Bestiary Informations Texts
# Info_Captions_Font_Properties = [Font Color,Bold,Italic]
Info_Captions_Font_Properties = [2,true,false]
# Font Properties of Bestiary Informations datas
# Info_Captions_Data_Font_Propierties = [Font Color,Bold,Italic]
Info_Captions_Data_Font_Properties = [0,true,false]
# Bestiary Title
Bestiary_Caption = "Bestiary"
# Switch that control the exibition of Bestiario option,in menu
Menu_Switch_ID = 1
# Icons ID of Icon Window Command
Command_Window_Icons = [133,150,112]
# Text displayed in the data window
Bestiary_Info = "Datas"
# Text displayed at the monster command window,when the enemie yet don't
# discovered,so,don't have data about the monster.
Unknow_Monster = " ?? NO DATA ?? "
# Use Background Image at the monster status window?
Use_BackGround_Graphic = true
# Background Graphics,declare of following mode:
# Monster_Background[Enemie ID] = "Image Name"
# The images must be in the 'Graphics/Bestiary' Folder
Monster_Background = [] # Don't Modify,or Delete this line.
Monster_Background[1] = "Forest"
Monster_Background[2] = "Mine"
Monster_Background[3] = "Mountain"
Monster_Background[5] = "Mine"
Monster_Background[7] = "Mountain"
Monster_Background[8] = "Mine"
Monster_Background[9] = "Beach"
Monster_Background[10]= "Forest"
Monster_Background[11] = "Mine"
Monster_Background[12] = "Cave"
Monster_Background[13] = "Mountain"
Monster_Background[14] = "Mountain"
Monster_Background[15] = "Beach"
Monster_Background[17] = "Cave"
Monster_Background[21] = "Mine"
Monster_Background[22] = "Beach"
Monster_Background[25] = "Beach"
Monster_Background[26] = "Mine"
Monster_Background[27] = "Cave"
Monster_Background[28] = "Cave"
Monster_Background[29] = "Forest"
Monster_Background[30] = "Cave"
# Name of the image displayed,when the monster haven't an image defined
# at Constant Monster_Background
Default_Monster_BackGround = "GrassLand"
# Text displayed,when the monster haven't description
No_Description = "-- Without Description for this Monster --"
# Text displayed when the monster haven't drop item
No_Drop_Item = "-- None Droped Item -- "
# Background Image extension ( Only JPG and PNG)
Graphics_Extension = '.jpg'
# Font name used at Bestiary Command Window
Monsters_Names_Command_Window_Font_Name = "Copperplate Gothic Light"
# Font name used at Bestiary Window Texts,for use the default use Font.default_name
Bestiary_Font_Name = Font.default_name
# Edit below,only if the option 'Use_BackGround_Image' is false
# Interior Square Color - Color.new(red,green,blue,opacity)
Square_Color = Color.new(0,0,0,100)
# Square Border Color - Color.new(red,green,blue,opacity)
Square_Border_Color = Color.new(0,0,0)
end
end
#==============================================================================#
# [** $RafiScripts.conf_end ] \\ End of configuration #
#==============================================================================#
# Verifiyng if the script's include at the system #
#==============================================================================#
name = "Monster Album (Bestiary System)"
version = "1.0"
if Rafidelis.script_exist?(name,version)
#==============================================================================#
# [** Game_Bestiary **] #
#------------------------------------------------------------------------------#
# This class handles game bestiary data,like monster hp,hp,name etc. #
# The instance of this class is referenced by $data_bestiary. #
#==============================================================================#
class Game_Bestiary
include Rafidelis::Bestiary_System
attr_accessor :monsters_discovered
attr_accessor :monsters_encountered
attr_accessor :monsters_defeated
attr_accessor :player_escaped
attr_accessor :player_defeated
#==========================================================================
==#
# * Object Initialization #
#----------------------------------------------------------------------------#
def initialize
file = "Data/Enemies.rvdata"
@monsters_encountered = []
@monsters_defeated = []
@monsters_discovered = []
@player_escaped = 0
@player_defeated = 0
@monsters = []
# Loading the file,if isn't yet loaded
$data_enemies = load_data(file) if $data_enemies.nil?
enemies = $data_enemies
for i in 1..enemies.size - 1
@monsters[i] = enemies[i] if not Excluded_Monsters.include?(i)
@monsters_encountered[i] = 0
@monsters_defeated[i] = 0
@monsters_discovered[i] = false
end
@monsters.compact!
@monsters_encountered.compact!
@monsters_defeated.compact!
@monsters_discovered.compact!
end
#==========================================================================
==#
# (*) Add Monster :: monster_id = Database monster id - 1 #
#----------------------------------------------------------------------------#
def add(monster_id)
@monsters_discovered[monster_id] = true if not Excluded_Monsters.include?(monster_id)
end
#==========================================================================
==#
# (*) Remove Monster :: monster_id = Database monster id - 1 #
#----------------------------------------------------------------------------#
def remove(monster_id)
@monsters_discovered[monster_id] = false
end
#==========================================================================
==#
# (*) Add all monsters in the Bestiary #
#----------------------------------------------------------------------------#
def all_monsters_discovered!
for i in 0...@monsters_discovered.size
@monsters_discovered[i] = true
end
end
#==========================================================================
==#
# (*) Reset and Remove all monsters of the Bestiary #
#----------------------------------------------------------------------------#
def reset
for i in 0...@monsters_discovered.size
@monsters_discovered[i] = false
end
end
#==========================================================================
==#
# (*) Get the total quantity of bestiary monsters #
#----------------------------------------------------------------------------#
def size
return @monsters.size
end
#==========================================================================
==#
# (*) Get the total quantity of discovered bestiary monsters #
#----------------------------------------------------------------------------#
def total_discovered
result = 0
for i in 0...@monsters_discovered.size
if @monsters_discovered[i]
result += 1
end
end
return result
end
#==========================================================================
==#
# (*) Get the total quantity of encountered bestiary monsters #
#----------------------------------------------------------------------------#
def total_encountered
result = 0
for i in 1...@monsters_encountered.size
result += @monsters_encountered[i]
end
return result
end
#==========================================================================
==#
# (*) Get the total quantity of defeated monster #
#----------------------------------------------------------------------------#
def total_defeated
result = 0
for i in 0...@monsters_defeated.size
result += @monsters_defeated[i]
end
return result
end
#==========================================================================
==#
# (*) Get a monster information. #
#----------------------------------------------------------------------------#
def monsters
return @monsters
end
end
#==============================================================================#
# ** Scene_Title #
#------------------------------------------------------------------------------#
# This class performs the title screen processing. #
#==============================================================================#
class Scene_Title
alias rafidelis_bestiary_create_game_objects create_game_objects
#==========================================================================
==#
# (*) Create Game Objects : Added $data_bestiary #
#==========================================================================
==#
def create_game_objects
rafidelis_bestiary_create_game_objects
$data_bestiary = Game_Bestiary.new
end
end
#==============================================================================#
# ** Scene_File #
#------------------------------------------------------------------------------#
# This class performs the save and load screen processing. #
#==============================================================================#
class Scene_File < Scene_Base
#----------------------------------------------------------------------------#
# Alias #
#----------------------------------------------------------------------------#
alias rafidelis_bestiary_write_save_data write_save_data
alias rafidelis_bestiary_read_save_data read_save_data
#==========================================================================
==#
# * Write Save Data #
# file : write file object (opened) #
#----------------------------------------------------------------------------#
def write_save_data(file)
rafidelis_bestiary_write_save_data(file)
Marshal.dump($data_bestiary,file)
end
#==========================================================================
==#
# * Read Save Data #
# file : file object for reading (opened) #
#----------------------------------------------------------------------------#
def read_save_data(file)
rafidelis_bestiary_read_save_data(file)
$data_bestiary = Marshal.load(file)
end
end
#==============================================================================#
# [** Window_Bestiary Status **] #
#------------------------------------------------------------------------------#
# (*) This window display the monsters datas in Bestiary Scene. #
#==============================================================================#
class Window_Bestiary_Status < Window_Base
include Rafidelis::Bestiary_System
attr_accessor :monster_id
#==========================================================================
==#
# * Object Initialization #
#----------------------------------------------------------------------------#
def initialize(x,y)
super(x,y,364,416)
@monster_id = 0
@desc = []
if Font.exist?(Bestiary_Font_Name)
self.contents.font.name = Bestiary_Font_Name
else
self.contents.font.name = Font.default_name
end
update
end
#==========================================================================
==#
# (*) Set texts displayed in the window #
#----------------------------------------------------------------------------#
def set_texts
@texts = []
monster = $data_bestiary.monsters[@monster_id]
info_captions = Enemies_Captions
data_captions = [
"#{monster.name}",
"#{monster.maxhp}",
"#{monster.maxmp}",
"#{monster.atk}",
"#{monster.def}",
"#{monster.spi}",
"#{monster.agi}",
"#{monster.hit}",
"#{monster.eva}",
"#{monster.exp}",
"#{monster.gold} #{Vocab::gold}"]
@desc = eval(monster.note)
for i in 0...info_captions.size - 1
@texts.push([info_captions[i],data_captions[i]])
end
@di1 = monster.drop_item1 # Drop Item 1
@di2 = monster.drop_item2 # Drop Item 2
end
#==========================================================================
==#
# (*) Draw the Droped Items icons by the Enemies #
#----------------------------------------------------------------------------#
def draw_drop_items(x,y,item)
if item.kind == 0
self.contents.draw_text(x,y,self.width,32,No_Drop_Item)
return
else
case item.kind
when 1
drop_item = $data_items[item.item_id]
when 2
drop_item = $data_weapons[item.weapon_id]
when 3
drop_item = $data_armors[item.armor_id]
end
draw_item_name(drop_item, x, y)
end
end
#==========================================================================
==#
# (*) Update #
#----------------------------------------------------------------------------#
def refresh
self.contents.clear
set_texts
draw_battler
draw_texts
end
#==========================================================================
==#
# (*) Add Text #
#----------------------------------------------------------------------------#
def add_text(x,y,text,align,color,font_size,bold=false,italic=false)
self.contents.font.size = font_size
self.contents.font.color = text_color(color)
self.contents.font.bold = bold
self.contents.font.italic = italic
self.contents.draw_text(x,y,self.width,32,text,align)
end
#==========================================================================
==#
# (*) Show the selected monster description #
#----------------------------------------------------------------------------#
def draw_description(x=0,wlh=24)
y = @texts.size * wlh
desc_caption = Enemies_Captions[Enemies_Captions.size-1]
tw = contents.text_size(desc_caption).width
fp2 = Enemies_Captions_Font_Properties
fp = Enemies_Datas_Font_Properties
add_text(x,y,desc_caption,0,fp2[0],13,fp2[1],fp2[2])
if @desc.is_a?(Array)
for i in 0...@desc.size
next if @desc[i].nil?
if i != 0 # Se não for a primeira Linha
x = 5
else
x = contents.text_size(desc_caption).width + 5
end
add_text(x,y + i * wlh,@desc[i],0,fp[0],13,fp[1],fp[2])
end
end
if @desc.is_a?(String)
add_text(x, y + wlh,@desc,0,fp[0],13,fp[1],fp[2])
elsif @desc.nil? # Não possui descrição
add_text(x,y+wlh,No_Description,0,fp[0],13,fp[1],fp[2])
end
end
#==========================================================================
==#
# (*) Draw the selected monster background image #
#----------------------------------------------------------------------------#
def draw_background
path = "Graphics/Bestiary/" # Pasta com as imagens de Fundo
if Monster_Background[@monster_id+1] != nil
filename = Monster_Background[@monster_id+1]
if File.exist?(path + filename + Graphics_Extension)
bitmap = Cache.bestiary(filename)
self.contents.blt(0,0,bitmap,bitmap.rect)
bitmap.dispose
end
# Se for Nula,é exibido o fundo padrão
else
filename = Default_Monster_BackGround
bitmap = Cache.bestiary(filename)
self.contents.blt(0,0,bitmap,bitmap.rect)
bitmap.dispose
end
end
#==========================================================================
==#
# (*) Draw the Picture of the selected monster battler #
#----------------------------------------------------------------------------#
def draw_square
monster = $data_bestiary.monsters[@monster_id]
bitmap = Cache.battler(monster.battler_name,monster.battler_hue)
pos = calcule_bitmap_coordinates(bitmap)
x = pos[0]; y = pos[1]
bw = bitmap.width
bh = bitmap.height
self.contents.fill_rect(x - 2, y - 2, bw + 4, bh + 4, Square_Border_Color)
self.contents.fill_rect(x , y , bw , bh , Square_Color)
end
#==========================================================================
==#
# (*) Draw the selected monster battler graphic #
#----------------------------------------------------------------------------#
def draw_battler
if Use_BackGround_Graphic
draw_background
else
draw_square
end
monster = $data_bestiary.monsters[@monster_id]
bitmap = Cache.battler(monster.battler_name,monster.battler_hue)
pos = calcule_bitmap_coordinates(bitmap)
x = pos[0]; y = pos[1]
self.contents.blt(x,y,bitmap,bitmap.rect)
bitmap.dispose
end
#==========================================================================
==#
# (*) Calcule the coordinates x and y of the monster battler image. #
#----------------------------------------------------------------------------#
def calcule_bitmap_coordinates(bitmap)
if bitmap.width >= 300
x = (self.width - bitmap.width)/2.5
else
x = (self.width - bitmap.width)/2 + 20
end
if bitmap.height >= 210
y = self.y + 10
elsif bitmap.height >= 140
y = self.y + 70
elsif bitmap.height >= 95
y = self.y + 100
else
y = self.y + 220
end
return [x,y]
end
#==========================================================================
==#
# (*) Draw the enemie data texts in the window #
#----------------------------------------------------------------------------#
def draw_texts
x = 5
wlh = 25
draw_description(x,wlh)
fp = Enemies_Captions_Font_Properties
fp2 = Enemies_Datas_Font_Properties
monster = $data_bestiary.monsters[@monster_id]
for i in 0...@texts.size
tw = contents.text_size(@texts[i][0]).width
add_text(x , i * wlh , @texts[i][0] , 0 ,fp[0], 13,fp[1],fp[2])
color = Info_Captions_Font_Properties
add_text(x + (tw + 8) , i * wlh , @texts[i][1] , 0 ,fp2[0] , 13,fp2[1],fp2[2])
if i == Enemies_Captions.size - 2
draw_drop_items( tw + 10, i * wlh, @di2)
elsif i == Enemies_Captions.size - 3
draw_drop_items( tw + 10, i * wlh, @di1)
end
end
end
#==========================================================================
==#
# (*) Update #
#----------------------------------------------------------------------------#
def update
# Show all monster content if yet be discovered
if $data_bestiary.monsters_discovered[@monster_id]
refresh
end
end
end
#==============================================================================#
# [** Window_Bestiary_Info **] #
#------------------------------------------------------------------------------#
# (*) This window display the bestiary data #
#==============================================================================#
class Window_Bestiary_Info < Window_Base
include Rafidelis::Bestiary_System
attr_accessor :monster_id
#----------------------------------------------------------------------------#
# Object Initialization #
#----------------------------------------------------------------------------#
def initialize(x,y)
super(x,y,364,416)
if Font.exist?(Bestiary_Font_Name)
self.contents.font.name = Bestiary_Font_Name
else
self.contents.font.name = Font.default_name
end
@monster_id = 0
bestiary = $data_bestiary
data_monster = bestiary.monsters
percent = (bestiary.total_discovered * 100) /bestiary.size
data = []
@icons = []
for i in 0...Info_Captions.size
data[i] = Info_Captions[i][0]
@icons[i] = Info_Captions[i][1]
end
data2 = []
data2[0] = "#{percent} % - #{bestiary.total_discovered}/#{bestiary.size}"
data2[1] = "#{bestiary.size}"
data2[2] = "#{bestiary.total_discovered}"
data2[3] = "#{bestiary.total_defeated}"
data2[4] = "#{bestiary.player_escaped}"
data2[5] = "#{bestiary.player_defeated}"
@data = [data,data2]
update
end
#==========================================================================
==#
# (*) Draw the window lines #
#----------------------------------------------------------------------------#
def draw_lines
y = @data[0].size * 26 + 32
draw_line(0,-15)
draw_line(0,40)
end
#==========================================================================
==#
# (*) Draw the window texts #
#----------------------------------------------------------------------------#
def draw_texts
fp = Info_Captions_Font_Properties
fp2 = Info_Captions_Data_Font_Properties
x = 20
title = "#{Bestiary_Caption} - #{Bestiary_Info}"
add_stroked_text(-10,20,title,1,15,2,32,true)
for i in 0...@data[0].size
y = 70 + 48 + i * 26
draw_icon(@icons[i],0,y+3)
tw = contents.text_size(@data[0][i]).width
add_text(x + 10,y,@data[0][i],0,fp[0],18,fp[1],fp[2])
add_text(i != 0 ? x+tw+14 : tw- x,y,@data[1][i],0,fp2[0],18,fp2[1],fp2[2])
end
end
#==========================================================================
==#
# (*) Update #
#----------------------------------------------------------------------------#
def update
refresh
end
#==========================================================================
==#
# (*) Refresh #
#----------------------------------------------------------------------------#
def refresh
self.contents.clear
draw_texts
draw_lines
end
#==========================================================================
==#
# (*) Draw text with borders #
#----------------------------------------------------------------------------#
def add_stroked_text(x,y,text,align=0,c1=0,c2=0,fs=16,bold=false,italic=false)
add_text(x,y,text,align,c1,fs,bold,italic)
add_text(x,y-2,text,align,c2,fs,bold,italic)
end
#==========================================================================
==#
# (*) Add Text #
#----------------------------------------------------------------------------#
def add_text(x,y,text,align,color,font_size,bold=false,italic=false)
self.contents.font.size = font_size
self.contents.font.color = text_color(color)
self.contents.font.bold = bold
self.contents.font.italic = italic
self.contents.draw_text(x,y,self.width,32,text,align)
end
#==========================================================================
==#
# (*) Draw Line #
#----------------------------------------------------------------------------#
def draw_line(x,y,c=0,s=16)
simbol = "_" * 42
add_text(x,y,simbol,0,c,s)
add_text(x,y + 4,simbol,0,c,s)
end
end
#==============================================================================#
# [** Command Window_Icon **] #
#------------------------------------------------------------------------------#
# By : Rafidelis - Date: 31/08/09 #
#------------------------------------------------------------------------------#
# This window create an Icon Command Window #
#==============================================================================#
class Command_Window_Icon < Window_Base
attr_accessor :index # Actual Window Index
attr_reader :icons
def initialize(icons,x,y,w=icons.size * 48 + 32 ,spacing=48)
#==========================================================================
==#
# * Object Initialization #
#----------------------------------------------------------------------------#
super(x,y,w,WLH+32)
@icons = icons
@max = @icons.size-1
@index = 0
@spacing = spacing
refresh
update
update_icon
update_cursor_rect
end
#==========================================================================
==#
# (*) Update #
#----------------------------------------------------------------------------#
def update
update_input_process
end
#==========================================================================
==#
# (*) Refresh #
#----------------------------------------------------------------------------#
def refresh
self.contents.clear
end
#==========================================================================
==#
# (*) Update of the keyboard entries #
#----------------------------------------------------------------------------#
def update_input_process
if Input.trigger?(Input::RIGHT)
if @index == @max # Se for o ultimo icone
@index = 0 # volta para o primeiro
else
@index += 1 if @index < @max # Se não for,adiciona mais 1
end
main_update
elsif Input.trigger?(Input::LEFT)
if @index == 0 # Se for o primeiro
@index = @max # Vai para o ultimo
else
@index -= 1 if @index > 0 # Se não,remove 1
end
main_update
end
end
#==========================================================================
==#
# (*) Main Update #
#----------------------------------------------------------------------------#
def main_update
refresh
update_icon
update_cursor_rect
Sound.play_cursor
end
#==========================================================================
==#
# (*) Update Draw Icon #
#----------------------------------------------------------------------------#
def update_icon
for i in 0...@icons.size
draw_icon(@icons[i],i*@spacing+12,0,false)
end
draw_icon(@icons[@index],@index*@spacing+12,0,true)
update_cursor_rect
end
#==========================================================================
==#
# (*) Update Cursor of the Window #
#----------------------------------------------------------------------------#
def update_cursor_rect
self.cursor_rect.empty
self.cursor_rect = Rect.new(@index*@spacing-2+12,-5,32,32)
end
end
#==============================================================================#
# ** Game_Enemy #
#------------------------------------------------------------------------------#
# This class handles enemy characters. It's used within the Game_Troop class #
# ($game_troop). #
#==============================================================================#
class Game_Enemy < Game_Battler
#==========================================================================
==#
# Alias #
#----------------------------------------------------------------------------#
alias rafidelis_bestiary_initialize initialize
alias rafidelis_bestiary_perform_collapse perform_collapse
#==========================================================================
==#
# * Object Initialization #
#----------------------------------------------------------------------------#
def initialize(index, enemy_id)
rafidelis_bestiary_initialize(index, enemy_id)
enemy_id = enemy_id - 1
$data_bestiary.monsters_discovered[enemy_id] = true
$data_bestiary.monsters_encountered[enemy_id] += 1
end
#==========================================================================
==#
# * Perform Collapse #
#----------------------------------------------------------------------------#
def perform_collapse
rafidelis_bestiary_perform_collapse
if $game_temp.in_battle and dead?
$data_bestiary.monsters_defeated[enemy.id-1] += 1
end
end
end
#==============================================================================#
# Scene_Battle #
#------------------------------------------------------------------------------#
# Classe de operações na tela de batalha. #
#==============================================================================#
class Scene_Battle < Scene_Base
#==========================================================================
==#
# Processo de fuga
#----------------------------------------------------------------------------#
def process_escape
@info_viewport.visible = false
@message_window.visible = true
text = sprintf(Vocab::EscapeStart, $game_party.name)
$game_message.texts.push(text)
if $game_troop.preemptive
success = true
else
success = (rand(100) < @escape_ratio)
end
Sound.play_escape
if success
$data_bestiary.player_escaped += 1
wait_for_message
battle_end(1)
else
@escape_ratio += 10
$game_message.texts.push('\.' + Vocab::EscapeFailure)
wait_for_message
$game_party.clear_actions
start_main
end
end
end
#==============================================================================#
# ** Game_Actor #
#------------------------------------------------------------------------------#
# This class handles actors. It's used within the Game_Actors class #
# ($game_actors) and referenced by the Game_Party class ($game_party). #
#==============================================================================#
class Game_Actor < Game_Battler
alias rafidelis_bestiary_perform_collapse perform_collapse
#==========================================================================
==#
# Perform Collapse #
#----------------------------------------------------------------------------#
def perform_collapse
rafidelis_bestiary_perform_collapse
$data_bestiary.player_defeated += 1
end
end
#==============================================================================#
# ** Cache #
#------------------------------------------------------------------------------#
# This module loads each of graphics, creates a Bitmap object, and retains it.#
# To speed up load times and conserve memory, this module holds the created #
# Bitmap object in the internal hash, allowing the program to return #
# preexisting objects when the same bitmap is requested again. #
#==============================================================================#
module Cache
#==========================================================================
==#
# * Get Bestiary background Graphic #
# filename : Filename #
#----------------------------------------------------------------------------#
def self.bestiary(filename)
load_bitmap("Graphics/Bestiary/",filename)
end
end
#==============================================================================#
# [** Scene_Bestiary **] #
#------------------------------------------------------------------------------#
# (*) This class performs the Bestiary exibition process #
#==============================================================================#
class Scene_Bestiary < Scene_Base
include Rafidelis::Bestiary_System
#==========================================================================
==#
# * Object Initialization #
#----------------------------------------------------------------------------#
def initialize(from_menu=false)
@from_menu = from_menu
load_bestiary_database
create_windows
end
#==========================================================================
==#
# (*) Loading the Bestiary DataBase #
#----------------------------------------------------------------------------#
def load_bestiary_database
$data_enemies = load_data("Data/Enemies.rvdata") if $data_enemies.nil?
$data_system = load_data("Data/System.rvdata") if $data_system.nil?
end
#==========================================================================
==#
# (*) Criation of Scene Windows #
#----------------------------------------------------------------------------#
def create_windows
# Icon Command Window
icons = Command_Window_Icons
@icon_command_window = Command_Window_Icon.new(icons,0,0,180)
set_command_window_mode(@icon_command_window,true)
# Monsters Selection Window
commands = create_commands
@monster_command_window = Window_Command.new(180,commands)
@monster_command_window.height = Graphics.height - @icon_command_window.height
@monster_command_window.y = @icon_command_window.height
@monster_command_window.contents.font.size = 14
fontname = Monsters_Names_Command_Window_Font_Name
if Font.exist?(fontname)
@monster_command_window.contents.font.name = fontname
else
@monster_command_window.contents.font.name = Font.default_name
end
@monster_command_window.refresh # Para mudar o tamanho da fonte
set_command_window_mode(@monster_command_window,false)
# Monsters Status Window
@status_window = Window_Bestiary_Status.new(@monster_command_window.width,0)
monster_id = @status_window.monster_id
@status_window.active = false
# Bestiary Data and Information Window
@window_info = Window_Bestiary_Info.new(@status_window.x,0)
end
#==========================================================================
==#
# (*) Criation of Monsters Command Window Commands #
#----------------------------------------------------------------------------#
def create_commands
commands = []
for i in 0..$data_bestiary.size-1
# If the monster yet be discovered
if $data_bestiary.monsters_discovered[i]
# Is added the monster id and your name in command window
commands[i] = "#{i+1} : #{$data_bestiary.monsters[i].name}"
else
# Else,is added the text Unknow Monster
commands[i] = Unknow_Monster
end
end
return commands # Command Return
end
#==========================================================================
==#
# (*) Frame Update #
#----------------------------------------------------------------------------#
def update
if @icon_command_window.active
update_icon_command_window
elsif @monster_command_window
update_monsters_command_window
end
end
#==========================================================================
==#
# (*) Set Window Mode ( Active and Visible : (true or false) #
#----------------------------------------------------------------------------#
def set_window_mode(window,bool)
window.active = bool
window.visible = bool
end
#==========================================================================
==#
# (*) Set Command Window Mode (Active : (true or false) #
#----------------------------------------------------------------------------#
def set_command_window_mode(command_window,bool)
command_window.active = bool
end
#==========================================================================
==#
# (*) Icon Command Window Update #
#----------------------------------------------------------------------------#
def update_icon_command_window
@icon_command_window.update
if Input.trigger?(Input::C)
case @icon_command_window.index
when 0
command_status_window
when 1
command_info_window
when 2
if @from_menu
$scene = Scene_Menu.new(5)
else
$scene = Scene_Map.new
end
end
Sound.play_decision
elsif Input.trigger?(Input::B)
if @from_menu
$scene = Scene_Menu.new(5)
else
$scene = Scene_Map.new
end
Sound.play_cancel
end
end
#==========================================================================
==#
# (*) Window Status activation and Exibition #
#----------------------------------------------------------------------------#
def command_status_window
set_window_mode(@window_info,false)
set_window_mode(@status_window,true)
set_window_mode(@status_window,true)
set_command_window_mode(@icon_command_window,false)
set_command_window_mode(@monster_command_window,true)
end
#==========================================================================
==#
# (*) Window Info Activation and Exibition #
#----------------------------------------------------------------------------#
def command_info_window
set_window_mode(@window_info,true)
@window_info.update
set_window_mode(@status_window,false)
set_command_window_mode(@monster_command_window,true)
set_command_window_mode(@icon_command_window,false)
end
#==========================================================================
==#
# (*) Monster Command Window Update #
#----------------------------------------------------------------------------#
def update_monsters_command_window
window = @monster_command_window
window.update
if Input.trigger?(Input::B) # Cancelar
Sound.play_cancel
set_command_window_mode(window,false)
set_command_window_mode(@icon_command_window,true)
elsif Input.trigger?(Input::C) and @status_window.active
Sound.play_decision
@status_window.monster_id = window.index
@status_window.update
end
end
#==========================================================================
==#
# (*) End of Process #
#----------------------------------------------------------------------------#
def terminate
@window_info.dispose
@icon_command_window.dispose
@status_window.dispose
@monster_command_window.dispose
end
end
#==============================================================================#
# ** Scene_Menu #
#------------------------------------------------------------------------------#
# This class performs the menu screen processing. #
#==============================================================================#
class Scene_Menu < Scene_Base
include Rafidelis::Bestiary_System
#==========================================================================
==#
# (*) Command Window Creation #
#----------------------------------------------------------------------------#
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
if $game_switches[Menu_Switch_ID]
s6 = Bestiary_Caption
s7 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7])
else
s6 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
end
@command_window.index = @menu_index
if $game_party.members.size == 0 # Se não houver membros na equipe
@command_window.draw_item(0, false) # Desabilita "Items"
@command_window.draw_item(1, false) # Desabilita "Habilidades"
@command_window.draw_item(2, false) # Desabilita "Equipamentos"
@command_window.draw_item(3, false) # Desabilita "Status"
end
if $game_system.save_disabled # Se salvar for proibido
@command_window.draw_item(4, false) # Desabilita "Salvar"
end
end
#==========================================================================
==#
# (*) Update Command Selection #
#----------------------------------------------------------------------------#
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
if $game_switches[Menu_Switch_ID]
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2,3 # Habilidades, equipamento, status
start_actor_selection
when 4 # Salvar
$scene = Scene_File.new(true, false, false)
when 5 # Fim de jogo
$scene = Scene_Bestiary.new(true)
when 6
$scene = Scene_End.new
end
else
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2,3 # Habilidades, equipamento, status
start_actor_selection
when 4 # Salvar
$scene = Scene_File.new(true, false, false)
when 5
$scene = Scene_End.new
end
end
end
end
end
#==============================================================================#
# ** Scene_End #
#------------------------------------------------------------------------------#
# This class performs game end screen processing. #
#==============================================================================#
class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
if $game_switches[Rafidelis::Bestiary_System::Menu_Switch_ID]
$scene = Scene_Menu.new(6)
else
$scene = Scene_Menu.new(5)
end
end
end
# Script verification end
end
#==============================================================================#
# [** $RafiScripts.script_end] // Fim do Script - Script End #
#------------------------------------------------------------------------------#
# Você pode encontrar mais scripts meus em www.ReinoRPG.com #
# You can find more scricreate for me at www.ReinoRPG.com #
#==============================================================================#
[/spoiler]
Sorry about the malware found in the archives, I have not an antivirus on my computer