In the standard Battle System, when a battle end or when Escape there is a standard fade out transition. Is it possible to show the same transition specified in System -> Battle transition graphic ?
Thanks
Thanks
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#=============================================================================
# * SFonts
#=============================================================================
# Trickster
# Version 1.0
# 12.19.07
#=============================================================================
# Introduction
# - This script adds SFont support for rmxp. An sfont is a image file with
# characters already drawn onto it. The top row of pixels in this image shows
# where the characters are and where the breaks are.
# Setting up images
# - The top left hand pixel (0, 0) is the skip color and tells if a column
# of pixels is empty or contain data
# - Images should be placed in Graphics/SFonts
# - For more reference see the example image Arial_Text
# To Use
# - You can use this script in one of two ways
# - 1) Set <Bitmap>.sfont to an SFont object then call <Bitmap>.draw_text
# - 2) Call <SFont>.render(<String>) and then blt it to a Bitmap object
# Documentation
# - SFont.new(<String/Bitmap>, <Array>, <Integer/String>)
# - Where the first parameter is a filename (in Graphics/SFonts) or a Bitmap
# object containing the Font data
# - the second parameter is an Array of all of the characters in order in the
# file the default is specified in @@glyphs below you
# - the last parameter is either the width that should be used for the space
# character or the character whose width you want to use for the space
# character the default is " which is the width of the " character if "
# character is not in the glyph then the height of the bitmap will be used
# Credits
# - John Croisant for the original code for Rubygame which I used as a base for
# this script
# - Adam Bedore for the example sfont image more of his sfont work is given
# here - http://www.zlurp.com/irq/download.html
# Websites
# - Official SFont Page with sample fonts - http://www.linux-games.com/sfont
# - SFont generator utility - http://www.nostatic.org/sfont
# - SFont generator script for GIMP by Roger Feese
# http://www.nostatic.org/sfont/render-sfont22.scm
#=============================================================================
module RPG
module Cache
#--------------------------------------------------------------------------
# * SFont Load
#--------------------------------------------------------------------------
def self.sfont(file)
self.load_bitmap("Graphics/SFonts/", file)
end
end
end
class SFont
#--------------------------------------------------------------------------
# * Class Variables
#--------------------------------------------------------------------------
@@glyphs = [
"!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0",
"1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@",
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P",
"Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`",
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
"q","r","s","t","u","v","w","x","y","z","{","|","}","~","∞",
]
#--------------------------------------------------------------------------
# * Get Glyphs
#--------------------------------------------------------------------------
def SFont.glyphs
return @@glyphs
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(file, glyphs = @@glyphs, space = '"')
if file.is_a?(String)
bitmap = RPG::Cache.sfont(file)
elsif file.is_a?(Bitmap)
bitmap = file
else
raise(ArgumentError, "File Must be a String or Bitmap")
end
@height = bitmap.height
@skip = bitmap.get_pixel(0, 0)
@glyphs = {}
x = 2
glyphs.each {|char| x = load_glyph(bitmap, char, x)}
unless glyphs.include?(' ')
if space.is_a?(Numeric)
space = space.to_i
elsif space.is_a?(String)
if glyphs.include?(space)
space = @glyphs[space].width
elsif !@glyphs['"'].nil?
space = @glyphs['"'].width
else
space = bitmap.height
end
else
raise(ArgumentError, "Space must be either a String or Numeric")
end
@glyphs[" "] = Bitmap.new(space, @height)
end
@glyphs.default = @glyphs[" "]
end
#--------------------------------------------------------------------------
# * Text Size
#--------------------------------------------------------------------------
def text_size(text)
width = 0
text.each_byte {|byte| width += @glyphs["%c" % byte].width}
return width
end
#--------------------------------------------------------------------------
# * Render
#--------------------------------------------------------------------------
def render(text)
width = text_size(text)
bitmap = Bitmap.new(width, @height)
x = 0
text.each_byte do |byte|
glyph = @glyphs["%c" % byte]
bitmap.blt(x, 0, glyph, glyph.rect)
x += glyph.width
end
return bitmap
end
#--------------------------------------------------------------------------
# * Private: Load glyph
#--------------------------------------------------------------------------
private
def load_glyph(bitmap, char, xi)
while bitmap.get_pixel(xi, 0) == @skip && xi < bitmap.width
xi += 1
end
return -1 if xi >= bitmap.width
xf = xi
while bitmap.get_pixel(xf, 0) != @skip && xf < bitmap.width
xf += 1
end
return -1 if xf >= bitmap.width
rect = Rect.new(xi, 0, xf - xi, bitmap.height)
@glyphs[char] = Bitmap.new(xf - xi, bitmap.height)
@glyphs[char].blt(0, 0, bitmap, rect)
return xf+1
end
end
class Rect
#--------------------------------------------------------------------------
# * Strict Conversion to Array
#--------------------------------------------------------------------------
def to_ary
return x, y, width, height
end
alias bounds to_ary
end
class Bitmap
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sfont
#--------------------------------------------------------------------------
# * Draw Text
#--------------------------------------------------------------------------
alias_method :trick_sfont_bitmap_draw_text, :draw_text
def draw_text(*args)
if self.sfont == nil
trick_sfont_bitmap_draw_text(*args)
else
align = 0
case args.size
when 2
rect, text = args
x, y, width, height = rect
when 3
rect, text, align = args
x, y, width, height = rect
when 5
x, y, width, height, text = args
when 6
x, y, width, height, text, align = args
end
bitmap = sfont.render(text)
if align == 1
x += (width - bitmap.width) / 2
elsif align == 2
x += width - bitmap.width
end
y += (height - bitmap.height) / 2
blt(x, y, bitmap, bitmap.rect)
end
end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super("Which file would you like to save to?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
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_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Remake temporary object
$game_temp = Game_Temp.new
# Timestamp selects new file
$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 would you like to load?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play load SE
$game_system.se_play($data_system.load_se)
# Read save data
file = File.open(filename, "rb")
read_save_data(file)
file.close
# Restore BGM and BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to title screen
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$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_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end
#==============================================================================
# ADD-ON - LAYOUT
#==============================================================================
# By Moghunter
#==============================================================================
class React < Window_Base
attr_reader :index
attr_reader :help_window
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@row_max = 1
@index = -1
end
def index=(index)
@index = index
refresh
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
def row_max
return (@item_max + @column_max - 1) / @column_max
end
def top_row
return self.oy / 32
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end
def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end
def help_window=(help_window)
@help_window = help_window
if self.active and @help_window != nil
update_help
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = 0
x = @index / @column_max * 48 - self.oy
y = 110 + @index % @column_max * (cursor_width + 100)
self.cursor_rect.set(x, y, cursor_width, 32)
t = @index / @column_max * 28 - self.oy
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::C) or Input.repeat?(Input::B)
refresh
end
if Input.repeat?(Input::RIGHT)
if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
@index < @item_max - @row_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @row_max) % @item_max
refresh
end
end
if Input.repeat?(Input::LEFT)
if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
@index >= @row_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @row_max + @item_max) % @item_max
refresh
end
end
if Input.repeat?(Input::RIGHT)
if @column_max >= 2 and @index < @item_max - 1
$game_system.se_play($data_system.cursor_se)
@index += 1
refresh
end
end
if Input.repeat?(Input::LEFT)
if @column_max >= 2 and @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
refresh
end
end
if Input.repeat?(Input::R)
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
refresh
self.top_row += self.page_row_max
end
end
if Input.repeat?(Input::L)
if self.top_row > 0
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
refresh
self.top_row -= self.page_row_max
end
end
end
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
end
class Window_Base < Window
def draw_face(actor,x,y)
face = RPG::Cache.picture(actor.name + "_face")
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_face2(actor,x,y)
face = RPG::Cache.picture(actor.name + "_face2")
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_lay(actor,x,y)
layout = RPG::Cache.picture(actor.name + "_lay")
cw = layout.width
ch = layout.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, layout, src_rect)
end
def draw_hp(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("HP_BAR")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("HP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60, y - ch + 15, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(hp_x + 20, y - 8, 48, 32, actor.hp.to_s, 2)
end
def draw_hp2(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, back, src_rect)
meter = RPG::Cache.picture("HP_BAR")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, meter, src_rect)
text = RPG::Cache.picture("HP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 33, y - ch + 20, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(hp_x - 21, y - 4, 12, 32, "HP", 1)
self.contents.draw_text(hp_x - 33, y - 4, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = normal_color
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(hp_x + 15, y - 4, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 27, y - 4, 48, 32, actor.maxhp.to_s)
end
def draw_sp(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("SP_BAR")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("SP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60, y - ch + 15, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(sp_x + 20, y - 8, 48, 32, actor.sp.to_s, 2)
end
def draw_sp2(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, back, src_rect)
meter = RPG::Cache.picture("SP_BAR")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, meter, src_rect)
text = RPG::Cache.picture("SP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 33, y - ch + 20, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(sp_x - 48, y - 4, 12, 32, "EP", 1)
self.contents.draw_text(sp_x - 60, y - 4, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(sp_x - 12, y - 4, 12, 32, "/", 1)
self.contents.draw_text(sp_x, y - 4, 48, 32, actor.maxsp.to_s)
end
def draw_name(actor, x, y)
self.contents.font.color = Color.new(238,46,218,255)
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(x , y, 100, 40, actor.name,15) #self.contents.draw_text(x , y, 70, 40, actor.name,1)
end
def draw_commando(x,y)
com = RPG::Cache.picture("commando")
cw = com.width
ch = com.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, com, src_rect)
end
def draw_level(actor, x, y)
self.contents.font.color = Color.new(238,46,218,255)
self.contents.draw_text(x + 32, y, 20, 20, actor.level.to_s, 1)
end
def draw_com(actor, x, y)
action = RPG::Cache.picture(actor.name + "_com")
cw = action.width
ch = action.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, action, src_rect)
end
end
def draw_select(x,y)
com = RPG::Cache.picture("select")
cw = com.width
ch = com.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, com, src_rect)
end
#_______________________________________________________________________________
# MOG Scene File Ayumi V1.0
#_______________________________________________________________________________
# By Moghunter
#_______________________________________________________________________________
if true # True = Enable / False = Disable (Script)
module MOG
#Transition Time.
MSVT = 30
#Transition Type.
MSVTT = "006-Stripe02"
end
$mogscript = {} if $mogscript == nil
$mogscript["menu_ayumi"] = true
###############
# Window_Base #
###############
class Window_Base < Window
def drw_win_file(x,y)
dwf = RPG::Cache.picture("Win_File")
cw = dwf.width
ch = dwf.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, dwf, src_rect)
end
end
###################
# Window_SaveFile #
###################
class Window_SaveFile < Window_Base
attr_reader :filename
attr_reader :selected
def initialize(file_index, filename)
super(0, 64 + file_index * 138, 640, 240)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@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)
@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_party = Marshal.load(file)
@game_troop = Marshal.load(file)
@game_map = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
@wiref = 0
refresh
@selected = false
end
def refresh
self.contents.clear
drw_win_file(0,190)
name = "Page" + "#{@file_index + 1}"#nome page
self.contents.draw_text(338, 23, 600, 32, name) #position of page
self.contents.draw_text(337, 22, 600, 32, name) #position of page
@name_width = contents.text_size(name).width
if @game_switches[820]
chapter = "Chapter 1: Hellish Destiny"
self.contents.draw_text(338, 58, 600, 32, chapter) #position of CHAPTER
self.contents.draw_text(337, 57, 600, 32, chapter) #position of CHAPTER
@chapter_width = contents.text_size(chapter).width
else if @game_switches[821]
chapter = "Chapter 2: The ''Amazon Stones''"
self.contents.draw_text(338, 58, 600, 32, chapter) #position of CHAPTER
self.contents.draw_text(337, 57, 600, 32, chapter) #position of CHAPTER
@chapter_width = contents.text_size(chapter).width
else if @game_switches[822]
chapter = "Chapter 3: Dreams In Danger"
self.contents.draw_text(338, 58, 600, 32, chapter) #position of CHAPTER
self.contents.draw_text(337, 57, 600, 32, chapter) #position of CHAPTER
@chapter_width = contents.text_size(chapter).width
else if @game_switches[823]
chapter = "Chapter 4: Struggle For The Galaxy"
self.contents.draw_text(338, 58, 600, 32, chapter) #position of CHAPTER
self.contents.draw_text(337, 57, 600, 32, chapter) #position of CHAPTER
@chapter_width = contents.text_size(chapter).width
else if @game_switches[824]
chapter = "Chapter 5: The Last Battle"
self.contents.draw_text(338, 58, 600, 32, chapter) #position of CHAPTER
self.contents.draw_text(337, 57, 600, 32, chapter) #position of CHAPTER
@chapter_width = contents.text_size(chapter).width
else if @game_switches[825]
chapter = "Chapter 6: Ami's First Love"
self.contents.draw_text(338, 58, 600, 32, chapter) #position of CHAPTER
self.contents.draw_text(337, 57, 600, 32, chapter) #position of CHAPTER
@chapter_width = contents.text_size(chapter).width
end
end
end
end
end
end
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(cw * @wiref + 1 , 0, cw, ch)
x = 360 - @characters.size + i * 32 - cw / 4 #position of sailor
self.contents.blt(x - 10, 135 - ch, bitmap, src_rect) #135altezza sailor
x = 116
actors = @game_party.actors
for i in 0...[actors.size, 5].min
x = i * 60
actor = actors[i]
end
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.draw_text(5, 41, 397, 32, time_string, 2)
self.contents.draw_text(4, 40, 397, 32, time_string, 2)
end
end
def selected=(selected)
@selected = selected
end
end
##############
# Scene_File #
##############
class Scene_File
def initialize(help_text)
@help_text = help_text
end
def main
@mnback = Plane.new
@mnback.bitmap = RPG::Cache.picture("MN_BK")
@mnback.z = 1
@mnlay = Sprite.new
@mnlay.bitmap = RPG::Cache.picture("Lay_File")
@mnlay.z = 2
@help_window = Window_Help.new
@help_window.set_text(@help_text)
@help_window.opacity = 0
@savefile_windows = []
for i in 0..2
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
@savefile_windows[0]
@file_index = $game_temp.last_file_index
@savefile_windows[@file_index].selected = true
@savefile_windows[0].y = 40
@savefile_windows[1].y= 140
@savefile_windows[2].y= 240
@win_move_time = 0
@win_move = 0
@win_dire = 0
@win_opac = 255
@win1_y = 0
@win2_y = 0
@win3_y = 0
Graphics.transition(MOG::MSVT, "Graphics/Transitions/" + MOG::MSVTT)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
for i in 0..50
@mnback.ox += 1
Graphics.update
end
Graphics.freeze
@help_window.dispose
@mnback.dispose
@mnlay.dispose
for i in @savefile_windows
i.dispose
end
end
def update
if @file_index == 0
@savefile_windows[0].z = 2
@savefile_windows[1].z = 1
@savefile_windows[2].z = 0
@savefile_windows[0].x = @win_move
@savefile_windows[1].x = 0
@savefile_windows[1].x= 0
@savefile_windows[2].x = 0
@savefile_windows[0].contents_opacity = @win_opac
@savefile_windows[1].contents_opacity = 130
@savefile_windows[2].contents_opacity = 130
elsif @file_index == 1
@savefile_windows[0].z = 1
@savefile_windows[1].z = 2
@savefile_windows[2].z = 1
@savefile_windows[0].x = 0
@savefile_windows[1].x = @win_move
@savefile_windows[2].x = 0
@savefile_windows[0].contents_opacity = 130
@savefile_windows[1].contents_opacity = @win_opac
@savefile_windows[2].contents_opacity = 130
else
@savefile_windows[0].z = 0
@savefile_windows[1].z = 1
@savefile_windows[2].z = 2
@savefile_windows[0].x = 0
@savefile_windows[1].x = 0
@savefile_windows[2].x = @win_move
@savefile_windows[0].contents_opacity = 130
@savefile_windows[1].contents_opacity = 130
@savefile_windows[2].contents_opacity = @win_opac
end
@help_window.update
for i in @savefile_windows
i.update
end
if Input.trigger?(Input::C)
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
if Input.trigger?(Input::B)
on_cancel
return
end
if Input.repeat?(Input::DOWN)
if Input.trigger?(Input::DOWN) or @file_index < 3
$game_system.se_play($data_system.cursor_se)
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 1) % 3
@savefile_windows[@file_index].selected = true
return
end
end
if Input.repeat?(Input::UP)
if Input.trigger?(Input::UP) or @file_index > 0
$game_system.se_play($data_system.cursor_se)
@savefile_windows[@file_index].selected = false
@file_index = (@file_index - 1) % 3
@savefile_windows[@file_index].selected = true
return
end
end
end
def make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
end
end
end
class Sprite
def draw_icon(icon_index, x, y, enabled = true)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.bitmap.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end
end
class Window_Help < Window_Base
@@SCROLL_DELAY = 2 # seconds
@@SCROLL_SPEED = 1 # pixels / frame (60 frames / sec)
@@SHOW_ICONS = true # display icons for items and skills?
alias :scroll_init :initialize
def initialize(*args)
scroll_init(*args)
@internal_frame_count = 0
@text_is_long = false
@icon_sprite = Sprite.new
@icon_sprite.x = self.x + 16
@icon_sprite.y = self.y + 16
@icon_sprite.z = self.z + 1
@icon_sprite.bitmap = Bitmap.new(32, 32)
self.windowskin = get_altered_skin
end
def get_altered_skin
default = Cache.system('Window')
window = Bitmap.new(default.width, default.height)
window.blt(0, 0, default, default.rect)
window.fill_rect(80, 16, 32, 32, Color.new(0,0,0,0))
return window
end
def set_text(text, align = 0)
unless (text == @text) && (align == @align)
@internal_frame_count = 0
txt_width = self.contents.text_size(text).width
@text_is_long = txt_width > (self.width - 32)
self.contents.dispose
w = @text_is_long ? (txt_width + self.width - 32) : self.width - 32
self.contents = Bitmap.new(w, self.height - 32)
self.contents.clear
self.ox = 0
self.contents.font.color = normal_color
i = get_icon_index(text)
unless i.nil?
draw_sprite(i, 0, 0)
self.contents.draw_text(32, 0, self.contents.width, WLH, text, align)
else
@icon_sprite.bitmap.clear
self.contents.draw_text(4, 0, self.contents.width, WLH, text, align)
end
@text = text
@align = align
end
end
def draw_sprite(icon_index, x, y)
@icon_sprite.bitmap.clear
# get the background image at 'rect'
# so that text does not appear under the icon
bitmap = Graphics.snap_to_bitmap
rect = Rect.new(@icon_sprite.x, @icon_sprite.x,
@icon_sprite.bitmap.width, @icon_sprite.bitmap.height)
@icon_sprite.bitmap.blt(x, y, bitmap, rect)
@icon_sprite.draw_icon(icon_index, x, y)
end
def get_icon_index(desc)
return nil unless @@SHOW_ICONS
$data_items.each do |item|
return item.icon_index if !item.nil? && item.description == desc
end
$data_weapons.each do |weapon|
return weapon.icon_index if !weapon.nil? && weapon.description == desc
end
$data_armors.each do |armor|
return armor.icon_index if !armor.nil? && armor.description == desc
end
$data_skills.each do |skill|
return skill.icon_index if !skill.nil? && skill.description == desc
end
return nil
end
def update
super
@internal_frame_count += 1
if ((@internal_frame_count > @@SCROLL_DELAY * 60) && @text_is_long)
if self.ox >= (self.contents.width - self.width + 48)
self.ox = 0
@internal_frame_count = 0
else
self.ox += @@SCROLL_SPEED
end
end
end
def dispose
super
@icon_sprite.dispose
end
end
#=================================================================
# ? Battle Result by A3D Ver. 1.02
# Useful : show battle result in a different way
# Effect to default script : this code will replace methode "start_phase5" & "update_phase5" in Scene_Battle
# How to install : in script editor, insert all the code above main
# Note : this script is for non-commercial use only, give credit if use
# Contact : A3D (hyper_s@hotmail.com)
#=================================================================
module A3D
WAIT_WINDOW_APPEAR = 60
WAIT_RUNNING_NUMBER = 20
STEP_EXP = 1
STEP_GOLD = 1
SE_LEVELUP = ["007-System07", 100, 100]
SE_NEWSKILL = ["007-System07", 100, 100]
FONT_NAME = "Tahoma"
FONT_SIZE = 22
end
#==============================================================================
# ? Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ? After battle phase start
#--------------------------------------------------------------------------
def start_phase5
# It moves to phase 5
@phase = 5
# Performing battle end ME
$game_system.me_play($game_system.battle_end_me)
# You reset to BGM before the battle starting
$game_system.bgm_play($game_temp.map_bgm)
# Initializing EXP, the gold and the treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# When the enemy hides and it is not state
unless enemy.hidden
# Adding acquisition EXP and the gold
exp += enemy.exp
gold += enemy.gold
# Treasure appearance decision
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure acquisition
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Create Variable & Window
@phase5_step = 1
@wait_window_appear = A3D::WAIT_WINDOW_APPEAR
@wait_running_number = A3D::WAIT_RUNNING_NUMBER
@resultreceive_window = Window_ResultReceive.new(exp, gold, treasures)
@resultgold_window = Window_ResultGold.new
@resultparty_window = Window_ResultParty.new
@actor_level_before = []
@resultlevel_window = []
@resultskill_window = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
@actor_level_before[i] = actor.level
@resultlevel_window[i] = Window_ResultLevel.new(i)
@resultskill_window[i] = Window_ResultSkill.new(i)
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5
#--------------------------------------------------------------------------
def update_phase5
case @phase5_step
when 1 # EXP & Gold Phase
update_phase5_step1
when 2 # Skill Phase
update_phase5_step2
when 3 # Delete Window Phase
update_phase5_step3
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 1
#--------------------------------------------------------------------------
def update_phase5_step1
# Wait Count Before Window Appear
if @wait_window_appear > 0
@wait_window_appear -= 1
if @wait_window_appear == 0
@resultreceive_window.visible = true
@resultgold_window.visible = true
@resultparty_window.visible = true
$game_temp.battle_main_phase = false
end
return
end
# Wait Count Before Running Number
if @wait_running_number > 0
@wait_running_number -= 1
return
end
# Change Item Page
if Input.trigger?(Input::RIGHT)
if @resultreceive_window.max_page != 1
$game_system.se_play($data_system.cursor_se)
@resultreceive_window.page = @resultreceive_window.page == 1 ? 2 : 1
@resultreceive_window.refresh
end
end
# EXP & Gold Rolling
if (@resultreceive_window.exp != 0 || @resultreceive_window.gold != 0)
# Input C to Shortcut Calculation
if Input.trigger?(Input::C)
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
level_before = actor.level
actor.exp += @resultreceive_window.exp
if actor.level > level_before
@resultlevel_window[i].visible = true
Audio.se_play("Audio/SE/" + A3D::SE_LEVELUP[0], A3D::SE_LEVELUP[1], A3D::SE_LEVELUP[2])
end
end
$game_party.gain_gold(@resultreceive_window.gold)
@resultreceive_window.exp = 0
@resultreceive_window.gold = 0
@resultreceive_window.refresh
@resultgold_window.refresh
@resultparty_window.refresh
end
# EXP
if @resultreceive_window.exp != 0
step_exp = @resultreceive_window.exp >= A3D::STEP_EXP.abs ? A3D::STEP_EXP.abs : @resultreceive_window.exp
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.next_rest_exp <= step_exp && actor.next_rest_exp != 0
@resultlevel_window[i].visible = true
Audio.se_play("Audio/SE/" + A3D::SE_LEVELUP[0], A3D::SE_LEVELUP[1], A3D::SE_LEVELUP[2])
end
actor.exp += step_exp
end
@resultreceive_window.exp -= step_exp
@resultreceive_window.refresh
@resultparty_window.refresh
end
# Gold
if @resultreceive_window.gold != 0
step_gold = @resultreceive_window.gold >= A3D::STEP_GOLD.abs ? A3D::STEP_GOLD.abs : @resultreceive_window.gold
$game_party.gain_gold(step_gold)
@resultreceive_window.gold -= step_gold
@resultreceive_window.refresh
@resultgold_window.refresh
end
return
end
# Input C to Bypass Step
if Input.trigger?(Input::C)
@phase5_step = 2
return
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 2
#--------------------------------------------------------------------------
def update_phase5_step2
# Change Item Page
if Input.trigger?(Input::RIGHT)
if @resultreceive_window.max_page != 1
$game_system.se_play($data_system.cursor_se)
@resultreceive_window.page = @resultreceive_window.page == 1 ? 2 : 1
@resultreceive_window.refresh
end
end
# Initialize Skill Phase
if @initialized_skill_phase == nil
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
for skill in $data_classes[actor.class_id].learnings
if skill.level > @actor_level_before[i] && skill.level <= actor.level
Audio.se_play("Audio/SE/" + A3D::SE_NEWSKILL[0], A3D::SE_NEWSKILL[1], A3D::SE_NEWSKILL[2])
@resultskill_window[i].skill_id = skill.skill_id
@resultskill_window[i].visible = true
@resultskill_window[i].refresh
@skill_phase_active = true
end
end
end
@initialized_skill_phase = true
end
# If Skill Phase Active, Show Window
if @skill_phase_active != nil
if @resultskill_window[0].x != 456
for i in 0...$game_party.actors.size
@resultskill_window[i].x -= 23
end
return
end
else
@phase5_step = 3
return
end
# Input C to Bypass Step
if Input.trigger?(Input::C)
@phase5_step = 3
return
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 3
#--------------------------------------------------------------------------
def update_phase5_step3
# Delete All Result-Window
@resultreceive_window.dispose
@resultgold_window.dispose
@resultparty_window.dispose
for i in 0...$game_party.actors.size
@resultlevel_window[i].dispose
@resultskill_window[i].dispose
end
battle_end(0)
end
end
#==============================================================================
# ? Game_Actor
#==============================================================================
class Game_Actor
def next_rest_exp
return @exp_list[@level+1] > 0 ? (@exp_list[@level+1] - @exp) : 0
end
end
#==============================================================================
# ? Window_ResultReceive
#==============================================================================
class Window_ResultReceive < Window_Base
#--------------------------------------------------------------------------
# ? Attr
#--------------------------------------------------------------------------
attr_accessor :exp
attr_accessor :gold
attr_accessor :page
attr_reader :max_page
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
super(40, 28, 224, 212)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
@exp = exp
@gold = gold
@treasures = treasures
@page = 1
@max_page = treasures.size > 4 ? 2 : 1
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, -8, self.width - 32, 32, "Exp")
self.contents.draw_text(0, 16, self.width - 32, 32, $data_system.words.gold)
self.contents.draw_text(0, 40, self.width - 32, 32, $data_system.words.item + " [" + @page.to_s + "/" + @max_page.to_s + "]" )
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, self.width - 32, 32, @exp.to_s, 2)
self.contents.draw_text(0, 16, self.width - 32, 32, @gold.to_s, 2)
if @treasures.size == 0
self.contents.draw_text(0, 68, self.width - 32, 32, "< Nothing. >")
elsif @treasures.size > 4
bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
self.contents.blt(184, 116, bitmap, Rect.new(168, 24, 16, 16), 255)
end
y = 68
item_start_index = @page == 1 ? 0 : 4
for i in item_start_index...@treasures.size
item = @treasures[i]
draw_item_name(item, 0, y)
y += 28
end
end
end
#==============================================================================
# ? Window_ResultGold
#==============================================================================
class Window_ResultGold < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize
super(40, 240, 224, 52)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, -8, self.width - 32, 32, "Total " + $data_system.words.gold)
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, self.width - 32, 32, $game_party.gold.to_s, 2)
end
end
#==============================================================================
# ? Window_ResultParty
#==============================================================================
class Window_ResultParty < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize
super(264, 28, 336, 264)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...5$game_party.actors.size
actor = $game_party.actors[i]
y = 60 * i + 22
draw_actor_graphic(actor, 24, y + 28 )
draw_actor_name(actor, 64, y - 28)
self.contents.font.color = system_color
self.contents.draw_text(116, y, (self.width - 32), 32, "Lv.")
self.contents.draw_text(188, y, (self.width - 32), 32, "Next")
self.contents.font.color = normal_color
self.contents.draw_text(-140, y, (self.width - 32), 32, actor.level.to_s ,2)
self.contents.draw_text(0 , y, (self.width - 32), 32, actor.next_rest_exp_s ,2)
end
end
end
#==============================================================================
# ? Window_ResultLevel
#==============================================================================
class Window_ResultLevel < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(id)
super(332, 60 * id + 40, 124, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
self.z = 200
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, -2, self.width - 32, 32, "Level-Up !", 1)
end
end
#==============================================================================
# ? Window_ResultSkill
#==============================================================================
class Window_ResultSkill < Window_Base
#--------------------------------------------------------------------------
# ? Attr
#--------------------------------------------------------------------------
attr_accessor :skill_id
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(id)
super(640, 60 * id + 40, 200, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
self.z = 200
@skill_id = nil
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @skill_id == nil
return
end
skill = $data_skills[@skill_id]
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(0, 2, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.font.color = normal_color
self.contents.draw_text(32, -2, self.width - 64, 32, skill.name)
end
end