Salve a tutti,
esiste un modo per rendere questi due script compatibili fra loro? Oppure esistono altri message system compatibili? (Ho già provato con il Lune)
(Sistema di scelte)
Spoiler
#------------------------------------------------------------------------------#
# Galv's Visual Novel Choices
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.9
#------------------------------------------------------------------------------#
# 2013-01-16 - Version 1.9 - Added Y offset for choice window
# 2012-11-28 - Version 1.8 - Z level setting added
# 2012-11-28 - Version 1.7 - Added compatability for some cursor scripts
# 2012-11-28 - Version 1.6 - Fixed a bug that could crash the game.
# 2012-11-28 - Version 1.5 - Added offset to change postion of cursor x and y
# 2012-11-28 - Version 1.4 - Fixed z levels and made cursor use an image
# 2012-11-27 - Version 1.3 - Fixed a bug with cancel choice selection
# 2012-11-27 - Version 1.2 - added a switch to disable script effects
# 2012-11-27 - Version 1.1 - added ability to use different image per choice
# - added a couple more options
# 2012-11-27 - Version 1.0 - release
#------------------------------------------------------------------------------#
# This script overwrites the default "Show Choices" list. The choices are
# changed so they display centered on the screen with a graphic behind each
# of them. Made with visual novel choice selection in mind.
#------------------------------------------------------------------------------#
# INSTRUCTIONS:
# Copy the graphic from the demo /Graphics/System into your project.
# Copy the script into your script list, below Materials and above Main
#
# Some setup options below, most only need to be changed if you use your own
# custom choice image.
#------------------------------------------------------------------------------#
# Codes:
#------------------------------------------------------------------------------#
# Most of the usual codes that work in messages should work in choices.
# (eg. \V[x], \N[x], \C[x], etc. Look at message tooltip to know more.)
#
# A new one has been added so you can change the background image for separate
# choice options.
#
# \B[x]
#
# This works by adding the number x (as you put in the code above) to the end
# of the CHOICE IMAGE file name. For example, the default choice image is:
# "Choice.png" located in /Graphics/System/. If you put the code anywhere in
# a choice box: \B[3] it will look for "Choice3.png" image in the same
# location.
#------------------------------------------------------------------------------#
($imported ||= {})["Galvs_Image_Choices"] = true
module Galv_Choice
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
CURSOR_IMAGE = "Cursor" # Images used to determine which option you select
CURSOR_OPACITY = 255 # Opacity of the cursor
CURSOR_Y_OFFSET = 0 # Nudge cursor position vertically
CURSOR_X_OFFSET = 0 # Nudge cursor position horizontally
CHOICE_IMAGE = "Choice" # Image for each choice located in /Graphics/System
IMAGE_Y_OFFSET = 3 # Nudge your choice image vertically if needed
IMAGE_OPACITY = 215 # The opacity of the image
CHOICE_HEIGHT = 45 # How tall each choice.
CHOICE_ITEM_Y = 2 # Offset for choice item text
CENTER_TEXT = true # left aligned if false, centered if true
DISABLE_SWITCH = 1 # Turn this switch ON to disable this script
CHOICES_Y = 0 # Y offset to move choice window up or down.
# useful if you use a script that creates a namebox
CHOICES_Z = 50 # The z value of the choices window. Try changing it
# if pictures or other scripts appear over or under
# the choices window to how you like.
#------------------------------------------------------------------------------#
OTHER_Y_OFFSET = 12 # May fix other cursor scripts positioning
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
end
class Window_ChoiceList < Window_Command
alias galv_choice_initialize initialize
def initialize(message_window)
galv_choice_initialize(message_window)
self.z = Galv_Choice::CHOICES_Z
end
def start
@index = 0
setup_choices
make_cursor
refresh
open
activate
update_placement
update_bgs
refresh
select(0)
end
def make_cursor
return if $game_switches[Galv_Choice::DISABLE_SWITCH]
@cursor_sprite = Sprite.new
@cursor_sprite.bitmap = Cache.system(Galv_Choice::CURSOR_IMAGE)
end
def setup_choices
@choice_sprite = []
if !$game_switches[Galv_Choice::DISABLE_SWITCH]
self.opacity = 0
get_widths
else
self.opacity = 255
end
end
alias galv_choice_update_placement update_placement
def update_placement
if $game_switches[Galv_Choice::DISABLE_SWITCH]
galv_choice_update_placement
else
self.width = [max_choice_width + 12, 96].max + padding * 4
self.width = [width, Graphics.width].min
self.height = contents_height + Galv_Choice::CHOICE_HEIGHT - 10
self.x = (Graphics.width - width) / 2
if @message_window.openness < 100
self.y = Graphics.height - contents_height + item_height / 2
elsif @message_window.y >= Graphics.height / 2
self.y = @message_window.y - contents_height + item_height / 2 - Galv_Choice::CHOICES_Y
else
self.y = @message_window.y + @message_window.height + item_height / 2 + Galv_Choice::CHOICES_Y
end
end
end
alias galv_choice_contents_height contents_height
def contents_height
if $game_switches[Galv_Choice::DISABLE_SWITCH]
galv_choice_contents_height
else
(item_max + 1) * item_height
end
end
def draw_item(index)
rect = item_rect_for_text(index)
draw_text_ex(rect.x, rect.y, command_name(index))
if !$game_switches[Galv_Choice::DISABLE_SWITCH]
draw_bgs(index)
end
end
def item_rect_for_text(index)
rect = item_rect(index)
if $game_switches[Galv_Choice::DISABLE_SWITCH]
rect.x += 4
rect.width -= 8
rect
else
if Galv_Choice::CENTER_TEXT
rect.x = (max_choice_width - @text_sizes.collect {|s| text_size(s).width }[index] + (padding * 3)) / 2
else
rect.x += 4
end
rect.width -= 8
rect.y += Galv_Choice::CHOICE_ITEM_Y
rect
end
end
def get_widths
@text_sizes = []
@choice_background = []
$game_message.choices.each_with_index do |c,i|
@text_sizes[i] = esc_characters(c,i)
end
end
def esc_characters(text,index)
result = text.to_s.clone
result.gsub!(/\\/) { "\e" }
result.gsub!(/\e\e/) { "\\" }
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
result.gsub!(/\eN\[(\d+)\]/i) { $game_actors[$1.to_i].name}
result.gsub!(/\eP\[(\d+)\]/i) {
if $game_party.members[$1.to_i].nil?
""
else
$game_party.members[$1.to_i].name
end
}
result.gsub!(/\eG/i) { Vocab::currency_unit }
result.gsub!(/\eC\[(\d+)\]/i) { "" }
result.gsub!(/\eI\[(\d+)\]/i) { " " }
result.gsub!(/\eB\[(\d+)\]/i) { @choice_background[index] = $1.to_i }
result.gsub!(/\eB\[(\d+)\]/i) { "" }
result
end
def convert_escape_characters(text)
result = text.to_s.clone
result.gsub!(/\\/) { "\e" }
result.gsub!(/\e\e/) { "\\" }
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
result.gsub!(/\eG/i) { Vocab::currency_unit }
result.gsub!(/\eB\[(\d+)\]/i) { "" }
result
end
def item_height
return line_height if $game_switches[Galv_Choice::DISABLE_SWITCH]
return Galv_Choice::CHOICE_HEIGHT
end
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = item_height - 15
rect.height += 15 if $game_switches[Galv_Choice::DISABLE_SWITCH]
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
rect
end
def draw_bgs(index)
return if @choice_sprite[index] != nil
if @choice_background[index].nil?
b = ""
else
b = @choice_background[index]
end
@choice_sprite[index] = Sprite.new
@choice_sprite[index].bitmap = Cache.system(Galv_Choice::CHOICE_IMAGE + b.to_s)
@choice_sprite[index].x = index % col_max * (item_width + spacing)
@choice_sprite[index].y = index / col_max * item_height
@choice_sprite[index].z = self.z - 2
end
def update_bgs
@choice_sprite.each_with_index do |s,i|
s.y = self.y + i * Galv_Choice::CHOICE_HEIGHT + Galv_Choice::IMAGE_Y_OFFSET
s.x = (Graphics.width - s.width) / 2
s.opacity = Galv_Choice::IMAGE_OPACITY
end
end
def dispose_bgs
@choice_sprite.each_with_index do |s,i|
s.dispose
s.bitmap.dispose
end
if !$game_switches[Galv_Choice::DISABLE_SWITCH]
@cursor_sprite.dispose
@cursor_sprite.bitmap.dispose
@choice_sprite = []
end
end
alias galv_choice_call_ok_handler call_ok_handler
def call_ok_handler
galv_choice_call_ok_handler
dispose_bgs
end
alias galv_choice_call_cancel_handler call_cancel_handler
def call_cancel_handler
galv_choice_call_cancel_handler
dispose_bgs
end
def update_cursor
if $game_switches[Galv_Choice::DISABLE_SWITCH]
super
else
cursor_rect.empty
return if @cursor_sprite.nil? || @choice_sprite.nil?
if @index < 0
@cursor_sprite.opacity = 0
else
@cursor_sprite.opacity = Galv_Choice::CURSOR_OPACITY
@cursor_sprite.x = @choice_sprite[@index].x + Galv_Choice::CURSOR_X_OFFSET
@cursor_sprite.y = @choice_sprite[@index].y + Galv_Choice::CURSOR_Y_OFFSET
@cursor_sprite.z = self.z - 1
cursor_rect.y = (item_height * @index) + Galv_Choice::OTHER_Y_OFFSET
end
end
end
end # Window_ChoiceList < Window_Command
# Galv's Visual Novel Choices
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.9
#------------------------------------------------------------------------------#
# 2013-01-16 - Version 1.9 - Added Y offset for choice window
# 2012-11-28 - Version 1.8 - Z level setting added
# 2012-11-28 - Version 1.7 - Added compatability for some cursor scripts
# 2012-11-28 - Version 1.6 - Fixed a bug that could crash the game.
# 2012-11-28 - Version 1.5 - Added offset to change postion of cursor x and y
# 2012-11-28 - Version 1.4 - Fixed z levels and made cursor use an image
# 2012-11-27 - Version 1.3 - Fixed a bug with cancel choice selection
# 2012-11-27 - Version 1.2 - added a switch to disable script effects
# 2012-11-27 - Version 1.1 - added ability to use different image per choice
# - added a couple more options
# 2012-11-27 - Version 1.0 - release
#------------------------------------------------------------------------------#
# This script overwrites the default "Show Choices" list. The choices are
# changed so they display centered on the screen with a graphic behind each
# of them. Made with visual novel choice selection in mind.
#------------------------------------------------------------------------------#
# INSTRUCTIONS:
# Copy the graphic from the demo /Graphics/System into your project.
# Copy the script into your script list, below Materials and above Main
#
# Some setup options below, most only need to be changed if you use your own
# custom choice image.
#------------------------------------------------------------------------------#
# Codes:
#------------------------------------------------------------------------------#
# Most of the usual codes that work in messages should work in choices.
# (eg. \V[x], \N[x], \C[x], etc. Look at message tooltip to know more.)
#
# A new one has been added so you can change the background image for separate
# choice options.
#
# \B[x]
#
# This works by adding the number x (as you put in the code above) to the end
# of the CHOICE IMAGE file name. For example, the default choice image is:
# "Choice.png" located in /Graphics/System/. If you put the code anywhere in
# a choice box: \B[3] it will look for "Choice3.png" image in the same
# location.
#------------------------------------------------------------------------------#
($imported ||= {})["Galvs_Image_Choices"] = true
module Galv_Choice
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
CURSOR_IMAGE = "Cursor" # Images used to determine which option you select
CURSOR_OPACITY = 255 # Opacity of the cursor
CURSOR_Y_OFFSET = 0 # Nudge cursor position vertically
CURSOR_X_OFFSET = 0 # Nudge cursor position horizontally
CHOICE_IMAGE = "Choice" # Image for each choice located in /Graphics/System
IMAGE_Y_OFFSET = 3 # Nudge your choice image vertically if needed
IMAGE_OPACITY = 215 # The opacity of the image
CHOICE_HEIGHT = 45 # How tall each choice.
CHOICE_ITEM_Y = 2 # Offset for choice item text
CENTER_TEXT = true # left aligned if false, centered if true
DISABLE_SWITCH = 1 # Turn this switch ON to disable this script
CHOICES_Y = 0 # Y offset to move choice window up or down.
# useful if you use a script that creates a namebox
CHOICES_Z = 50 # The z value of the choices window. Try changing it
# if pictures or other scripts appear over or under
# the choices window to how you like.
#------------------------------------------------------------------------------#
OTHER_Y_OFFSET = 12 # May fix other cursor scripts positioning
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
end
class Window_ChoiceList < Window_Command
alias galv_choice_initialize initialize
def initialize(message_window)
galv_choice_initialize(message_window)
self.z = Galv_Choice::CHOICES_Z
end
def start
@index = 0
setup_choices
make_cursor
refresh
open
activate
update_placement
update_bgs
refresh
select(0)
end
def make_cursor
return if $game_switches[Galv_Choice::DISABLE_SWITCH]
@cursor_sprite = Sprite.new
@cursor_sprite.bitmap = Cache.system(Galv_Choice::CURSOR_IMAGE)
end
def setup_choices
@choice_sprite = []
if !$game_switches[Galv_Choice::DISABLE_SWITCH]
self.opacity = 0
get_widths
else
self.opacity = 255
end
end
alias galv_choice_update_placement update_placement
def update_placement
if $game_switches[Galv_Choice::DISABLE_SWITCH]
galv_choice_update_placement
else
self.width = [max_choice_width + 12, 96].max + padding * 4
self.width = [width, Graphics.width].min
self.height = contents_height + Galv_Choice::CHOICE_HEIGHT - 10
self.x = (Graphics.width - width) / 2
if @message_window.openness < 100
self.y = Graphics.height - contents_height + item_height / 2
elsif @message_window.y >= Graphics.height / 2
self.y = @message_window.y - contents_height + item_height / 2 - Galv_Choice::CHOICES_Y
else
self.y = @message_window.y + @message_window.height + item_height / 2 + Galv_Choice::CHOICES_Y
end
end
end
alias galv_choice_contents_height contents_height
def contents_height
if $game_switches[Galv_Choice::DISABLE_SWITCH]
galv_choice_contents_height
else
(item_max + 1) * item_height
end
end
def draw_item(index)
rect = item_rect_for_text(index)
draw_text_ex(rect.x, rect.y, command_name(index))
if !$game_switches[Galv_Choice::DISABLE_SWITCH]
draw_bgs(index)
end
end
def item_rect_for_text(index)
rect = item_rect(index)
if $game_switches[Galv_Choice::DISABLE_SWITCH]
rect.x += 4
rect.width -= 8
rect
else
if Galv_Choice::CENTER_TEXT
rect.x = (max_choice_width - @text_sizes.collect {|s| text_size(s).width }[index] + (padding * 3)) / 2
else
rect.x += 4
end
rect.width -= 8
rect.y += Galv_Choice::CHOICE_ITEM_Y
rect
end
end
def get_widths
@text_sizes = []
@choice_background = []
$game_message.choices.each_with_index do |c,i|
@text_sizes[i] = esc_characters(c,i)
end
end
def esc_characters(text,index)
result = text.to_s.clone
result.gsub!(/\\/) { "\e" }
result.gsub!(/\e\e/) { "\\" }
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
result.gsub!(/\eN\[(\d+)\]/i) { $game_actors[$1.to_i].name}
result.gsub!(/\eP\[(\d+)\]/i) {
if $game_party.members[$1.to_i].nil?
""
else
$game_party.members[$1.to_i].name
end
}
result.gsub!(/\eG/i) { Vocab::currency_unit }
result.gsub!(/\eC\[(\d+)\]/i) { "" }
result.gsub!(/\eI\[(\d+)\]/i) { " " }
result.gsub!(/\eB\[(\d+)\]/i) { @choice_background[index] = $1.to_i }
result.gsub!(/\eB\[(\d+)\]/i) { "" }
result
end
def convert_escape_characters(text)
result = text.to_s.clone
result.gsub!(/\\/) { "\e" }
result.gsub!(/\e\e/) { "\\" }
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
result.gsub!(/\eG/i) { Vocab::currency_unit }
result.gsub!(/\eB\[(\d+)\]/i) { "" }
result
end
def item_height
return line_height if $game_switches[Galv_Choice::DISABLE_SWITCH]
return Galv_Choice::CHOICE_HEIGHT
end
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = item_height - 15
rect.height += 15 if $game_switches[Galv_Choice::DISABLE_SWITCH]
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
rect
end
def draw_bgs(index)
return if @choice_sprite[index] != nil
if @choice_background[index].nil?
b = ""
else
b = @choice_background[index]
end
@choice_sprite[index] = Sprite.new
@choice_sprite[index].bitmap = Cache.system(Galv_Choice::CHOICE_IMAGE + b.to_s)
@choice_sprite[index].x = index % col_max * (item_width + spacing)
@choice_sprite[index].y = index / col_max * item_height
@choice_sprite[index].z = self.z - 2
end
def update_bgs
@choice_sprite.each_with_index do |s,i|
s.y = self.y + i * Galv_Choice::CHOICE_HEIGHT + Galv_Choice::IMAGE_Y_OFFSET
s.x = (Graphics.width - s.width) / 2
s.opacity = Galv_Choice::IMAGE_OPACITY
end
end
def dispose_bgs
@choice_sprite.each_with_index do |s,i|
s.dispose
s.bitmap.dispose
end
if !$game_switches[Galv_Choice::DISABLE_SWITCH]
@cursor_sprite.dispose
@cursor_sprite.bitmap.dispose
@choice_sprite = []
end
end
alias galv_choice_call_ok_handler call_ok_handler
def call_ok_handler
galv_choice_call_ok_handler
dispose_bgs
end
alias galv_choice_call_cancel_handler call_cancel_handler
def call_cancel_handler
galv_choice_call_cancel_handler
dispose_bgs
end
def update_cursor
if $game_switches[Galv_Choice::DISABLE_SWITCH]
super
else
cursor_rect.empty
return if @cursor_sprite.nil? || @choice_sprite.nil?
if @index < 0
@cursor_sprite.opacity = 0
else
@cursor_sprite.opacity = Galv_Choice::CURSOR_OPACITY
@cursor_sprite.x = @choice_sprite[@index].x + Galv_Choice::CURSOR_X_OFFSET
@cursor_sprite.y = @choice_sprite[@index].y + Galv_Choice::CURSOR_Y_OFFSET
@cursor_sprite.z = self.z - 1
cursor_rect.y = (item_height * @index) + Galv_Choice::OTHER_Y_OFFSET
end
end
end
end # Window_ChoiceList < Window_Command
(XS Message system)
Spoiler
#==============================================================================
# XS - Message
# Author: Nicke
# Created: 08/11/2012
# Edited: 19/11/2012
# Version: 1.0b
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#==============================================================================
# Requires: XS - Core Script.
#==============================================================================
# A message system based on using variables ingame.
# If the variable has the value 0 the default value will take place.
# To setup a simple message dialog do as you would normally do when adding
# text in events but before it set the variables you want to change.
#
# When changing width and height you should know that height is visible
# line numbers which means the numbers 1 to 4 is prefered to use.
#
# Example:
# You could set the width to 544 and height to 4 which is pretty much how
# the default message window looks like.
#
# This script also support sound effect to be played each time a character is
# processed. Can be tweaked in the settings.
#
# When setting variables for bold, shadow, namebox and skin etc. Remember to use
# the script area in the variable.
#
# If I wanted to enable bold and setting a custom skin I would do this:
# Set the value "true" in the script section for variable 41.
# Set the value "Window" in the script section for variable 44.
#
# Note: When changing the message window skin you must use this method after
# setting the variable in order to properly update to the new skin:
# SceneManager.scene.set_message_skin
#
# Example:
# So after setting variable 44 (default one) to "Window3" call that method.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-MESSAGE-SYSTEM"] = true
module XAIL
module MSG
#--------------------------------------------------------------------------#
# * Settings
#--------------------------------------------------------------------------#
# Set the window variables.
# WINDOW_VAR = [width, height, padding, x, y, delay,
# font_name, font_size, font_color, outline, bold, shadow, namebox, skin]
WINDOW_VAR = [31,32,33,34,35,36,37,38,39,40,41,42,43,44]
# Set the window open/close animation in frames.
# WINDOW_ANIMATE = [openness, closeness]
WINDOW_ANIMATE = [15, 15]
# Name box options.
# NAME = [font, size, color, bold, shadow]
NAME = [["Verdana", "Anklada™"], 14, Color.new(255,225,235,225), true, true]
# Set the sound for when the characters are processing.
# The sound effect will be played each time the occurence is met.
# From the default it will happen every odd processed character.
# Can be set to nil to disable.
# SE = [occurence, name, vol, pitch]
SE = [2, "Decision1", 60, 150]
# Set the animation options for face window.
# For type only :fade exists at the moment.
# ANIM_FACE = [enabled, type, animation_speed_in, animation_speed_out]
ANIM_FACE = [true, :fade, 12, 8]
# Set the animation options for name window.
# For type only :fade exists at the moment.
# ANIM_NAME = [animation_speed_in, animation_speed_out]
ANIM_NAME = [true, :fade, 12, 8]
end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Error Handler
#==============================================================================#
unless $imported["XAIL-XS-CORE"]
# // Error handler when XS - Core is not installed.
msg = "The script %s requires the latest version of XS - Core in order to function properly."
name = "XS - Message"
msgbox(sprintf(msg, name))
exit
end
#==============================================================================#
# ** Window_Base
#==============================================================================#
class Window_Base < Window
alias xail_msg_winbase_upd_open update_open
def update_open(*args, &block)
# // Method to update openness
# This should only occur when $game_message is visible.
if $game_message.visible
self.openness += XAIL::MSG::WINDOW_ANIMATE[0]
self.opacity = self.openness unless self.opacity == 0
self.back_opacity = self.openness unless self.opacity == 0
@opening = false if open?
else
xail_msg_winbase_upd_open(*args, &block)
end
end
alias xail_msg_winbase_upd_close update_close
def update_close(*args, &block)
# // Method override to update closeness.
# This should only occur when $game_message is visible.
if $game_message.visible
self.openness -= XAIL::MSG::WINDOW_ANIMATE[1]
self.opacity = self.openness unless self.opacity == 0
self.back_opacity = self.openness unless self.opacity == 0
@closing = false if close?
else
xail_msg_winbase_upd_close(*args, &block)
end
end
end
#==============================================================================#
# ** Window_Message_Face
#==============================================================================#
class Window_Message_Face < Window_Base
def initialize(x, y, width, height)
# // Method to initialize.
super(x, y, width, height)
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
self.windowskin = Cache.system(skin)
refresh
end
def refresh
# // Method to refresh.
contents.clear
r = Rect.new(0, 0, width, height)
r2 = Rect.new(2, 2, width-28, height-28)
contents.fill_rect(r, Color.new(75,125,135,245))
contents.gradient_fill_rect(r2, Color.new(125,125,125,255), Color.new(0,0,0,255), false)
draw_face($game_message.face_name, $game_message.face_index, 4, 4)
end
end
#==============================================================================#
# ** Window_Message_Name
#==============================================================================#
class Window_Message_Name < Window_Base
def initialize(name, x, y, width, height)
# // Method to initialize.
super(x, y, width, height)
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
self.windowskin = Cache.system(skin)
@name = name
refresh
end
def standard_padding
# // Method to set standard padding
return 4
end
def name=(name)
# // Method to refresh and set name.
return if @name == name
@name = name
refresh
end
def refresh
# // Method to refresh.
contents.clear
draw_font_text(@name, 0, 0, contents_width, 1, XAIL::MSG::NAME[0], XAIL::MSG::NAME[1], XAIL::MSG::NAME[2])
end
end
#==============================================================================#
# ** Window_Message
#==============================================================================#
class Window_Message < Window_Base
def initialize
# // Method override initialize for window message.
super(0, 0, window_width, window_height)
self.z = 200
self.openness = 0
create_all_windows
create_back_bitmap
create_back_sprite
clear_instance_variables
set_window_skins
end
def set_window_skins
# // Method to set window skins.
@gold_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
@choice_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
@number_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
@item_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
end
#~ alias xail_msg_winmsg_create_all_windows create_all_windows
#~ def create_all_windows(*args, &block)
#~ # // Method to create all windows.
#~ xail_msg_winmsg_create_all_windows(*args, &block)
#~ @choice_window = Window_ChoiceList.new(self)
#~ @number_window = Window_NumberInput.new(self)
#~ @item_window = Window_KeyItem.new(self)
#~ @choice_window.windowskin
#~ end
def window_width
# // Method override to return width.
get_var(XAIL::MSG::WINDOW_VAR[0], :width)
end
def window_height
# // Method override to return height.
fitting_height(get_var(XAIL::MSG::WINDOW_VAR[1], :height))
end
def standard_padding
# // Method to return the padding.
get_var(XAIL::MSG::WINDOW_VAR[2], :padding)
end
def window_x
# // Method to return x value of window.
get_var(XAIL::MSG::WINDOW_VAR[3], :win_x)
end
def window_y
# // Method to return y value of window.
get_var(XAIL::MSG::WINDOW_VAR[4], :win_y)
end
def get_var(var, type)
# // Method to return variable value if conditions met.
unless var.nil? or $game_variables[var] == 0
return $game_variables[var]
else
case type
when :width ; return Graphics.width
when :height ; return visible_line_number
when :padding ; return 12
when :win_x ; return 0
when :win_y ; return 0
when :wait ; return 0
when :font_name ; return Font.default_name
when :font_size ; return Font.default_size
when :font_color ; return Font.default_color
when :font_out_color ; return Font.default_out_color
when :font_bold ; return Font.default_bold
when :font_shadow ; return Font.default_shadow
when :name ; return ""
when :skin ; return "Window"
end
end
end
alias xail_msg_winmsg_upd_placement update_placement
def update_placement(*args, &block)
# // Method to update placement.
xail_msg_winmsg_upd_placement(*args, &block)
self.width = window_width
self.height = window_height
self.x = window_x
self.y = window_y
create_contents
end
def fiber_main
# // Method override for fiber main.
$game_message.visible = true
update_background
update_placement
loop do
process_all_text if $game_message.has_text?
process_input
$game_message.clear
@gold_window.close
dispose_face
dispose_name
Fiber.yield
break unless text_continue?
end
close_and_wait
$game_message.visible = false
@fiber = nil
end
def draw_message_face
# // Method to draw face window.
unless $game_message.face_name.empty?
x = window_x - 44
@face_window = Window_Message_Face.new(x, window_y, 128, 128)
@face_window.z = 201
@face_window.opacity = 0
if XAIL::MSG::ANIM_FACE[0]
case XAIL::MSG::ANIM_FACE[1]
when :fade
@face_window.contents_opacity = 0
fade(XAIL::MSG::ANIM_FACE[2], @face_window, :in)
end
end
end
end
def draw_message_name
# // Method to draw name window.
name = get_var(XAIL::MSG::WINDOW_VAR[12], :name)
unless name == ""
w = text_size(name).width + 24
x = window_x + 16
@name_window = Window_Message_Name.new(name, x, window_y - 31, w, 34)
@name_window.z = 199
if XAIL::MSG::ANIM_NAME[0]
case XAIL::MSG::ANIM_NAME[1]
when :fade
@name_window.opacity = @name_window.contents_opacity = 0
fade(XAIL::MSG::ANIM_NAME[2], @name_window, :in, true, true)
end
end
end
end
alias xail_msg_winmsg_process_normal_character process_normal_character
def process_normal_character(c, pos)
# // Method to set a wait time for each processed character.
# This will also play a SE based on if the pos is a odd number.
xail_msg_winmsg_process_normal_character(c, pos)
wait(get_var(XAIL::MSG::WINDOW_VAR[5], :wait))
if (pos[:x] % XAIL::MSG::SE[0] > 0)
Sound.play(XAIL::MSG::SE[1], XAIL::MSG::SE[2], XAIL::MSG::SE[3]) unless XAIL::MSG::SE.nil?
end
end
alias xail_msg_winmsg_open_and_wait open_and_wait
def open_and_wait(*args, &block)
# // Method for open and wait.
xail_msg_winmsg_open_and_wait(*args, &block)
draw_message_face ; draw_message_name
end
def new_page(text, pos)
# // Method override for new page.
contents.clear
contents.font.name = get_var(XAIL::MSG::WINDOW_VAR[6], :font_name)
contents.font.size = get_var(XAIL::MSG::WINDOW_VAR[7], :font_size)
contents.font.color = get_var(XAIL::MSG::WINDOW_VAR[8], :font_color)
contents.font.out_color = get_var(XAIL::MSG::WINDOW_VAR[9], :font_out_color)
contents.font.bold = eval(get_var(XAIL::MSG::WINDOW_VAR[10], :font_bold)) unless $game_variables[XAIL::MSG::WINDOW_VAR[10]] == 0
contents.font.shadow = eval(get_var(XAIL::MSG::WINDOW_VAR[11], :font_shadow)) unless $game_variables[XAIL::MSG::WINDOW_VAR[11]] == 0
pos[:x] = new_line_x
pos[:y] = 0
pos[:new_x] = new_line_x
pos[:height] = calc_line_height(text)
clear_flags
end
def new_line_x
# // Method for new line x pos.
$game_message.face_name.empty? ? 0 : @face_window.width / 2 + 4
end
def input_choice
# // Method to start the input choice.
@choice_window.start
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
@choice_window.windowskin = Cache.system(skin)
@choice_window.opacity = 255
Fiber.yield while @choice_window.active
end
def input_number
# // Method to start the input number.
@number_window.start
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
@number_window.windowskin = Cache.system(skin)
@number_window.opacity = 255
Fiber.yield while @number_window.active
end
def fade(max, window, type, con_op = true, op = false)
# // Method to fade in/out the windows opacity and/or contents_opacity.
return if window.is_a?(Array)
case type
when :in
for i in 1..max
Graphics.update
window.contents_opacity = i * (255 / max) if con_op
window.opacity = i * (255 / max) if op
end
when :out
for i in 1..max
Graphics.update
window.contents_opacity = 255 - i * (255 / max) if con_op
window.opacity = 255 - i * (255 / max) if op
end
end
end
def dispose_face
# // Method to dispose face window.
unless @face_window.nil? or @face_window.is_a?(Array)
if XAIL::MSG::ANIM_FACE[0]
case XAIL::MSG::ANIM_FACE[1]
when :fade
fade(XAIL::MSG::ANIM_FACE[3], @face_window, :out)
end
end
@face_window = nil, @face_window.dispose
end
end
def dispose_name
# // Method to dispose name window.
unless @name_window.nil? or @name_window.is_a?(Array)
if XAIL::MSG::ANIM_NAME[0]
case XAIL::MSG::ANIM_NAME[1]
when :fade
fade(XAIL::MSG::ANIM_NAME[3], @name_window, :out)
end
end
@name_window = nil, @name_window.dispose
end
end
end
#==============================================================================#
# ** Scene_Map
#==============================================================================#
class Scene_Map < Scene_Base
def set_message_skin
# // Method to set message window skin.
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
@message_window.windowskin = Cache.system(skin)
end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
# XS - Message
# Author: Nicke
# Created: 08/11/2012
# Edited: 19/11/2012
# Version: 1.0b
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#==============================================================================
# Requires: XS - Core Script.
#==============================================================================
# A message system based on using variables ingame.
# If the variable has the value 0 the default value will take place.
# To setup a simple message dialog do as you would normally do when adding
# text in events but before it set the variables you want to change.
#
# When changing width and height you should know that height is visible
# line numbers which means the numbers 1 to 4 is prefered to use.
#
# Example:
# You could set the width to 544 and height to 4 which is pretty much how
# the default message window looks like.
#
# This script also support sound effect to be played each time a character is
# processed. Can be tweaked in the settings.
#
# When setting variables for bold, shadow, namebox and skin etc. Remember to use
# the script area in the variable.
#
# If I wanted to enable bold and setting a custom skin I would do this:
# Set the value "true" in the script section for variable 41.
# Set the value "Window" in the script section for variable 44.
#
# Note: When changing the message window skin you must use this method after
# setting the variable in order to properly update to the new skin:
# SceneManager.scene.set_message_skin
#
# Example:
# So after setting variable 44 (default one) to "Window3" call that method.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-MESSAGE-SYSTEM"] = true
module XAIL
module MSG
#--------------------------------------------------------------------------#
# * Settings
#--------------------------------------------------------------------------#
# Set the window variables.
# WINDOW_VAR = [width, height, padding, x, y, delay,
# font_name, font_size, font_color, outline, bold, shadow, namebox, skin]
WINDOW_VAR = [31,32,33,34,35,36,37,38,39,40,41,42,43,44]
# Set the window open/close animation in frames.
# WINDOW_ANIMATE = [openness, closeness]
WINDOW_ANIMATE = [15, 15]
# Name box options.
# NAME = [font, size, color, bold, shadow]
NAME = [["Verdana", "Anklada™"], 14, Color.new(255,225,235,225), true, true]
# Set the sound for when the characters are processing.
# The sound effect will be played each time the occurence is met.
# From the default it will happen every odd processed character.
# Can be set to nil to disable.
# SE = [occurence, name, vol, pitch]
SE = [2, "Decision1", 60, 150]
# Set the animation options for face window.
# For type only :fade exists at the moment.
# ANIM_FACE = [enabled, type, animation_speed_in, animation_speed_out]
ANIM_FACE = [true, :fade, 12, 8]
# Set the animation options for name window.
# For type only :fade exists at the moment.
# ANIM_NAME = [animation_speed_in, animation_speed_out]
ANIM_NAME = [true, :fade, 12, 8]
end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Error Handler
#==============================================================================#
unless $imported["XAIL-XS-CORE"]
# // Error handler when XS - Core is not installed.
msg = "The script %s requires the latest version of XS - Core in order to function properly."
name = "XS - Message"
msgbox(sprintf(msg, name))
exit
end
#==============================================================================#
# ** Window_Base
#==============================================================================#
class Window_Base < Window
alias xail_msg_winbase_upd_open update_open
def update_open(*args, &block)
# // Method to update openness
# This should only occur when $game_message is visible.
if $game_message.visible
self.openness += XAIL::MSG::WINDOW_ANIMATE[0]
self.opacity = self.openness unless self.opacity == 0
self.back_opacity = self.openness unless self.opacity == 0
@opening = false if open?
else
xail_msg_winbase_upd_open(*args, &block)
end
end
alias xail_msg_winbase_upd_close update_close
def update_close(*args, &block)
# // Method override to update closeness.
# This should only occur when $game_message is visible.
if $game_message.visible
self.openness -= XAIL::MSG::WINDOW_ANIMATE[1]
self.opacity = self.openness unless self.opacity == 0
self.back_opacity = self.openness unless self.opacity == 0
@closing = false if close?
else
xail_msg_winbase_upd_close(*args, &block)
end
end
end
#==============================================================================#
# ** Window_Message_Face
#==============================================================================#
class Window_Message_Face < Window_Base
def initialize(x, y, width, height)
# // Method to initialize.
super(x, y, width, height)
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
self.windowskin = Cache.system(skin)
refresh
end
def refresh
# // Method to refresh.
contents.clear
r = Rect.new(0, 0, width, height)
r2 = Rect.new(2, 2, width-28, height-28)
contents.fill_rect(r, Color.new(75,125,135,245))
contents.gradient_fill_rect(r2, Color.new(125,125,125,255), Color.new(0,0,0,255), false)
draw_face($game_message.face_name, $game_message.face_index, 4, 4)
end
end
#==============================================================================#
# ** Window_Message_Name
#==============================================================================#
class Window_Message_Name < Window_Base
def initialize(name, x, y, width, height)
# // Method to initialize.
super(x, y, width, height)
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
self.windowskin = Cache.system(skin)
@name = name
refresh
end
def standard_padding
# // Method to set standard padding
return 4
end
def name=(name)
# // Method to refresh and set name.
return if @name == name
@name = name
refresh
end
def refresh
# // Method to refresh.
contents.clear
draw_font_text(@name, 0, 0, contents_width, 1, XAIL::MSG::NAME[0], XAIL::MSG::NAME[1], XAIL::MSG::NAME[2])
end
end
#==============================================================================#
# ** Window_Message
#==============================================================================#
class Window_Message < Window_Base
def initialize
# // Method override initialize for window message.
super(0, 0, window_width, window_height)
self.z = 200
self.openness = 0
create_all_windows
create_back_bitmap
create_back_sprite
clear_instance_variables
set_window_skins
end
def set_window_skins
# // Method to set window skins.
@gold_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
@choice_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
@number_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
@item_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
end
#~ alias xail_msg_winmsg_create_all_windows create_all_windows
#~ def create_all_windows(*args, &block)
#~ # // Method to create all windows.
#~ xail_msg_winmsg_create_all_windows(*args, &block)
#~ @choice_window = Window_ChoiceList.new(self)
#~ @number_window = Window_NumberInput.new(self)
#~ @item_window = Window_KeyItem.new(self)
#~ @choice_window.windowskin
#~ end
def window_width
# // Method override to return width.
get_var(XAIL::MSG::WINDOW_VAR[0], :width)
end
def window_height
# // Method override to return height.
fitting_height(get_var(XAIL::MSG::WINDOW_VAR[1], :height))
end
def standard_padding
# // Method to return the padding.
get_var(XAIL::MSG::WINDOW_VAR[2], :padding)
end
def window_x
# // Method to return x value of window.
get_var(XAIL::MSG::WINDOW_VAR[3], :win_x)
end
def window_y
# // Method to return y value of window.
get_var(XAIL::MSG::WINDOW_VAR[4], :win_y)
end
def get_var(var, type)
# // Method to return variable value if conditions met.
unless var.nil? or $game_variables[var] == 0
return $game_variables[var]
else
case type
when :width ; return Graphics.width
when :height ; return visible_line_number
when :padding ; return 12
when :win_x ; return 0
when :win_y ; return 0
when :wait ; return 0
when :font_name ; return Font.default_name
when :font_size ; return Font.default_size
when :font_color ; return Font.default_color
when :font_out_color ; return Font.default_out_color
when :font_bold ; return Font.default_bold
when :font_shadow ; return Font.default_shadow
when :name ; return ""
when :skin ; return "Window"
end
end
end
alias xail_msg_winmsg_upd_placement update_placement
def update_placement(*args, &block)
# // Method to update placement.
xail_msg_winmsg_upd_placement(*args, &block)
self.width = window_width
self.height = window_height
self.x = window_x
self.y = window_y
create_contents
end
def fiber_main
# // Method override for fiber main.
$game_message.visible = true
update_background
update_placement
loop do
process_all_text if $game_message.has_text?
process_input
$game_message.clear
@gold_window.close
dispose_face
dispose_name
Fiber.yield
break unless text_continue?
end
close_and_wait
$game_message.visible = false
@fiber = nil
end
def draw_message_face
# // Method to draw face window.
unless $game_message.face_name.empty?
x = window_x - 44
@face_window = Window_Message_Face.new(x, window_y, 128, 128)
@face_window.z = 201
@face_window.opacity = 0
if XAIL::MSG::ANIM_FACE[0]
case XAIL::MSG::ANIM_FACE[1]
when :fade
@face_window.contents_opacity = 0
fade(XAIL::MSG::ANIM_FACE[2], @face_window, :in)
end
end
end
end
def draw_message_name
# // Method to draw name window.
name = get_var(XAIL::MSG::WINDOW_VAR[12], :name)
unless name == ""
w = text_size(name).width + 24
x = window_x + 16
@name_window = Window_Message_Name.new(name, x, window_y - 31, w, 34)
@name_window.z = 199
if XAIL::MSG::ANIM_NAME[0]
case XAIL::MSG::ANIM_NAME[1]
when :fade
@name_window.opacity = @name_window.contents_opacity = 0
fade(XAIL::MSG::ANIM_NAME[2], @name_window, :in, true, true)
end
end
end
end
alias xail_msg_winmsg_process_normal_character process_normal_character
def process_normal_character(c, pos)
# // Method to set a wait time for each processed character.
# This will also play a SE based on if the pos is a odd number.
xail_msg_winmsg_process_normal_character(c, pos)
wait(get_var(XAIL::MSG::WINDOW_VAR[5], :wait))
if (pos[:x] % XAIL::MSG::SE[0] > 0)
Sound.play(XAIL::MSG::SE[1], XAIL::MSG::SE[2], XAIL::MSG::SE[3]) unless XAIL::MSG::SE.nil?
end
end
alias xail_msg_winmsg_open_and_wait open_and_wait
def open_and_wait(*args, &block)
# // Method for open and wait.
xail_msg_winmsg_open_and_wait(*args, &block)
draw_message_face ; draw_message_name
end
def new_page(text, pos)
# // Method override for new page.
contents.clear
contents.font.name = get_var(XAIL::MSG::WINDOW_VAR[6], :font_name)
contents.font.size = get_var(XAIL::MSG::WINDOW_VAR[7], :font_size)
contents.font.color = get_var(XAIL::MSG::WINDOW_VAR[8], :font_color)
contents.font.out_color = get_var(XAIL::MSG::WINDOW_VAR[9], :font_out_color)
contents.font.bold = eval(get_var(XAIL::MSG::WINDOW_VAR[10], :font_bold)) unless $game_variables[XAIL::MSG::WINDOW_VAR[10]] == 0
contents.font.shadow = eval(get_var(XAIL::MSG::WINDOW_VAR[11], :font_shadow)) unless $game_variables[XAIL::MSG::WINDOW_VAR[11]] == 0
pos[:x] = new_line_x
pos[:y] = 0
pos[:new_x] = new_line_x
pos[:height] = calc_line_height(text)
clear_flags
end
def new_line_x
# // Method for new line x pos.
$game_message.face_name.empty? ? 0 : @face_window.width / 2 + 4
end
def input_choice
# // Method to start the input choice.
@choice_window.start
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
@choice_window.windowskin = Cache.system(skin)
@choice_window.opacity = 255
Fiber.yield while @choice_window.active
end
def input_number
# // Method to start the input number.
@number_window.start
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
@number_window.windowskin = Cache.system(skin)
@number_window.opacity = 255
Fiber.yield while @number_window.active
end
def fade(max, window, type, con_op = true, op = false)
# // Method to fade in/out the windows opacity and/or contents_opacity.
return if window.is_a?(Array)
case type
when :in
for i in 1..max
Graphics.update
window.contents_opacity = i * (255 / max) if con_op
window.opacity = i * (255 / max) if op
end
when :out
for i in 1..max
Graphics.update
window.contents_opacity = 255 - i * (255 / max) if con_op
window.opacity = 255 - i * (255 / max) if op
end
end
end
def dispose_face
# // Method to dispose face window.
unless @face_window.nil? or @face_window.is_a?(Array)
if XAIL::MSG::ANIM_FACE[0]
case XAIL::MSG::ANIM_FACE[1]
when :fade
fade(XAIL::MSG::ANIM_FACE[3], @face_window, :out)
end
end
@face_window = nil, @face_window.dispose
end
end
def dispose_name
# // Method to dispose name window.
unless @name_window.nil? or @name_window.is_a?(Array)
if XAIL::MSG::ANIM_NAME[0]
case XAIL::MSG::ANIM_NAME[1]
when :fade
fade(XAIL::MSG::ANIM_NAME[3], @name_window, :out)
end
end
@name_window = nil, @name_window.dispose
end
end
end
#==============================================================================#
# ** Scene_Map
#==============================================================================#
class Scene_Map < Scene_Base
def set_message_skin
# // Method to set message window skin.
skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
@message_window.windowskin = Cache.system(skin)
end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
(Seconda parte del message system)
Spoiler
#==============================================================================
# XaiL System - Core
# Author: Nicke
# Created: 07/01/2012
# Edited: 08/10/2013
# Version: 2.1f
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# Core script for XaiL System.
# Caution! This needs to be located before any other XS scripts.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-XS-CORE"] = true
module Colors
#--------------------------------------------------------------------------#
# * Colors
#--------------------------------------------------------------------------#
White = Color.new(255,255,255)
LightRed = Color.new(255,150,150)
LightGreen = Color.new(150,255,150)
LightBlue = Color.new(150,150,255)
DarkYellow = Color.new(225,225,20)
Alpha = Color.new(0,0,0,128)
AlphaMenu = 100
end
module XAIL
module CORE
#--------------------------------------------------------------------------#
# * Settings
#--------------------------------------------------------------------------#
# Graphics.resize_screen(width, height )
Graphics.resize_screen(544,416)
# FONT DEFAULTS:
Font.default_name = ["VL Gothic"]
Font.default_size = 20
Font.default_bold = false
Font.default_italic = false
Font.default_shadow = true
Font.default_outline = true
Font.default_color = Colors::White
Font.default_out_color = Colors::Alpha
# USE_TONE = true/false:
# Window tone for all windows ingame. Default: true.
USE_TONE = false
# SAVE
SAVE_MAX = 20 # Default 16.
SAVE_FILE_VIS = 4 # Default 4.
# JAPANESE = true/false
JAPANESE = false
end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Game_System
#==============================================================================#
class Game_System
# // Method to determine japanese game.
def japanese? ; return XAIL::CORE::JAPANESE ; end
end
#==============================================================================#
# ** String
#==============================================================================#
class String
def to_class(parent = Kernel)
# // Method to convert string to class.
chain = self.split "::"
klass = parent.const_get chain.shift
return chain.size < 1 ? (klass.is_a?(Class) ? klass : nil) : chain.join("::").to_class(klass)
rescue
nil
end
def cap_words
# // Method to capitalize every word.
self.split(' ').map {|w| w.capitalize }.join(' ')
end
def slice_char(char)
# // Method to slice char.
self.split(char).map {|w| w.sub(char, " ") }.join(" ")
end
end
#==============================================================================#
# ** Vocab
#==============================================================================#
class << Vocab
def xparam(id)
# // Method to return xparam name.
case id
when 0 ; "Hit Chance"
when 1 ; "Evasion"
when 2 ; "Critical Chance"
when 3 ; "Critical Evasion"
when 4 ; "Magic Evasion"
when 5 ; "Magic Reflection"
when 6 ; "Counter Attack"
when 7 ; "HP Regeneration"
when 8 ; "MP Regeneration"
when 9 ; "TP Regeneration"
end
end
end
#==============================================================================
# ** Sound
#==============================================================================
class << Sound
def play(name, volume, pitch, type = :se)
# // Method to play a sound. If specified name isn't valid throw an error.
case type
when :se ; RPG::SE.new(name, volume, pitch).play rescue valid?(name)
when :me ; RPG::ME.new(name, volume, pitch).play rescue valid?(name)
when :bgm ; RPG::BGM.new(name, volume, pitch).play rescue valid?(name)
when :bgs ; RPG::BGS.new(name, volume, pitch).play rescue valid?(name)
end
end
def valid?(name)
# // Method to raise error if specified sound name is invalid.
msgbox("Error. Unable to find sound file: " + name)
exit
end
end
#==============================================================================
# ** DataManager
#==============================================================================
class << DataManager
def savefile_max
# // Method override, save file max.
return XAIL::CORE::SAVE_MAX
end
end
#==============================================================================
# ** SceneManager
#==============================================================================
class << SceneManager
def call_ext(scene_class, args = nil)
# // Method to call a scene with arguments.
@stack.push(@scene)
@scene = scene_class.new(args)
end
end
#==============================================================================
# ** Scene_File
#==============================================================================
class Scene_File < Scene_MenuBase
def visible_max
# // Method override, visible_max for save files.
return XAIL::CORE::SAVE_FILE_VIS
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# Importing font fix that will remove weird characters.
# Adding new methods such as new gauge, actor param, font text, icon drawing,
# big icon drawing and a line with a shadow.
#==============================================================================
class Window_Base < Window
# // Importing Custom font fix. (Credit Lone Wolf).
alias :process_normal_character_vxa :process_normal_character
def process_normal_character(c, pos)
return unless c >= ' '
process_normal_character_vxa(c, pos)
end unless method_defined? :process_normal_character
def draw_text_ex_no_reset(x, y, text)
# // Method to draw ex text without resetting the font.
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
alias xail_core_winbase_upt_tone update_tone
def update_tone(*args, &block)
# // Method to change tone of the window.
return unless XAIL::CORE::USE_TONE
xail_core_winbase_upt_tone(*args, &block)
end
def draw_gauge_ex(x, y, width, height, rate, color1, color2)
# // Method to draw a gauge.
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x, gauge_y, width + 1, height + 1, Color.new(255,255,255,64))
contents.fill_rect(x, gauge_y, width, height, Color.new(0,0,0,100))
contents.gradient_fill_rect(x, gauge_y, fill_w, height, color1, color2)
end
def draw_actor_param_gauge(actor, x, y, width, param_id, font, size, bar_color1, bar_color2, txt_color1, txt_color2)
# // Method to draw actor parameters with a gauge.
case param_id
when 2 ; param_rate = actor.param(2) / actor.param_max(2).to_f
when 3 ; param_rate = actor.param(3) / actor.param_max(3).to_f
when 4 ; param_rate = actor.param(4) / actor.param_max(4).to_f
when 5 ; param_rate = actor.param(5) / actor.param_max(5).to_f
when 6 ; param_rate = actor.param(6) / actor.param_max(6).to_f
when 7 ; param_rate = actor.param(7) / actor.param_max(7).to_f
end
contents.font.name = font
contents.font.size = size
contents.font.bold = true
contents.font.shadow = false
draw_gauge_ex(x, y - 14, width, 20, param_rate, bar_color1, bar_color2)
contents.font.color = txt_color1
draw_text(x + 10, y, 120, line_height, Vocab::param(param_id))
contents.font.color = txt_color2
draw_text(x + width - 38, y, 36, line_height, actor.param(param_id), 2)
reset_font_settings
end
def draw_actor_xparam_gauge(actor, x, y, width, xparam_id, font, size, bar_color1, bar_color2, txt_color1, txt_color2)
# // Method to draw actor xparameters with a gauge.
case xparam_id
when 0
xparam_rate = actor.xparam(0) / 100.to_f
xparam_name = Vocab.xparam(0)
when 1
xparam_rate = actor.xparam(1) / 100.to_f
xparam_name = Vocab.xparam(1)
when 2
xparam_rate = actor.xparam(2) / 100.to_f
xparam_name = Vocab.xparam(2)
when 3
xparam_rate = actor.xparam(3) / 100.to_f
xparam_name = Vocab.xparam(3)
when 4
xparam_rate = actor.xparam(4) / 100.to_f
xparam_name = Vocab.xparam(4)
when 5
xparam_rate = actor.xparam(5) / 100.to_f
xparam_name = Vocab.xparam(5)
when 6
xparam_rate = actor.xparam(6) / 100.to_f
xparam_name = Vocab.xparam(6)
when 7
xparam_rate = actor.xparam(7) / 100.to_f
xparam_name = Vocab.xparam(7)
when 8
xparam_rate = actor.xparam(8) / 100.to_f
xparam_name = Vocab.xparam(8)
when 9
xparam_rate = actor.xparam(9) / 100.to_f
xparam_name = Vocab.xparam(9)
end
contents.font.name = font
contents.font.size = size
contents.font.bold = true
contents.font.shadow = false
draw_gauge_ex(x, y - 14, width, 20, xparam_rate, bar_color1, bar_color2)
contents.font.color = txt_color1
draw_text(x + 10, y, 120, line_height, xparam_name)
contents.font.color = txt_color2
draw_text(x + width - 38, y, 36, line_height, "#{actor.xparam(xparam_id)}%", 2)
reset_font_settings
end
def draw_line_ex(x, y, color, shadow)
# // Method to draw a horizontal line with a shadow.
line_y = y + line_height / 2 - 1
contents.fill_rect(x, line_y, contents_width, 2, color)
line_y += 1
contents.fill_rect(x, line_y, contents_width, 2, shadow)
end
def draw_box(x, y, width, height, color, shadow)
# // Method to draw a box with shadow.
contents.fill_rect(x, y, width, height, color)
x += 1
y += 1
contents.fill_rect(x, y, width, height, shadow)
end
def draw_vertical_line_ex(x, y, color, shadow)
# // Method to draw a vertical line with a shadow.
line_x = x + line_height / 2 - 1
contents.fill_rect(line_x, y, 2, contents_height, color)
line_x += 1
contents.fill_rect(line_x, y, 2, contents_height, shadow)
end
def draw_icons(icons, alignment, x = 0, y = 0, offset_icon = [])
# // Method to draw icons in a horizonal or vertical alignment.
icons.each {|icon|
next if icon.nil?
# // If included in offset do extra spacing.
offset_icon.each {|offset|
if icon == offset
y += line_height * 1 if alignment == :vertical
x += line_height * 1 if alignment == :horizontal
end
}
draw_icon(icon.nil? ? nil : icon, x.nil? ? 0 : x, y.nil? ? 0 : y) rescue nil
y += line_height if alignment == :vertical
x += line_height if alignment == :horizontal
}
end
def draw_big_icon(icon, x, y, width, height, opacity = 255)
# // Method to draw a big icon.
bitmap = Cache.system("Iconset")
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
rect2 = Rect.new(x, y, width, height)
contents.stretch_blt(rect2, bitmap, rect, opacity)
end
def draw_font_text(text, x, y, width, alignment, font, size, color, bold = true, shadow = true)
# // Method to draw font text.
contents.font.name = font
contents.font.size = size
contents.font.color = color
contents.font.bold = bold
contents.font.shadow = shadow
contents.font.out_color = Color.new(0,0,0,255)
draw_text(x, y, width, calc_line_height(text), text, alignment)
reset_font_settings
end
def draw_font_text_ex(text, x, y, font, size, color, bold = true, shadow = true)
# // Method to draw font text ex.
contents.font.name = font
contents.font.size = size
contents.font.color = color
contents.font.bold = bold
contents.font.shadow = shadow
contents.font.out_color = Color.new(0,0,0,255)
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
reset_font_settings
end
end
#==============================================================================#
# ** Window_Selectable
#------------------------------------------------------------------------------
# Adding support for pageleft and pageright for window selectable.
#==============================================================================#
class Window_Selectable < Window_Base
def cursor_pageright ; end
def cursor_pageleft ; end
alias xail_core_winselect_process_cursor_move process_cursor_move
def process_cursor_move(*args, &block)
# // Method to process cursor movement.
xail_core_winselect_process_cursor_move(*args, &block)
cursor_pageright if !handle?(:pageright) && Input.trigger?(:RIGHT)
cursor_pageright if !handle?(:pageleft) && Input.trigger?(:LEFT)
end
alias xail_core_winselect_process_handling process_handling
def process_handling(*args, &block)
# // Method to process handling.
xail_core_winselect_process_handling(*args, &block)
return process_pageright if handle?(:pageright) && Input.trigger?(:RIGHT)
return process_pageleft if handle?(:pageleft) && Input.trigger?(:LEFT)
end
def process_pageright
# // Method to process page right.
Sound.play_cursor
Input.update
deactivate
call_handler(:pageright)
end
def process_pageleft
# // Method to process page left.
Sound.play_cursor
Input.update
deactivate
call_handler(:pageleft)
end
end
#==============================================================================#
# ** Window_Icon
#------------------------------------------------------------------------------
# New Window :: Window_Icon - A window for drawing icon(s).
#==============================================================================#
class Window_Icon < Window_Base
attr_accessor :enabled
attr_accessor :alignment
def initialize(x, y, window_width, hsize)
# // Method to initialize the icon window.
super(0, 0, window_width, window_height(hsize))
@icons = []
@index = 0
@enabled = true
@alignment = 0
refresh
end
def window_height(hsize)
# // Method to return the height.
fitting_height(hsize)
end
def refresh
# // Method to refresh the icon window.
contents.clear
end
def draw_cmd_icons(icons, index)
# // Draw all of the icons.
return if !@enabled
count = 0
for i in icons
align = 0
x = 110
next if i[index].nil?
case @alignment
when 1, 2 ; align = -110
end
draw_icon(i[index], x + align, 24 * count)
count += 1
break if (24 * count > height - 24)
end
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Adding check item method to return a item based on the type.
#==============================================================================
class Game_Party < Game_Unit
def check_item?(item, type)
# // Method to return a item based on the type.
case type
when :items ; $data_items[item]
when :weapons ; $data_weapons[item]
when :armors ; $data_armors[item]
when :gold ; item
when :exp ; item
end
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# Adding methods to check for comments on events.
#==============================================================================
class Game_Event < Game_Character
def comment?(comment)
# // Method to check if comment is included in event.
unless empty? or @list.nil?
for evt in @list
if evt.code == 108 or evt.code == 408
if evt.parameters[0].include?(comment)
return true
end
end
end
end
return false
end
def comment_int?(comment)
# // Method to check for a integer in event.
unless empty? or @list.nil?
for evt in @list
if evt.code == 108 or evt.code == 408
if evt.parameters[0] =~ /<#{comment}:[ ]?(\d*)>?/
return ($1.to_i > 0 ? $1.to_i : 0)
end
end
end
end
end
def comment_string?(comment)
# // Method to check for a string in event.
unless empty? or @list.nil?
for evt in @list
if evt.code == 108 or evt.code == 408
if evt.parameters[0] =~ /<#{comment}:[ ]?(\w*)>?/
return $1.to_s
end
end
end
end
end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*
# XaiL System - Core
# Author: Nicke
# Created: 07/01/2012
# Edited: 08/10/2013
# Version: 2.1f
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# Core script for XaiL System.
# Caution! This needs to be located before any other XS scripts.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-XS-CORE"] = true
module Colors
#--------------------------------------------------------------------------#
# * Colors
#--------------------------------------------------------------------------#
White = Color.new(255,255,255)
LightRed = Color.new(255,150,150)
LightGreen = Color.new(150,255,150)
LightBlue = Color.new(150,150,255)
DarkYellow = Color.new(225,225,20)
Alpha = Color.new(0,0,0,128)
AlphaMenu = 100
end
module XAIL
module CORE
#--------------------------------------------------------------------------#
# * Settings
#--------------------------------------------------------------------------#
# Graphics.resize_screen(width, height )
Graphics.resize_screen(544,416)
# FONT DEFAULTS:
Font.default_name = ["VL Gothic"]
Font.default_size = 20
Font.default_bold = false
Font.default_italic = false
Font.default_shadow = true
Font.default_outline = true
Font.default_color = Colors::White
Font.default_out_color = Colors::Alpha
# USE_TONE = true/false:
# Window tone for all windows ingame. Default: true.
USE_TONE = false
# SAVE
SAVE_MAX = 20 # Default 16.
SAVE_FILE_VIS = 4 # Default 4.
# JAPANESE = true/false
JAPANESE = false
end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Game_System
#==============================================================================#
class Game_System
# // Method to determine japanese game.
def japanese? ; return XAIL::CORE::JAPANESE ; end
end
#==============================================================================#
# ** String
#==============================================================================#
class String
def to_class(parent = Kernel)
# // Method to convert string to class.
chain = self.split "::"
klass = parent.const_get chain.shift
return chain.size < 1 ? (klass.is_a?(Class) ? klass : nil) : chain.join("::").to_class(klass)
rescue
nil
end
def cap_words
# // Method to capitalize every word.
self.split(' ').map {|w| w.capitalize }.join(' ')
end
def slice_char(char)
# // Method to slice char.
self.split(char).map {|w| w.sub(char, " ") }.join(" ")
end
end
#==============================================================================#
# ** Vocab
#==============================================================================#
class << Vocab
def xparam(id)
# // Method to return xparam name.
case id
when 0 ; "Hit Chance"
when 1 ; "Evasion"
when 2 ; "Critical Chance"
when 3 ; "Critical Evasion"
when 4 ; "Magic Evasion"
when 5 ; "Magic Reflection"
when 6 ; "Counter Attack"
when 7 ; "HP Regeneration"
when 8 ; "MP Regeneration"
when 9 ; "TP Regeneration"
end
end
end
#==============================================================================
# ** Sound
#==============================================================================
class << Sound
def play(name, volume, pitch, type = :se)
# // Method to play a sound. If specified name isn't valid throw an error.
case type
when :se ; RPG::SE.new(name, volume, pitch).play rescue valid?(name)
when :me ; RPG::ME.new(name, volume, pitch).play rescue valid?(name)
when :bgm ; RPG::BGM.new(name, volume, pitch).play rescue valid?(name)
when :bgs ; RPG::BGS.new(name, volume, pitch).play rescue valid?(name)
end
end
def valid?(name)
# // Method to raise error if specified sound name is invalid.
msgbox("Error. Unable to find sound file: " + name)
exit
end
end
#==============================================================================
# ** DataManager
#==============================================================================
class << DataManager
def savefile_max
# // Method override, save file max.
return XAIL::CORE::SAVE_MAX
end
end
#==============================================================================
# ** SceneManager
#==============================================================================
class << SceneManager
def call_ext(scene_class, args = nil)
# // Method to call a scene with arguments.
@stack.push(@scene)
@scene = scene_class.new(args)
end
end
#==============================================================================
# ** Scene_File
#==============================================================================
class Scene_File < Scene_MenuBase
def visible_max
# // Method override, visible_max for save files.
return XAIL::CORE::SAVE_FILE_VIS
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# Importing font fix that will remove weird characters.
# Adding new methods such as new gauge, actor param, font text, icon drawing,
# big icon drawing and a line with a shadow.
#==============================================================================
class Window_Base < Window
# // Importing Custom font fix. (Credit Lone Wolf).
alias :process_normal_character_vxa :process_normal_character
def process_normal_character(c, pos)
return unless c >= ' '
process_normal_character_vxa(c, pos)
end unless method_defined? :process_normal_character
def draw_text_ex_no_reset(x, y, text)
# // Method to draw ex text without resetting the font.
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
alias xail_core_winbase_upt_tone update_tone
def update_tone(*args, &block)
# // Method to change tone of the window.
return unless XAIL::CORE::USE_TONE
xail_core_winbase_upt_tone(*args, &block)
end
def draw_gauge_ex(x, y, width, height, rate, color1, color2)
# // Method to draw a gauge.
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x, gauge_y, width + 1, height + 1, Color.new(255,255,255,64))
contents.fill_rect(x, gauge_y, width, height, Color.new(0,0,0,100))
contents.gradient_fill_rect(x, gauge_y, fill_w, height, color1, color2)
end
def draw_actor_param_gauge(actor, x, y, width, param_id, font, size, bar_color1, bar_color2, txt_color1, txt_color2)
# // Method to draw actor parameters with a gauge.
case param_id
when 2 ; param_rate = actor.param(2) / actor.param_max(2).to_f
when 3 ; param_rate = actor.param(3) / actor.param_max(3).to_f
when 4 ; param_rate = actor.param(4) / actor.param_max(4).to_f
when 5 ; param_rate = actor.param(5) / actor.param_max(5).to_f
when 6 ; param_rate = actor.param(6) / actor.param_max(6).to_f
when 7 ; param_rate = actor.param(7) / actor.param_max(7).to_f
end
contents.font.name = font
contents.font.size = size
contents.font.bold = true
contents.font.shadow = false
draw_gauge_ex(x, y - 14, width, 20, param_rate, bar_color1, bar_color2)
contents.font.color = txt_color1
draw_text(x + 10, y, 120, line_height, Vocab::param(param_id))
contents.font.color = txt_color2
draw_text(x + width - 38, y, 36, line_height, actor.param(param_id), 2)
reset_font_settings
end
def draw_actor_xparam_gauge(actor, x, y, width, xparam_id, font, size, bar_color1, bar_color2, txt_color1, txt_color2)
# // Method to draw actor xparameters with a gauge.
case xparam_id
when 0
xparam_rate = actor.xparam(0) / 100.to_f
xparam_name = Vocab.xparam(0)
when 1
xparam_rate = actor.xparam(1) / 100.to_f
xparam_name = Vocab.xparam(1)
when 2
xparam_rate = actor.xparam(2) / 100.to_f
xparam_name = Vocab.xparam(2)
when 3
xparam_rate = actor.xparam(3) / 100.to_f
xparam_name = Vocab.xparam(3)
when 4
xparam_rate = actor.xparam(4) / 100.to_f
xparam_name = Vocab.xparam(4)
when 5
xparam_rate = actor.xparam(5) / 100.to_f
xparam_name = Vocab.xparam(5)
when 6
xparam_rate = actor.xparam(6) / 100.to_f
xparam_name = Vocab.xparam(6)
when 7
xparam_rate = actor.xparam(7) / 100.to_f
xparam_name = Vocab.xparam(7)
when 8
xparam_rate = actor.xparam(8) / 100.to_f
xparam_name = Vocab.xparam(8)
when 9
xparam_rate = actor.xparam(9) / 100.to_f
xparam_name = Vocab.xparam(9)
end
contents.font.name = font
contents.font.size = size
contents.font.bold = true
contents.font.shadow = false
draw_gauge_ex(x, y - 14, width, 20, xparam_rate, bar_color1, bar_color2)
contents.font.color = txt_color1
draw_text(x + 10, y, 120, line_height, xparam_name)
contents.font.color = txt_color2
draw_text(x + width - 38, y, 36, line_height, "#{actor.xparam(xparam_id)}%", 2)
reset_font_settings
end
def draw_line_ex(x, y, color, shadow)
# // Method to draw a horizontal line with a shadow.
line_y = y + line_height / 2 - 1
contents.fill_rect(x, line_y, contents_width, 2, color)
line_y += 1
contents.fill_rect(x, line_y, contents_width, 2, shadow)
end
def draw_box(x, y, width, height, color, shadow)
# // Method to draw a box with shadow.
contents.fill_rect(x, y, width, height, color)
x += 1
y += 1
contents.fill_rect(x, y, width, height, shadow)
end
def draw_vertical_line_ex(x, y, color, shadow)
# // Method to draw a vertical line with a shadow.
line_x = x + line_height / 2 - 1
contents.fill_rect(line_x, y, 2, contents_height, color)
line_x += 1
contents.fill_rect(line_x, y, 2, contents_height, shadow)
end
def draw_icons(icons, alignment, x = 0, y = 0, offset_icon = [])
# // Method to draw icons in a horizonal or vertical alignment.
icons.each {|icon|
next if icon.nil?
# // If included in offset do extra spacing.
offset_icon.each {|offset|
if icon == offset
y += line_height * 1 if alignment == :vertical
x += line_height * 1 if alignment == :horizontal
end
}
draw_icon(icon.nil? ? nil : icon, x.nil? ? 0 : x, y.nil? ? 0 : y) rescue nil
y += line_height if alignment == :vertical
x += line_height if alignment == :horizontal
}
end
def draw_big_icon(icon, x, y, width, height, opacity = 255)
# // Method to draw a big icon.
bitmap = Cache.system("Iconset")
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
rect2 = Rect.new(x, y, width, height)
contents.stretch_blt(rect2, bitmap, rect, opacity)
end
def draw_font_text(text, x, y, width, alignment, font, size, color, bold = true, shadow = true)
# // Method to draw font text.
contents.font.name = font
contents.font.size = size
contents.font.color = color
contents.font.bold = bold
contents.font.shadow = shadow
contents.font.out_color = Color.new(0,0,0,255)
draw_text(x, y, width, calc_line_height(text), text, alignment)
reset_font_settings
end
def draw_font_text_ex(text, x, y, font, size, color, bold = true, shadow = true)
# // Method to draw font text ex.
contents.font.name = font
contents.font.size = size
contents.font.color = color
contents.font.bold = bold
contents.font.shadow = shadow
contents.font.out_color = Color.new(0,0,0,255)
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
reset_font_settings
end
end
#==============================================================================#
# ** Window_Selectable
#------------------------------------------------------------------------------
# Adding support for pageleft and pageright for window selectable.
#==============================================================================#
class Window_Selectable < Window_Base
def cursor_pageright ; end
def cursor_pageleft ; end
alias xail_core_winselect_process_cursor_move process_cursor_move
def process_cursor_move(*args, &block)
# // Method to process cursor movement.
xail_core_winselect_process_cursor_move(*args, &block)
cursor_pageright if !handle?(:pageright) && Input.trigger?(:RIGHT)
cursor_pageright if !handle?(:pageleft) && Input.trigger?(:LEFT)
end
alias xail_core_winselect_process_handling process_handling
def process_handling(*args, &block)
# // Method to process handling.
xail_core_winselect_process_handling(*args, &block)
return process_pageright if handle?(:pageright) && Input.trigger?(:RIGHT)
return process_pageleft if handle?(:pageleft) && Input.trigger?(:LEFT)
end
def process_pageright
# // Method to process page right.
Sound.play_cursor
Input.update
deactivate
call_handler(:pageright)
end
def process_pageleft
# // Method to process page left.
Sound.play_cursor
Input.update
deactivate
call_handler(:pageleft)
end
end
#==============================================================================#
# ** Window_Icon
#------------------------------------------------------------------------------
# New Window :: Window_Icon - A window for drawing icon(s).
#==============================================================================#
class Window_Icon < Window_Base
attr_accessor :enabled
attr_accessor :alignment
def initialize(x, y, window_width, hsize)
# // Method to initialize the icon window.
super(0, 0, window_width, window_height(hsize))
@icons = []
@index = 0
@enabled = true
@alignment = 0
refresh
end
def window_height(hsize)
# // Method to return the height.
fitting_height(hsize)
end
def refresh
# // Method to refresh the icon window.
contents.clear
end
def draw_cmd_icons(icons, index)
# // Draw all of the icons.
return if !@enabled
count = 0
for i in icons
align = 0
x = 110
next if i[index].nil?
case @alignment
when 1, 2 ; align = -110
end
draw_icon(i[index], x + align, 24 * count)
count += 1
break if (24 * count > height - 24)
end
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Adding check item method to return a item based on the type.
#==============================================================================
class Game_Party < Game_Unit
def check_item?(item, type)
# // Method to return a item based on the type.
case type
when :items ; $data_items[item]
when :weapons ; $data_weapons[item]
when :armors ; $data_armors[item]
when :gold ; item
when :exp ; item
end
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# Adding methods to check for comments on events.
#==============================================================================
class Game_Event < Game_Character
def comment?(comment)
# // Method to check if comment is included in event.
unless empty? or @list.nil?
for evt in @list
if evt.code == 108 or evt.code == 408
if evt.parameters[0].include?(comment)
return true
end
end
end
end
return false
end
def comment_int?(comment)
# // Method to check for a integer in event.
unless empty? or @list.nil?
for evt in @list
if evt.code == 108 or evt.code == 408
if evt.parameters[0] =~ /<#{comment}:[ ]?(\d*)>?/
return ($1.to_i > 0 ? $1.to_i : 0)
end
end
end
end
end
def comment_string?(comment)
# // Method to check for a string in event.
unless empty? or @list.nil?
for evt in @list
if evt.code == 108 or evt.code == 408
if evt.parameters[0] =~ /<#{comment}:[ ]?(\w*)>?/
return $1.to_s
end
end
end
end
end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*
Grazie in anticipo
Modificato da Sceptile, 27 August 2015 - 14:37 PM.