Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
zahraa

Speed in showing attack value (RMXP)

Recommended Posts

when you attack an enemy,a number shows in middle of screen that points the power of attack.i want to get this speed (speed of number sowing) higher.i think a little change in script is enough.

thank you and sorry for bad english

Share this post


Link to post
Share on other sites

You mean how long it displays for, or how quickly it appears?

 

If how long it displays:

 

class RPG::Sprite

 alias faster_damage damage
 def damage(value, critical)
   faster_damage(value, critical)
   @_damage_duration = 40 # 40 is default. Lower to make faster.
 end
end

Share this post


Link to post
Share on other sites

sorry,i must included this.i mean how quickly it appears.

but when i copy this script in a new script page and run my game, nothing happen

Share this post


Link to post
Share on other sites

No. It simply shortens the duration the damage is displayed. I can say with pretty good certainty that it does that without testing, but I will to make sure.

 

As for you wanting the damage to appear faster, know that damage displays right after the animation is done, so if you want that faster, shorten your animations.

Share this post


Link to post
Share on other sites

i think this script can solve my problem too. (without make animations short).so i will thank you if you make this script efficient.

sorry for confusing:sweatdrop:

Share this post


Link to post
Share on other sites

I tested, and the little script I posted does exactly as I said: it shortens the time the battle damage is displayed.

I don't know how you didn't notice a difference, I set it to 20 and the effect was kinda hard not to see. If you are using some other type of battle system or custom damage display or something, it could make a difference, but you didn't mention that, so I am assuming you are using the default battle system.

Share this post


Link to post
Share on other sites

i changed nothing in RMXP's battle system.i have some custom scripts but they don't change anything in battle system

Edited by zahraa

Share this post


Link to post
Share on other sites

Don't know what your problem is then. You MUST have some conflicting script.

In a brand new project, with only small script from above added:

 

With value set to 40 (default): https://dl.dropbox.com/u/20787370/Temp/40Frames.avi

 

With value set to 10: https://dl.dropbox.com/u/20787370/Temp/10Frames.avi

Share this post


Link to post
Share on other sites

yes.you are right.when i run a new project this script works.but i can't delete other custom scripts.thanks anyway

Share this post


Link to post
Share on other sites

My point is, knowing what other scripts you use allows for making a variation that works. That's why it is important to to let someone know these things when asking for customized scripts. If you choose not to say, there is nothing more I can do to help you.

Share this post


Link to post
Share on other sites
first script:
[spoiler]# *****************************************************************************
# * Universal Message System
# * v1.6.3
# * by Ccoa
# *****************************************************************************
# Usage:
=begin
IN MESSAGE CODES
\b - toggle bold on and off
\bopc[i] - change the back opacity for this message to i (should be 0-255)
\c[i] - change the text color
\c[#IIIIII] - change the text color to the hex code (temporary)
\e[i] - place the text box over event i (0 = player, -1 no event)
\face[name] - changes the face graphic to name.png (leave empty [] for no face)
\fl - change face justification to left
\font[name] - change the font to name, leave empty [] to return to the default font
\fr - change face justification to right
\g - display the gold window
\height - height of the message window, works only in normal mode
\i - toggle italics on and off
\ignr - Do not write anything on this line, only process codes, must be the first thing on a line
\jc - justify the window to the center, ignored if using \e
\jl - justify the window to the left, ignored if using \e
\jr - justify the window to the right, ignored if using \e
\m - toggle mode between normal and fit window to text
\n[i] - display the name of actor i
\nm[name] - display the name in the name window, leave empty [] to remove the name window
\oa[i] - display the icon and name of armor i
\oi[i] - display the icon and name of item i
\opc[i] - change the opacity for this message to i (should be 0-255)
\os[i] - display the icon and name of skill i
\ow[i] - display the icon and name of weapon i
\p[i] - pause for i frames before writing the next character
\pt - toggle pause display on and off
\s - toggle shadowed text
\shk[i] - set window shake to i, higher i is bigger shake, 0 is no shake
\skip - toggle text skip on and off
a[i] - center the window over train actor 1
1 - switch to the talk1 comic thingy
2 - switch to the talk2 comic thingy
c - center the text, must be the first thing on a line
h - switch to the thought comic thingy
l - left justify the text, must be the first thing on a line
r - right justify the text, must be the first thing on a line
\v[i] - display variable i
\width - width of the message window, works only in normal mode
\w[i] - wait for i frames after receiving this code, then close the window
\ws[i] - change the write speed to i
\slv[name] - set this window to be slave window name, or show slave window name
\inc - include this window in the last

OUT OF MESSAGE CODES (use in a Script event command)
$game_system.ums_mode = NORMAL_MODE - switch to normal mode
$game_system.ums_mode = FIT_WINDOW_TO_TEXT - switch to fit window mode
$game_system.text_skip = true - turn text skip on
$game_system.text_skip = false
true - turn text skip off (true is necessary)
$game_system.text_mode = WRITE_FASTER - change skip mode to write faster
$game_system.text_mode = WRITE_ALL - change skip mode to write all
$game_system.write_speed = i - change the delay between letters to i frames
$game_system.window_height = i - change the window height to i
$game_system.window_width = i - change the window width to i
$game_system.window_justification = RIGHT - make the window right justified
$game_system.window_justification = LEFT - make the window left justified
$game_system.window_justification = CENTER - make the window center justified
$game_system.face_graphic = "filename" - change the face graphic to filename.png
$game_system.face_graphic = "" - change the face graphic to none
$game_system.face_graphic_justification = LEFT - the face graphic is on the left side
$game_system.face_graphic_justification = RIGHT - the face graphic is on the right side
$game_system.face_graphic_position = TOP - face graphic appears on top of window
$game_system.face_graphic_position = CENTER - face graphic appears centered in window
$game_system.face_graphic_position = BOTTOM - face graphic appears on the bottom of window
$game_system.shadow_text = true - turn text shadowing on
$game_system.shadow_text = false
true - turn text shadowing off (true is necessary)
$game_system.shadow_color = Color.new(red, blue, green, alpha) - change shadow color
$game_system.message_event = what event to put the message over (0 = player, -1 = no event)
$game_system.comic_enabled = false
true - turn off comic thingy
$game_system.comic_enabled = true - turn on comic thingy (only works with message_event not -1)
$game_system.comic_style = TALK1 - use the talk1.png comic thingy
$game_system.comic_style = TALK2 - use the talk2.png comic thingy
$game_system.comic_style = THOUGHT - use the thought.png comic thingy
$game_system.name = "name" - change the text of the name window to name
$game_system.name = "" - remove the name window
$game_system.font = "name" - change the font to name
$game_system.font = "" - return the font to the default
$game_system.text_justification = CENTER - center justify the text
$game_system.text_justification = LEFT - left justify the text
$game_system.text_justification = RIGHT - right justify the text
$game_system.show_pause = true - show pause icon when waiting for user input
$game_system.show_pause = false - don't show pause icon when waiting for user input
$game_system.shake = 0 - turn window shake off
$game_system.shake = i - set shake to i, higher i is bigger shake
$game_system.sound_effect = "" - turn off the letter-by-letter SE
$game_system.sound_effect = "sename" - play the SE sename with each letter written
$game_system.animated_faces = false - do not use animated faces
$game_system.animated_faces = true - use animated faces
$game_system.animation_pause = i - Wait i frames between each animation
$game_system.face_frame_width = i - Each frame on the faceset is i pixels
$game_system.resting_face = "" - Do not use a resting face
$game_system.resting_face = "name" - Use a different animated face named facenamename when done talking
$game_system.resting_animation_pause = i - Wait i frames between resting animations
$game_system.text_mode = ONE_LETTER_AT_A_TIME - write text one letter at a time
$game_system.text_mode = ALL_AT_ONCE - write text all at once
$game_system.font_color = Color.new(R, G, B, A) - permanently change the font color to the RGBA color given here
$game_system.font_color = nil - return the font color permanently to normal_color (white, by default)
$game_system.windowskin = "windowskinname" - change the message box windowskin to windowskin
$game_system.windowskin = "" - change the message box windowskin back to the one in the database
$game_system.name_window = true - show the name window
$game_system.name_window = false - hide the name window (just show the text)
$game_system.opacity = i - change the message window back opacity to i (0-255)
$game_system.window_image = "imagename" - the name of the image to show behind the window
$game_system.window_image = nil - stop showing an image behind the window
$game_system.train_actor = i - center the message over train actor i
=end
# *****************************************************************************
# CONSTANTS
# *****************************************************************************
# modes
NORMAL_MODE = 0
FIT_WINDOW_TO_TEXT = 1
#text modes
ONE_LETTER_AT_A_TIME = 0
ALL_AT_ONCE = 1
# skip modes
WRITE_FASTER = 0
WRITE_ALL = 1
# justifications
RIGHT = 4
CENTER = 1
LEFT = 6
# positions for extra objects (face graphics, choice box, etc)
ABOVE = 0 # place the object above the top of the message box
CENTER = 1 # center the object vertically inside the message box
BOTTOM = 2 # place the bottom of the object on the bottom of the message box
SIDE = 3 # to the side of the message box (which side depends on justification)
# comic type
TALK1 = 0
TALK2 = 1
THOUGHT = 2
# *****************************************************************************
# Changes to Game_System. This allows any changes made to be saved when the
# game is saved.
# *****************************************************************************
class Game_System
attr_accessor :ums_mode # what mode the UMS is in
attr_accessor :text_skip # whether or not text skip is activated
attr_accessor :skip_mode # write the text faster while C is pressed, or just skip to the end
attr_accessor :write_speed # frame delay between characters

attr_accessor :text_mode # write one letter at a time, or all at once?

attr_accessor :window_height # default height of message window
attr_accessor :window_width # default width of message window
attr_accessor :window_justification # default justification of window

attr_accessor :face_graphic # current face graphic
attr_accessor :face_graphic_justification # justification of face graphic
attr_accessor :face_graphic_position # position of face graphic

attr_accessor :shadowed_text # whether or not to draw a shadow behind the text
attr_accessor :shadow_color # the shadow color

attr_accessor :choice_justification # where the choice window is located
attr_accessor :choice_position # prefered position of choice window

attr_accessor :message_event # what event to center the text over (0 player, -1 to not)
attr_accessor :train_actor # what train actor to center the text over (0 player, -1 to not)

attr_accessor :comic_enabled # using "talk" icons?
attr_accessor :comic_style # what type of comic image to use

attr_accessor :name # the text for the name window
attr_accessor :name_window # should the name window be visible?

attr_accessor :font # the name of the font
attr_accessor :font_color # the name of the (permanent) font color

attr_accessor :text_justification # the justification of the window text

attr_accessor :show_pause # whether or not to show the pause icon

attr_accessor :shake # the amount of shake for the window

attr_accessor :sound_effect # SE to play with each letter

attr_accessor :slave_windows # hash of slave windows
attr_accessor :indy_windows # hash of independent windows

attr_accessor :animated_faces # are the faces animated?
attr_accessor :animation_pause # how long do I wait between animation loops?
attr_accessor :face_frame_width # how many pixels wide is each face frame
attr_accessor :resting_face # postext for waiting face graphic
attr_accessor :resting_animation_pause # how long to wait for resting graphic

attr_accessor :windowskin # what windowskin to use for messages
attr_accessor :back_opacity # back opacity of windowskin
attr_accessor :opacity # opacity of windowskin

attr_accessor :window_image # image used behind window

attr_reader :shortcuts # user-defined shortcuts

alias ums_initialize initialize
def initialize
ums_initialize
@ums_mode = NORMAL_MODE

@skip_mode = WRITE_ALL
@text_skip = true
@write_speed = 2

@text_mode = ONE_LETTER_AT_A_TIME

@window_height = 128
@window_width = 480
@window_justification = CENTER

@face_graphic = ""
@face_graphic_justification = LEFT
@face_graphic_position = CENTER

@shadowed_text = false
@shadow_color = Color.new(0, 0, 0, 100)

@choice_justification = RIGHT
@choice_position = SIDE

@message_event = -1
@train_actor = -1

@comic_enabled = false
@comic_style = TALK1

@name = ""
@name_window = true

@font = "Verdana"
@font_color = nil

@text_justification = LEFT

@show_pause = true

@shake = 0

@sound_effect = ""

@slave_windows = {}
@indy_windows = {}

@animated_faces = false
@animation_pause = 80
@face_frame_width = 100
@resting_face = ""
@resting_animation_pause = 80

@windowskin = ""
@opacity = 255
@back_opacity = 160

@window_image = nil

@used_codes = ['\v', '\n', '\c', '\g', '\skip', '\m', '\height', '\width',
'\jr', '\jc', '\jl', '\face', '\fl', '\fr', '\b', '\i', '\s',
'\e', ' 1', ' 2', ' h', '\nm', '\font', '\p', '\w', '\ws',
'\oa', '\oi', '\os', '\ow', ' l', ' r', ' c', '\ignr',
'\shk', '\slv', '\ind', '\inc']

@shortcuts = {}
end

def add_shortcut(shortcut, code)
text = shortcut.downcase
if !@used_codes.include?(text)
@shortcuts[shortcut] = code
end
end

def open_window(name)
if $game_system.indy_windows.has_key?(name)
$game_system.indy_windows[name].show = true
end
end

def close_window(name)
if $game_system.indy_windows.has_key?(name)
$game_system.indy_windows[name].dispose
$game_system.indy_windows.delete(name)
end
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
attr_accessor :choices
attr_accessor :num_choices
attr_accessor :skip_next_choices

alias old_init initialize
def initialize
old_init
@skip_next_choices = 0
@num_choices = 1
end
end
class Scene_Map
alias ums_update update
def update
$game_system.slave_windows.each_value { |window| window.update }
$game_system.indy_windows.each_value { |window| window.update }
ums_update
end
end
class Interpreter
#--------------------------------------------------------------------------
# * Event Command Execution
#--------------------------------------------------------------------------
def execute_command
# If last to arrive for list of event commands
if @index >= @list.size - 1
# End event
command_end
# Continue
return true
end
# Make event command parameters available for reference via @parameters
if !(@list[@index].code == 102 and $game_temp.skip_next_choices > 0)
@parameters = @list[@index].parameters.clone
if @list[@index].code == 402
@parameters[0] += @offset
end
end
# Branch by command code
case @list[@index].code
when 101 # Show Text
return command_101
when 102 # Show Choices
return command_102
when 402 # When [**]
return command_402
when 403 # When Cancel
return command_403
when 103 # Input Number
return command_103
when 104 # Change Text Options
return command_104
when 105 # Button Input Processing
return command_105
when 106 # Wait
return command_106
when 111 # Conditional Branch
return command_111
when 411 # Else
return command_411
when 112 # Loop
return command_112
when 413 # Repeat Above
return command_413
when 113 # Break Loop
return command_113
when 115 # Exit Event Processing
return command_115
when 116 # Erase Event
return command_116
when 117 # Call Common Event
return command_117
when 118 # Label
return command_118
when 119 # Jump to Label
return command_119
when 121 # Control Switches
return command_121
when 122 # Control Variables
return command_122
when 123 # Control Self Switch
return command_123
when 124 # Control Timer
return command_124
when 125 # Change Gold
return command_125
when 126 # Change Items
return command_126
when 127 # Change Weapons
return command_127
when 128 # Change Armor
return command_128
when 129 # Change Party Member
return command_129
when 131 # Change Windowskin
return command_131
when 132 # Change Battle BGM
return command_132
when 133 # Change Battle End ME
return command_133
when 134 # Change Save Access
return command_134
when 135 # Change Menu Access
return command_135
when 136 # Change Encounter
return command_136
when 201 # Transfer Player
return command_201
when 202 # Set Event Location
return command_202
when 203 # Scroll Map
return command_203
when 204 # Change Map Settings
return command_204
when 205 # Change Fog Color Tone
return command_205
when 206 # Change Fog Opacity
return command_206
when 207 # Show Animation
return command_207
when 208 # Change Transparent Flag
return command_208
when 209 # Set Move Route
return command_209
when 210 # Wait for Move's Completion
return command_210
when 221 # Prepare for Transition
return command_221
when 222 # Execute Transition
return command_222
when 223 # Change Screen Color Tone
return command_223
when 224 # Screen Flash
return command_224
when 225 # Screen Shake
return command_225
when 231 # Show Picture
return command_231
when 232 # Move Picture
return command_232
when 233 # Rotate Picture
return command_233
when 234 # Change Picture Color Tone
return command_234
when 235 # Erase Picture
return command_235
when 236 # Set Weather Effects
return command_236
when 241 # Play BGM
return command_241
when 242 # Fade Out BGM
return command_242
when 245 # Play BGS
return command_245
when 246 # Fade Out BGS
return command_246
when 247 # Memorize BGM/BGS
return command_247
when 248 # Restore BGM/BGS
return command_248
when 249 # Play ME
return command_249
when 250 # Play SE
return command_250
when 251 # Stop SE
return command_251
when 301 # Battle Processing
return command_301
when 601 # If Win
return command_601
when 602 # If Escape
return command_602
when 603 # If Lose
return command_603
when 302 # Shop Processing
return command_302
when 303 # Name Input Processing
return command_303
when 311 # Change HP
return command_311
when 312 # Change SP
return command_312
when 313 # Change State
return command_313
when 314 # Recover All
return command_314
when 315 # Change EXP
return command_315
when 316 # Change Level
return command_316
when 317 # Change Parameters
return command_317
when 318 # Change Skills
return command_318
when 319 # Change Equipment
return command_319
when 320 # Change Actor Name
return command_320
when 321 # Change Actor Class
return command_321
when 322 # Change Actor Graphic
return command_322
when 331 # Change Enemy HP
return command_331
when 332 # Change Enemy SP
return command_332
when 333 # Change Enemy State
return command_333
when 334 # Enemy Recover All
return command_334
when 335 # Enemy Appearance
return command_335
when 336 # Enemy Transform
return command_336
when 337 # Show Battle Animation
return command_337
when 338 # Deal Damage
return command_338
when 339 # Force Action
return command_339
when 340 # Abort Battle
return command_340
when 351 # Call Menu Screen
return command_351
when 352 # Call Save Screen
return command_352
when 353 # Game Over
return command_353
when 354 # Return to Title Screen
return command_354
when 355 # Script
return command_355
else # Other
return true
end
end

#--------------------------------------------------------------------------
# * Show Text
#--------------------------------------------------------------------------
def command_101
# If other text has been set to message_text
if $game_temp.message_text != nil
# End
return false
end
# Set message end waiting flag and callback
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# Set message text on first line
$game_temp.message_text = @list[@index].parameters[0] + "\n"
line_count = 1
# Loop
loop do
# If next event command text is on the second line or after
if @list[@index + 1].code == 401
# Add the second line or after to message_text
$game_temp.message_text += @list[@index + 1].parameters[0] + "\n"
line_count += 1
# If the next event command is show text
elsif @list[@index + 1].code == 101
# If the text contains the \inc code
if @list[@index + 1].parameters[0].index(/\\[Ii][Nn][Cc]/) != nil
$game_temp.message_text += @list[@index + 1].parameters[0] + "\n"
$game_temp.message_text.sub!(/\\[Ii][Nn][Cc]/) { "" }
else
return true
end
# If event command is not on the second line or after
else
# If next event command is show choices
if @list[@index + 1].code == 102
# Advance index
@index += 1

# skip this one, it was already shown?
if $game_temp.skip_next_choices > 0
$game_temp.skip_next_choices -= 1
else
# Choices setup
$game_temp.choice_start = line_count
setup_choices(@list[@index].parameters)
end
# If next event command is input number
elsif @list[@index + 1].code == 103
# If number input window fits on screen
if line_count < 4
# Advance index
@index += 1
# Number input setup
$game_temp.num_input_start = line_count
$game_temp.num_input_variable_id = @list[@index].parameters[0]
$game_temp.num_input_digits_max = @list[@index].parameters[1]
end
end
# Continue
return true
end
# Advance index
@index += 1
end
end
#--------------------------------------------------------------------------
# * Show Choices
#--------------------------------------------------------------------------
def command_102
# If text has been set to message_text
if $game_temp.message_text != nil
# End
return false
end

if $game_temp.skip_next_choices > 0
# skip this one, it is part of another
$game_temp.skip_next_choices -= 1
@offset += 4
@index += 1
return false
else
@offset = 0
end
# Set message end waiting flag and callback
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# Choices setup
$game_temp.message_text = ""
$game_temp.choice_start = 0
setup_choices(@parameters)
# Continue
return true
end
#--------------------------------------------------------------------------
# * Setup Choices
#--------------------------------------------------------------------------
def setup_choices(parameters)
params = parameters.clone
@offset = 0
i = @index
curr = 1
while curr < $game_temp.num_choices
i += 1
if @list[i].code == 102
params[0] += @list[i].parameters[0]
if @list[i].parameters[1] == 5
@cancel_flag = true
else
@cancel_flag = false
end
params[1] = @list[i].parameters[1] + (curr * 4)
curr += 1
end
end

# Set choice item count to choice_max
$game_temp.choice_max = params[0].size
# Set choice to message_text
$game_temp.choices = params[0]
# Set cancel processing
$game_temp.choice_cancel_type = params[1]

if $game_temp.num_choices != 1
$game_temp.skip_next_choices = $game_temp.num_choices - 1
$game_temp.num_choices = 1
end

# Set callback
current_indent = @list[@index].indent
$game_temp.choice_proc = Proc.new { |n| @branch[current_indent] = n }
end

#--------------------------------------------------------------------------
# * When [**]
#--------------------------------------------------------------------------
def command_402
# If fitting choices are selected
if @branch[@list[@index].indent] == @parameters[0]
# Delete branch data
@branch.delete(@list[@index].indent)
# Continue
return true
end
# If it doesn't meet the condition: command skip
return command_skip
end

#--------------------------------------------------------------------------
# * When Cancel
#--------------------------------------------------------------------------
def command_403
# If choices are cancelled
if @cancel_flag
# Delete branch data
@branch.delete(@list[@index].indent)
# Continue
return true
end
# If it doen't meet the condition: command skip
return command_skip
end

#--------------------------------------------------------------------------
# * Input Number
#--------------------------------------------------------------------------
def command_103
# If text has been set to message_text
if $game_temp.message_text != nil
# End
return false
end
# Set message end waiting flag and callback
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# Number input setup
$game_temp.message_text = ""
$game_temp.num_input_start = 0
$game_temp.num_input_variable_id = @parameters[0]
$game_temp.num_input_digits_max = @parameters[1]
# Continue
return true
end

#--------------------------------------------------------------------------
# * Script
#--------------------------------------------------------------------------
def command_355
# Set first line to script
script = @list[@index].parameters[0] + "\n"
# Loop
loop do
# If next event command is second line of script or after
if @list[@index + 1].code == 655
# Add second line or after to script
script += @list[@index + 1].parameters[0] + "\n"
# If event command is not second line or after
else
# Abort loop
break
end
# Advance index
@index += 1
end
# Evaluation
result = eval(script)
# Continue
return true
end
end
# *****************************************************************************
# Changes to Window_Message. This is the bulk of the script
# *****************************************************************************
#==============================================================================
# ** Window_Message
#------------------------------------------------------------------------------
# This message window is used to display text.
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# x-coordinate depends on justification
if $game_system.window_justification == RIGHT
x = 640 - self.width
elsif $game_system.window_justification == LEFT
x = 0
else # center
x = (640 - $game_system.window_width) / 2
end
# y-coordinate depends on height
y = 480 - $game_system.window_height - 16
super(x, y, $game_system.window_width, $game_system.window_height)
self.contents = Bitmap.new(width - 32, height - 32)
if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
self.visible = false
self.z = 9998
@fade_in = false
@fade_out = false
@contents_showing = false

# face graphic sprite
@face = Sprite.new
@face.opacity = 0
@face.z = self.z + 1
@face_offset = 0

# choice window
@choice_window = Window_Choice.new([])
@choice_window.back_opacity = $game_system.back_opacity

# comic sprite
@comic = Sprite.new
@comic.opacity = 0
@comic.z = self.z + 1
if $game_system.comic_style == TALK1
@comic.bitmap = RPG::Cache.windowskin("gallery_24241_32_870")
elsif $game_system.comic_style == TALK2
@comic.bitmap = RPG::Cache.windowskin("talk2")
else # thought
@comic.bitmap = RPG::Cache.windowskin("thought")
end

# window image sprite
@window_back = Sprite.new
@window_back.opacity = 0
@window_back.z = self.z - 1
if $game_system.window_image != nil
@window_back.bitmap = RPG::Cache.windowskin($game_system.window_image)
end

# name window
@name_window = Window_Name.new
@name_window.z = self.z + 1

@pause_time = 0
@wait = 0

@show = false

@face_frame = 0
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
terminate_message
$game_temp.message_window_showing = false
if @input_number_window != nil
@input_number_window.dispose
end
@face.dispose
@choice_window.dispose
@comic.dispose
@name_window.dispose
super
end
#--------------------------------------------------------------------------
# * Terminate Message
#--------------------------------------------------------------------------
def terminate_message
@show = false
self.active = false
self.pause = false
self.contents.clear
# Clear showing flag
@contents_showing = false
# Call message callback
if $game_temp.message_proc != nil
$game_temp.message_proc.call
end
# Clear variables related to text, choices, and number input
$game_temp.message_text = nil
$game_temp.message_proc = nil
$game_temp.choice_start = 99
$game_temp.choice_max = 0
$game_temp.choice_cancel_type = 0
$game_temp.choice_proc = nil
$game_temp.num_input_start = 99
$game_temp.num_input_variable_id = 0
$game_temp.num_input_digits_max = 0
# Open gold window
if @gold_window != nil
@gold_window.dispose
@gold_window = nil
end
@choice_window.visible = false
@choice_window.active = false
@comic.opacity = 0
$game_system.slave_windows.each_pair {|name, window|
if window.show == true
window.dispose
$game_system.slave_windows.delete(name)
end
}
@done = false
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
if $game_system.windowskin != ""
self.windowskin = RPG::Cache.windowskin($game_system.windowskin)
else
self.windowskin = RPG::Cache.windowskin($data_system.windowskin_name)
end
if $game_system.comic_style == TALK1
@comic.bitmap = RPG::Cache.windowskin("gallery_24241_32_870")
elsif $game_system.comic_style == TALK2
@comic.bitmap = RPG::Cache.windowskin("talk2")
else # thought
@comic.bitmap = RPG::Cache.windowskin("thought")
end
@show = true
@x = @y = 0
# If waiting for a message to be displayed
if $game_temp.message_text != nil
@text = $game_temp.message_text

# replace shortcuts with original code
$game_system.shortcuts.each { |shortcut, code|
@text.gsub!(shortcut, code)
}

# VERY first thing. Check to see if this is being set up as a slave
# or independent window.
if @text.index(/\\[Ss][Ll][Vv]\[(.*?)\]/) != nil
# is this a new slave window, or a request to display it?
if !$game_system.slave_windows.has_key?($1.to_s)
# there is no such slave window yet. Set it up.
@text.gsub!(/\\[Ss][Ll][Vv]\[(.*?)\]/, "")
$game_system.slave_windows[$1.to_s] = Window_Slave.new(@text)
@text = ""
@show = false
terminate_message
return
end
end
if @text.index(/\\[Ii][Nn][Dd]\[(.*?)\]/) != nil
# is this a new independent window, or a request to display it?
if !$game_system.indy_windows.has_key?($1.to_s)
# there is no such slave window yet. Set it up.
@text.gsub!(/\\[Ii][Nn][Dd]\[(.*?)\]/, "")
$game_system.indy_windows[$1.to_s] = Window_Slave.new(@text)
@text = ""
@show = false
terminate_message
return
end
end

# Control text processing
begin
last_text = @text.clone
@text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until @text == last_text
@text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end

# window mode
if @text.index(/\\[Mm]/) != nil
if $game_system.ums_mode == NORMAL_MODE
$game_system.ums_mode = FIT_WINDOW_TO_TEXT
else
$game_system.ums_mode = NORMAL_MODE
end
@text.gsub!(/\\[Mm]/) { "" }
end

# window height
@text.gsub!(/\\[Hh][Ee][Ii][Gg][Hh][Tt]\[([0-9]+)\]/) do
$game_system.window_height = $1.to_i
""
end

# window width
@text.gsub!(/\\[Ww][Ii][Dd][Tt][Hh]\[([0-9]+)\]/) do
$game_system.window_width = $1.to_i
""
end

# justification
@text.gsub!(/\\[Jj][Rr]/) do
$game_system.window_justification = RIGHT
reset_window
""
end
@text.gsub!(/\\[Jj][Cc]/) do
$game_system.window_justification = CENTER
reset_window
""
end
@text.gsub!(/\\[Jj][Ll]/) do
$game_system.window_justification = LEFT
reset_window
""
end

# face graphics
@text.gsub!(/\\[Ff][Aa][Cc][Ee]\[(.*?)\]/) do
$game_system.face_graphic = $1.to_s
if $1.to_s == ""
@face.opacity = 0
end
""
end
@text.gsub!(/\\[Ff][Ll]/) do
$game_system.face_graphic_justification = LEFT
""
end
@text.gsub!(/\\[Ff][Rr]/) do
$game_system.face_graphic_justification = RIGHT
""
end

# event centering
@text.gsub!(/\\[Ee]\[([0-9]+)\]/) do
$game_system.message_event = $1.to_i
""
end

# train actor centering
@text.gsub!(/\\[Tt][Aa]\[([0-9]+)\]/) do
$game_system.train_actor = $1.to_i
""
end

# comic thingy
@text.gsub!(/\\[Tt]1/) do
$game_system.comic_style = TALK1
@comic.bitmap = RPG::Cache.windowskin("talk1.png")
""
end
@text.gsub!(/\\[Tt]2/) do
$game_system.comic_style = TALK2
@comic.bitmap = RPG::Cache.windowskin("talk2.png")
""
end
@text.gsub!(/\\[Tt][Hh]/) do
$game_system.comic_style = THOUGHT
@comic.bitmap = RPG::Cache.windowskin("thought.png")
""
end

# name window
@text.gsub!(/\\[Nn][Mm]\[(.*?)\]/) do
$game_system.name = $1.to_s
if $1.to_s == ""
@name_window.visible = false
@name_window.dummy_window.visible = false
end
""
end
# name party window
@text.gsub!(/\\[Nn][Pp]\[([0-9]+)\]/) do
actor = $game_party.actors[$1.to_i]
if actor != nil
actor.name
else
""
end
end

if $game_system.name == ""
@name_window.visible = false
@name_window.dummy_window.visible = false
end


# toggle pause
@text.gsub!(/\\[Pp][Tt]/) do
$game_system.show_pause = !$game_system.show_pause
""
end

# shaking
@text.gsub!(/\\[Ss][Hh][Kk]\[([0-9]+)\]/) do
$game_system.shake = $1.to_i
""
end

# back opacity
@text.gsub!(/\\[Bb][Oo][Pp][Cc]\[([0-9]+)\]/) do
$game_system.back_opacity = $1.to_i
self.back_opacity = $game_system.back_opacity
""
end

# opacity
@text.gsub!(/\\[Oo][Pp][Cc]\[([0-9]+)\]/) do
$game_system.opacity = $1.to_i
self.opacity = $game_system.opacity
""
end

# Change "\\\\" to "\000" for convenience
@text.gsub!(/\\\\/) { "\000" }
# Change "\\C" to "\001" and "\\G" to "\002"
@text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
@text.gsub!(/\\[Gg]/) { "\002" }
@text.gsub!(/\\[Cc]\[0x([0123456789abcdef]+)\]/) { "\026[#{$1}]" }

# text skip code
@text.gsub!(/\\[Ss][Kk][Ii][Pp]/) { "\003" }

# ignore code
@text.gsub!(/\\[Ii][Gg][Nn][Rr]/) { "\023" }

# slave and indy windows
@text.gsub!(/\\[Ss][Ll][Vv]\[(.*?)\]/) { "\024[#{$1}]" }
@text.gsub!(/\\[Ii][Nn][Dd]\[(.*?)\]/) { "\025[#{$1}]" }

# bold and italics
@text.gsub!(/\\[Bb]/) { "\004" }
@text.gsub!(/\\[Ii]/) { "\005" }

# shadow
@text.gsub!(/\\[Ss]/) { "\006" }

# font
@text.gsub!(/\\[Ff][Oo][Nn][Tt]\[(.*?)\]/) { "\007[#{$1}]" }

# pause and wait
@text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "\010[#{$1}]" }
@text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\011[#{$1}]" }

# write speed
@text.gsub!(/\\[Ww][Ss]\[([0-9]+)\]/) { "\013[#{$1}]" }

# armor, items, skills, and weapons
@text.gsub!(/\\[Oo][Aa]\[([0-9]+)\]/) {
item = $data_armors[$1.to_i]
"\014[#{$1}]" + " " + item.name
}
@text.gsub!(/\\[Oo][Ii]\[([0-9]+)\]/) {
item = $data_items[$1.to_i]
"\015[#{$1}]" + " " + item.name
}
@text.gsub!(/\\[Oo][Ss]\[([0-9]+)\]/) {
item = $data_skills[$1.to_i]
"\016[#{$1}]" + " " + item.name
}
@text.gsub!(/\\[Oo][Ww]\[([0-9]+)\]/) {
item = $data_weapons[$1.to_i]
"\017[#{$1}]" + " " + item.name
}

# text justification
@text.gsub!(/\\[Tt][Cc]/) { "\020" }
@text.gsub!(/\\[Tt][Ll]/) { "\021" }
@text.gsub!(/\\[Tt][Rr]/) { "\022" }

# Resize the window to fit the contents?
if $game_system.ums_mode == FIT_WINDOW_TO_TEXT
width = 1
text = @text.split("\n")
height = 0
i = 0
for line in text
# don't count this line's width if it has the ignr code
if !line.include?("\023")
width = [width, self.contents.text_size(line).width].max
delta = self.contents.text_size(line).height
height += delta + (delta * 0.2).to_i
end
end

if $game_system.face_graphic != "" and ($game_system.face_graphic_position == CENTER or $game_system.face_graphic_position == BOTTOM)
width += @face.bitmap.width
if height < @face.bitmap.height
height = @face.bitmap.height - 32
end
end

if height == 0
height = 1
end

self.width = width + 48
self.height = height + 48
self.contents = Bitmap.new(width + 16, height)

if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end

if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
else
if self.width != $game_system.window_height or self.height != $game_system.window_width
self.width = $game_system.window_width
self.height = $game_system.window_height
self.contents = Bitmap.new(self.width - 32, self.height - 32)
if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
end
end

if $game_system.window_image != nil
# figure out how we're going to resize this
@window_back.zoom_x = self.width.to_f / @window_back.bitmap.width
@window_back.zoom_y = self.height.to_f / @window_back.bitmap.height
end

reset_window

get_x_value

@count = Graphics.frame_count
@pause_time = 0
@ignore = false
@ascending = true
@target_x = self.x + $game_system.shake
@done = false
@face_frame = 0
@done = false

self.oy = 0
end


end

#--------------------------------------------------------------------------
# * Set Window Position and Opacity Level
#--------------------------------------------------------------------------
def reset_window (change_opacity = true)
# x-coordinate depends on justification
if $game_system.message_event == -1 and $game_system.train_actor == -1
if $game_system.window_justification == RIGHT
self.x = 640 - $game_system.window_width
elsif $game_system.window_justification == LEFT
self.x = 0
else # center
self.x = (640 - self.width) / 2
end
elsif $game_system.train_actor >= 0
if $game_system.train_actor == 0 or $game_system.train_actor > $game_party.actors.size - 1
# center on player
event_x = $game_player.screen_x
else
# center on train actor
event_x = $game_train.actors[$game_system.train_actor - 1].screen_x
end
self.x = event_x - self.width / 2
@comic.x = self.x + (self.width / 2) + 4
else
if $game_system.message_event == 0 or $game_map.events[$game_system.message_event] == nil
# center on player
event_x = $game_player.screen_x
else
# center on the event specified
event_x = $game_map.events[$game_system.message_event].screen_x
end
self.x = event_x - self.width / 2
@comic.x = self.x + (self.width / 2) + 4
end

if $game_temp.in_battle
self.y = 16
else
if $game_system.message_event == -1 and $game_system.train_actor == -1
case $game_system.message_position
when 0 # up
self.y = 16
when 1 # middle
self.y = (480 - $game_system.window_height) / 2
when 2 # down
self.y = 480 - $game_system.window_height - 24
end
elsif $game_system.train_actor >= 0
if $game_system.train_actor == 0 or $game_system.train_actor > $game_party.actors.size - 1
# center on player
self.y = $game_player.screen_y - self.height - 48
else
# center on train actor
self.y = $game_train.actors[$game_system.train_actor - 1].screen_y - self.height - 48
end
@comic.y = self.y + self.height - 2
@comic.angle = 0
else
if $game_system.message_event == 0 or $game_map.events[$game_system.message_event] == nil
# above player
self.y = $game_player.screen_y - self.height - 48
else
# above event specified
self.y = $game_map.events[$game_system.message_event].screen_y - self.height - 48
end
@comic.y = self.y + self.height - 2
@comic.angle = 0
end
end
if self.y < 0 + ($game_system.name == "" ? 0 : 16)
if $game_system.comic_enabled
if $game_system.message_event == 0 or $game_map.events[$game_system.message_event] == nil
self.y = $game_player.screen_y - 16
else
self.y = $game_map.events[$game_system.message_event].screen_y - 16
end
@comic.angle = 180
@comic.y = self.y + 2
@comic.x = self.x + (self.width / 2) - 4
else
self.y = 0 + ($game_system.name == "" ? 0 : 16)
end
elsif self.y > 480 - self.height
self.y = 480 - self.height
end
if self.x < 0
self.x = 0
elsif self.x > 680 - self.width - 48
self.x = 640 - self.width
end

if change_opacity
if $game_system.message_frame == 0 and $game_temp.message_text != ""
self.opacity = $game_system.opacity
else
self.opacity = 0
end
self.back_opacity = $game_system.back_opacity
end

# window back stuff
if $game_system.window_image != nil
@window_back.bitmap = RPG::Cache.windowskin($game_system.window_image)
@window_back.x = self.x
@window_back.y = self.y
end

# face stuff
if $game_system.face_graphic != ""
# the player has chosen to show a face graphic
if @done and $game_system.resting_face != ""
@face.bitmap = RPG::Cache.picture($game_system.face_graphic + $game_system.resting_face)
if @face_frame * $game_system.face_frame_width >= @face.bitmap.width
@face_frame = 0
end
else
@face.bitmap = RPG::Cache.picture($game_system.face_graphic)
end

# picture y-coordinate
if $game_system.face_graphic_position == ABOVE
@face.y = self.y - @face.bitmap.height
@face_offset = 0
elsif $game_system.face_graphic_position == CENTER
delta = (@face.bitmap.height - self.height) / 2
@face.y = self.y - delta
if $game_system.animated_faces
@face_offset = $game_system.face_frame_width + 16
else
@face_offset = @face.bitmap.width + 16
end
elsif $game_system.face_graphic_position == BOTTOM
@face.y = self.y + self.height - @face.bitmap.height
if $game_system.animated_faces
@face_offset = $game_system.face_frame_width + 16
else
@face_offset = @face.bitmap.width + 16
end
else # side
delta = (@face.bitmap.height - self.height) / 2
@face.y = self.y - delta
@face_offset = 0
end

# picture x-coordinate
if $game_system.face_graphic_justification == LEFT
if $game_system.face_graphic_position == SIDE
@face.x = self.x - @face.bitmap.width
else
@face.x = self.x + 10
end
else # right side
if $game_system.animated_faces
offset = @face.bitmap.width - $game_system.face_frame_width
else
offset = 0
end
if $game_system.face_graphic_position == SIDE
@face.x = self.x + self.width + offset
else
@face.x = self.x + self.width - @face.bitmap.width - 10 + offset
@face_offset = 0
end
end

if $game_system.animated_faces
@face.src_rect = Rect.new(@face_frame * $game_system.face_frame_width, 0, $game_system.face_frame_width, @face.bitmap.height)
if @done and $game_system.resting_face != ""
pause = $game_system.resting_animation_pause
else
pause = $game_system.animation_pause
end
if Graphics.frame_count % pause == 0
@animate_face = true
end
if @animate_face
if Graphics.frame_count % 3 == 0
@face_frame += 1
if @face_frame * $game_system.face_frame_width >= @face.bitmap.width
@face_frame = 0
@animate_face = false
end
end
end
end
end

# name window
if $game_system.name != ""
@name_window.x = self.x
@name_window.y = self.y - 36
@name_window.set_name($game_system.name)
end

# If choice
if $game_temp.choice_max > 0
@choice_window.set_choices($game_temp.choices)
# determine x and y coords for choice window
if $game_system.choice_justification == LEFT
@choice_window.x = self.x
else
@choice_window.x = self.x + self.width - @choice_window.width
end
if $game_system.choice_position == ABOVE
# check to make sure there is enough room above the textbox
if self.y < @choice_window.height
# not enough room above, place below
@choice_window.y = self.y + self.height
else
# draw above
@choice_window.y = self.y - @choice_window.height
end
elsif $game_system.choice_position == BOTTOM
# check to make sure there is enough room below the textbox
if (480 - self.y - self.height) < @choice_window.height
# not enough room below, place above
@choice_window.y = self.y - @choice_window.height
else
# draw below
@choice_window.y = self.y + self.height
end
else # side
if $game_system.choice_justification == LEFT
# check to make sure there's room on the left side
if self.y < @choice_window.width
# not enough room on the side, check to make sure there's room below
if (480 - self.y - self.height) < @choice_window.height
# not enough room below, place above
@choice_window.y = self.y - @choice_window.height
else
# draw below
@choice_window.y = self.y + self.height
end
else
# place on the left side
@choice_window.y = self.y
@choice_window.x = self.x - @choice_window.width
end
else # right
# check to make sure there's room on the right side
if (680 - (self.y + self.width)) < @choice_window.width
# not enough room on the side, check to make sure there's room below
if (480 - self.y - self.height) < @choice_window.height
# not enough room below, place above
@choice_window.y = self.y - @choice_window.height
else
# draw below
@choice_window.y = self.y + self.height
end
else
# place on the left side
@choice_window.y = self.y
@choice_window.x = self.x + self.width
end
end
end
end

# If number input
if $game_temp.num_input_variable_id > 0
if @input_number_window == nil
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new(digits_max)
@input_number_window.number = number
end
# determine x and y coords for number input window
if $game_system.choice_justification == LEFT
@input_number_window.x = self.x
else
@input_number_window.x = self.x + self.width - @input_number_window.width
end
if $game_system.choice_position == ABOVE
# check to make sure there is enough room above the textbox
if self.y < @input_number_window.height
# not enough room above, place below
@input_number_window.y = self.y + self.height
else
# draw above
@input_number_window.y = self.y - @choice_window.height
end
elsif $game_system.choice_position == BOTTOM
# check to make sure there is enough room below the textbox
if (480 - self.y - self.height) < @input_number_window.height
# not enough room below, place above
@input_number_window.y = self.y - @input_number_window.height
else
# draw below
@input_number_window.y = self.y + self.height
end
else # side
if $game_system.choice_justification == LEFT
# check to make sure there's room on the left side
if self.y < @input_number_window.width
# not enough room on the side, check to make sure there's room below
if (480 - self.y - self.height) < @input_number_window.height
# not enough room below, place above
@input_number_window.y = self.y - @input_number_window.height
else
# draw below
@input_number_window.y = self.y + self.height
end
else
# place on the left side
@input_number_window.y = self.y
@input_number_window.x = self.x - @choice_window.width
end
else # right
# check to make sure there's room on the right side
if (680 - (self.y + self.width)) < @input_number_window.width
# not enough room on the side, check to make sure there's room below
if (480 - self.y - self.height) < @input_number_window.height
# not enough room below, place above
@input_number_window.y = self.y - @input_number_window.height
else
# draw below
@input_number_window.y = self.y + self.height
end
else
# place on the left side
@input_number_window.y = self.y
@input_number_window.x = self.x + self.width
end
end
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super

if (@contents_showing and $game_system.message_event != -1 and $game_system.shake == 0) or $game_system.animated_faces
reset_window(false)
end

if $game_system.shake != 0 # shake the window
if @ascending
if @target_x != self.x
self.x += 1
else
@ascending = false
@target_x = self.x - ($game_system.shake * 2)
end
else
if @target_x != self.x
self.x -= 1
else
@ascending = true
@target_x = self.x + ($game_system.shake * 2)
end
end
end

@name_window.update

if @wait > 0
@wait -= 1
if @wait == 0
terminate_message
return
end
end

# If fade in
if @fade_in
if $game_temp.message_text == ""
@fade_in = false
return
end
self.contents_opacity += 24
if $game_system.face_graphic != ""
@face.opacity += 24
end
if $game_system.window_image != nil
@window_back.opacity += 24
end
if $game_system.comic_enabled and $game_system.message_event != -1
@comic.opacity = self.opacity
@comic.visible = self.visible
end

if $game_system.name != "" and @show
@name_window.visible = true
if $game_system.name_window
@name_window.dummy_window.visible = true
end
end
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
end

# write the text
if @text != nil and @text != ""
speed = $game_system.write_speed
if $game_system.text_mode == ALL_AT_ONCE or $game_temp.in_battle
while (c = @text.slice!(/./m)) != nil
write_char(c)
end
$game_system.slave_windows.each_value { |window| window.write_all }
return
end
if $game_system.text_skip
if $game_system.skip_mode == WRITE_FASTER and Input.press?(Input::C)
# the player is holding the action button, write faster
speed /= 3
elsif $game_system.skip_mode == WRITE_ALL and Input.trigger?(Input::C)
# the player pressed the action button, write all the text
while (c = @text.slice!(/./m)) != nil
write_char(c)
end
$game_system.slave_windows.each_value { |window| window.write_all }
return
end
end
while @ignore
c = @text.slice!(/./m)
if c != nil
write_char(c)
end
end
if @pause_time > 0
@pause_time -= 1
return
end
if Graphics.frame_count - @count >= speed
if $game_system.sound_effect != ""
Audio.se_play("Audio/SE/" + $game_system.sound_effect, 80, 100)
end
@count = Graphics.frame_count
c = @text.slice!(/./m)
if c != nil
write_char(c)
end
end
return
end

if $game_system.animated_faces and $game_system.resting_face != ""
@done = true
end

# If inputting number
if @input_number_window != nil
@input_number_window.update
# Confirm
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[$game_temp.num_input_variable_id] =
@input_number_window.number
$game_map.need_refresh = true
# Dispose of number input window
@input_number_window.dispose
@input_number_window = nil
terminate_message
end
return
end

if @wait != 0
return
end

# If message is being displayed and contents are all written
if @contents_showing
# if choice
if $game_temp.choice_max > 0
if !@choice_window.active
@choice_window.visible = true
@choice_window.active = true
@choice_window.index = 0
end
@choice_window.update
else
# If choice isn't being displayed, show pause sign
self.pause = $game_system.show_pause
end
# Cancel
if Input.trigger?(Input::B)
if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
$game_system.se_play($data_system.cancel_se)
$game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
terminate_message
end
end
# Confirm
if Input.trigger?(Input::C) and !(@wait > 0)
@done = true
$game_system.slave_windows.each_value { |window|
window.write_all
if !window.done
@done = false
end
}
if @done
if $game_temp.choice_max > 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(@choice_window.index)
end
terminate_message
else
@finishing_up = true
end
end
return
end

if @finishing_up
$game_system.slave_windows.each_value { |window|
if !window.done
@done = true
break
end
}

if @done = false
terminate_message
end
end
# If display wait message or choice exists when not fading out
if @fade_out == false and $game_temp.message_text != nil
@contents_showing = true
$game_temp.message_window_showing = true

reset_window
refresh
Graphics.frame_reset
if @show
self.visible = true
end
self.contents_opacity = 0
if @input_number_window != nil
@input_number_window.contents_opacity = 0
end
@fade_in = true
return
end
# If message which should be displayed is not shown, but window is visible
if self.visible
@fade_out = true
self.opacity -= 48
@name_window.opacity -= 48
@comic.opacity -= 48
@face.opacity -= 48
@window_back.opacity -= 48
if self.opacity == 0
self.visible = false
@face.opacity = 0
@window_back.opacity = 0
@choice_window.visible = false
@choice_window.active = false
@comic.opacity = 0
@name_window.visible = false
@name_window.dummy_window.visible = false
@name_window.update
@fade_out = false
$game_temp.message_window_showing = false
end
return
end

if $game_temp.battle_calling or $game_temp.shop_calling or $game_temp.name_calling or $game_temp.menu_calling or $game_temp.save_calling or $game_temp.debug_calling

$game_system.indy_windows.each_pair {|name, window|
if window.show == true
window.dispose
$game_system.indy_windows.delete(name)
end
}
end
end

#--------------------------------------------------------------------------
# * Process and write the given character
#--------------------------------------------------------------------------
def write_char(c)
if c == "\000"
# Return to original text
c = "\\"
end
# If \C[n]
if c == "\001"
# Change text color
@text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
# go to next text
return
end
# If \G
if c == "\002"
# Make gold window
if @gold_window == nil
@gold_window = Window_Gold.new
@gold_window.x = 560 - @gold_window.width
if $game_temp.in_battle
@gold_window.y = 192
else
@gold_window.y = self.y >= 128 ? 32 : 384
end
@gold_window.opacity = self.opacity
@gold_window.back_opacity = self.back_opacity
end
# go to next text
return
end
# If \skip
if c == "\003"
# toggle text skipping
$game_system.text_skip = !$game_system.text_skip
# go to next text
return
end
# If \b
if c == "\004"
# toggle bold
self.contents.font.bold = !self.contents.font.bold
# go to next text
return
end
# If \i
if c == "\005"
# toggle italics
self.contents.font.italic = !self.contents.font.italic
# go to next text
return
end
# If \s
if c == "\006"
# toggle shadow
$game_system.shadowed_text = !$game_system.shadowed_text
# go to next text
return
end
# If \font
if c == "\007"
# change font
@text.sub!(/\[(.*?)\]/, "")
font = $1.to_s
$game_system.font = font
if font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = font
end
# go to next text
return
end
# If \p[n]
if c == "\010"
@text.sub!(/\[([0-9]+)\]/, "")
@pause_time = $1.to_i
# go to next text
return
end

# If \w[n]
if c == "\011"
@text.sub!(/\[([0-9]+)\]/, "")
@wait = $1.to_i
# go to next text
return
end

# If \ws[n]
if c == "\013"
@text.sub!(/\[([0-9]+)\]/, "")
$game_system.write_speed = $1.to_i
# go to next text
return
end
# If \oa[n]
if c == "\014"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_armors[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
line = self.contents.text_size("dj").height
self.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24
# go to next text
return
end

# If \oi[n]
if c == "\015"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_items[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
line = self.contents.text_size("dj").height
self.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24
# go to next text
return
end

# If \os[n]
if c == "\016"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_skills[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
line = self.contents.text_size("dj").height
self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24
# go to next text
return
end

# If \ow[n]
if c == "\017"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_weapons[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
line = self.contents.text_size("dj").height
self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24

# go to next text
return
end

# If c
if c == "\020"
# center justify
$game_system.text_justification = CENTER
get_x_value
# go to next text
return
end

# If l
if c == "\021"
# left justify
$game_system.text_justification = LEFT
get_x_value
# go to next text
return
end

# If r
if c == "\022"
# right justify
$game_system.text_justification = RIGHT
get_x_value
# go to next text
return
end

# If \ignr
if c == "\023"
# set ignore flage
@ignore = true
# go to next text
return
end

# if \slv
if c == "\024"
# we need to show a slave window
@text.sub!(/\[(.*?)\]/, "")
name = $1.to_s
$game_system.slave_windows[name].show = true
return
end

# if \ind
if c == "\025"
# we need to show a independent window
@text.sub!(/\[(.*?)\]/, "")
name = $1.to_s
if $game_system.indy_windows[name].show
$game_system.indy_windows[name].dispose
$game_system.indy_windows.delete(name)
else
$game_system.indy_windows[name].show = true
end
return
end

# if \c (hex color)
if c == "\026"
# convert hex color to RGB
@text.sub!(/\[([0123456789abcdef]+)\]/, "")
hex_code = $1.to_s

red = ("0x" + hex_code.slice(0..1)).hex
blue = ("0x" + hex_code.slice(2..3)).hex
green = ("0x" + hex_code.slice(4..5)).hex

self.contents.font.color = Color.new(red, blue, green)
return
end

# If new line text
if c == "\n"
# Add 1 to y
if !@ignore
@y += 1
end
if @text != ""
get_x_value
end
@ignore = false
# go to next text
return
end
if @ignore
return
end
# Draw text
line = self.contents.text_size("dj").height
if $game_system.shadowed_text
old_color = self.contents.font.color.clone
self.contents.font.color = $game_system.shadow_color
self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)
self.contents.font.color = old_color
end
self.contents.draw_text(4 + @x, line * @y, 40, 32, c)
# Add x to drawn text width
@x += self.contents.text_size(c).width
end

def get_x_value
# text justification - offset for first line
if $game_system.text_justification == CENTER
# get the length of the current line
w = self.contents.text_size(@text.split("\n")[0]).width
@x = (self.width - w - 48) / 2
elsif $game_system.text_justification == RIGHT
# get the length of the current line
w = self.contents.text_size(@text.split("\n")[0]).width
@x = self.width - w - 48
else # left
if $game_system.face_graphic == ""
@x = 0
else
@x = @face_offset
end
end
end

end
#==============================================================================
# ** Window_Choice
#------------------------------------------------------------------------------
# This message window is used to display choices.
#==============================================================================
class Window_Choice < Window_Selectable
def initialize (choices)
super(0, 0, 32, choices.size * 32)
self.visible = false
self.active = false
self.z = 9999
@index = 0
@item_max = choices.size
@choices = choices
self.contents = Bitmap.new(32, 32)
self.opacity = $game_system.opacity
self.back_opacity = $game_system.back_opacity
end

def refresh
# determine necessary width
width = 64
for line in @choices
width = [width, (self.contents.text_size(line).width + 48)].max
end
self.width = width
self.height = @choices.size * 32 + 32
self.contents = Bitmap.new(width - 32, height - 32)
if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
if $game_system.windowskin != ""
self.windowskin = RPG::Cache.windowskin($game_system.windowskin)
else
self.windowskin = RPG::Cache.windowskin($data_system.windowskin_name)
end

# draw choices
y = 0
for line in @choices
# Draw text
if $game_system.shadowed_text
old_color = self.contents.font.color.clone
self.contents.font.color = $game_system.shadow_color
self.contents.draw_text(6, 32 * y + 2, width, 32, line)
self.contents.font.color = old_color
end
self.contents.draw_text(4, y * 32, width, 32, line)
y += 1
end
end

def set_choices(choices)
@choices = choices
@item_max = @choices.size
for choice in @choices
choice.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
choice.gsub!(/\\[Nn]\[([0-9]+)\]/) {
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
}
end
refresh
end
end
#==============================================================================
# ** Window_Name
#------------------------------------------------------------------------------
# This window is used to display names above the message window. Uncomment
# and modify the various sections to customize.
#==============================================================================
class Window_Name < Window_Base
attr_accessor :dummy_window

def initialize
super(0, 0, 32, 64)
self.contents = Bitmap.new(32, 32)
self.opacity = 0


@dummy_window = Window_Dummy.new

self.visible = false
end

def set_name(name)
@name = name
refresh
end

def refresh
if @name == nil
return
end
self.width = self.contents.text_size(@name).width + 48
self.contents = Bitmap.new(width - 32, height - 32)


if $game_system.name_window
@dummy_window.x = self.x
@dummy_window.y = self.y + 12
@dummy_window.set(height - 24, width - 12)
end

if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
# uncomment this and change the font to give the name window a fancy font
#self.contents.font.name = "Ariel"
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(0, 0, self.width, 32, @name)
self.contents.draw_text(0, 2, self.width, 32, @name)
self.contents.draw_text(2, 0, self.width, 32, @name)
self.contents.draw_text(2, 2, self.width, 32, @name)
# change the color to give the name window a seperate color
self.contents.font.color = normal_color
self.contents.draw_text(1, 1, self.width, 32, @name)
end

def visible=(v)
if $game_system.name_window
@dummy_window.visible = v
end
super(v)
end



def update
super
if $game_system.name_window
@dummy_window.x = self.x
@dummy_window.y = self.y + 12
@dummy_window.update
end
end

def dispose
@dummy_window.dispose
super
end
end
class Window_Dummy < Window_Base
def initialize
super(0, 0, 32, 64)
self.z = 9999
self.visible = false

end

def set(height, width)
self.height = height
self.width = width
end

def update
super
if $game_system.windowskin != ""
self.windowskin = RPG::Cache.windowskin($game_system.windowskin)
else
self.windowskin = RPG::Cache.windowskin($data_system.windowskin_name)
end
# self.windowskin = RPG::Cache.windowskin('sandstone')
end
end
#==============================================================================
# ** Window_Slave
#------------------------------------------------------------------------------
# These are slave windows to the main message window. They will close when
# the user terminates them. Initial settings are identical to the main
# message window, with one exception. When in normal mode, it will apear
# above if the main message is below, below if it is above or centered. Use
# message codes to change the settings for this window.
#==============================================================================
class Window_Slave < Window_Base
attr_accessor :show
attr_reader :done

def write_all
@write_all = true
end

#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize (text)
super(0, 0, 33, 33)
@text = text

# x-coordinate depends on justification
if @justification == RIGHT
self.x = 640 - self.width
elsif @justification == LEFT
self.x = 0
else # center
self.x = (640 - self.width) / 2
end
# y-coordinate depends on height
self.y = 480 - $game_system.window_height - 16
self.contents = Bitmap.new(width - 32, height - 32)
if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
self.visible = false
self.z = 9998
@fade_in = false
@fade_out = false
@contents_showing = false

# face graphic sprite
@face = Sprite.new
@face.opacity = 0
@face.z = self.z + 1
@face_offset = 0

# choice window
@choice_window = Window_Choice.new([])
@choice_window.back_opacity = $game_system.back_opacity

@comic_style = $game_system.comic_style
@name = $game_system.name

# comic sprite
@comic = Sprite.new
@comic.opacity = 0
@comic.z = self.z + 1
if @comic_style == TALK1
@comic.bitmap = RPG::Cache.windowskin("gallery_24241_32_870")
elsif @comic_style == TALK2
@comic.bitmap = RPG::Cache.windowskin("talk2")
else # thought
@comic.bitmap = RPG::Cache.windowskin("thought")
end



@pause_time = 0
@wait = 0

@mode = $game_system.ums_mode
self.height = $game_system.window_height
self.width = $game_system.window_width
@justification = $game_system.window_justification
@face_graphic = $game_system.face_graphic
@face_graphic_justification = $game_system.face_graphic_justification
@message_event = $game_system.message_event
if $game_system.message_position == 2 # down
@message_position = 0
else
@message_postion = 2
end
@face_graphic_position = $game_system.face_graphic_position
if $game_system.font == ""
@font = Font.default_name
else
@font = $game_system.font
end
@text_justification = $game_system.text_justification

@shake = $game_system.shake

@face_frame = 0

refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
terminate_message
$game_temp.message_window_showing = false
if @input_number_window != nil
@input_number_window.dispose
end
@face.dispose
@choice_window.dispose
@comic.dispose
if @name_window != nil
@name_window.dispose
end
super
end
#--------------------------------------------------------------------------
# * Terminate Message
#--------------------------------------------------------------------------
def terminate_message
self.active = false
self.pause = false
self.contents.clear
# Clear showing flag
@contents_showing = false
# Call message callback
if $game_temp.message_proc != nil
$game_temp.message_proc.call
end
# Clear variables related to text, choices, and number input
$game_temp.message_text = nil
$game_temp.message_proc = nil
$game_temp.choice_start = 99
$game_temp.choice_max = 0
$game_temp.choice_cancel_type = 0
$game_temp.choice_proc = nil
$game_temp.num_input_start = 99
$game_temp.num_input_variable_id = 0
$game_temp.num_input_digits_max = 0
# Open gold window
if @gold_window != nil
@gold_window.dispose
@gold_window = nil
end
@choice_window.visible = false
@choice_window.active = false
@comic.opacity = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh

self.contents.clear
if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
if $game_system.windowskin != ""
self.windowskin = RPG::Cache.windowskin($game_system.windowskin)
else
self.windowskin = RPG::Cache.windowskin($data_system.windowskin_name)
end
@x = @y = 0
# If waiting for a message to be displayed
if @text != nil
# replace shortcuts with original code
$game_system.shortcuts.each { |shortcut, code|
@text.gsub!(shortcut, code)
}

# Control text processing
begin
last_text = @text.clone
@text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until @text == last_text
@text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end

# window mode
if @text.index(/\\[Mm]/) != nil
if $game_system.ums_mode == NORMAL_MODE
@mode = FIT_WINDOW_TO_TEXT
else
@mode = NORMAL_MODE
end
@text.gsub!(/\\[Mm]/) { "" }
end

# window height
@text.gsub!(/\\[Hh][Ee][Ii][Gg][Hh][Tt]\[([0-9]+)\]/) do
self.height = $1.to_i
""
end

# window width
@text.gsub!(/\\[Ww][Ii][Dd][Tt][Hh]\[([0-9]+)\]/) do
self.width = $1.to_i
""
end

# justification
@text.gsub!(/\\[Jj][Rr]/) do
@justification = RIGHT
reset_window
""
end
@text.gsub!(/\\[Jj][Cc]/) do
@justification = CENTER
reset_window
""
end
@text.gsub!(/\\[Jj][Ll]/) do
@justification = LEFT
reset_window
""
end

# face graphics
@text.gsub!(/\\[Ff][Aa][Cc][Ee]\[(.*?)\]/) do
@face_graphic = $1.to_s
if $1.to_s == ""
@face.opacity = 0
end
""
end
@text.gsub!(/\\[Ff][Ll]/) do
@face_graphic_justification = LEFT
""
end
@text.gsub!(/\\[Ff][Rr]/) do
@face_graphic_justification = RIGHT
""
end

# event centering
@text.gsub!(/\\[Ee]\[([0-9]+)\]/) do
@message_event = $1.to_i
""
end

# comic thingy
@text.gsub!(/\\[Tt]1/) do
@comic_style = TALK1
@comic.bitmap = RPG::Cache.windowskin("gallery_24241_32_870")
""
end
@text.gsub!(/\\[Tt]2/) do
@comic_style = TALK2
@comic.bitmap = RPG::Cache.windowskin("talk2.png")
""
end
@text.gsub!(/\\[Tt][Hh]/) do
@comic_style = THOUGHT
@comic.bitmap = RPG::Cache.windowskin("thought.png")
""
end

# name window
@text.gsub!(/\\[Nn][Mm]\[(.*?)\]/) do
@name = $1.to_s
if $1.to_s == "" and @name_window != nil
@name_window.visible = false
end
""
end
if @name != ""
# name window
@name_window = Window_Name.new
@name_window.z = self.z + 1
@name_window.set_name(@name)
end

# shaking
@text.gsub!(/\\[Ss][Hh][Kk]\[([0-9]+)\]/) do
@shake = $1.to_i
""
end

# back opacity
@text.gsub!(/\\[Bb][Oo][Pp][Cc]\[([0-9]+)\]/) do
self.back_opacity = $1.to_i
""
end

# opacity
@text.gsub!(/\\[Oo][Pp][Cc]\[([0-9]+)\]/) do
self.opacity = $1.to_i
""
end

# Change "\\\\" to "\000" for convenience
@text.gsub!(/\\\\/) { "\000" }
# Change "\\C" to "\001" and "\\G" to "\002"
@text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
@text.gsub!(/\\[Gg]/) { "\002" }
@text.gsub!(/\\[Cc]\[0x([0123456789abcdef]+)\]/) { "\026[#{$1}]" }

# text skip code
@text.gsub!(/\\[Ss][Kk][Ii][Pp]/) { "\003" }

# ignore code
@text.gsub!(/\\[Ii][Gg][Nn][Rr]/) { "\023" }

# bold and italics
@text.gsub!(/\\[Bb]/) { "\004" }
@text.gsub!(/\\[Ii]/) { "\005" }

# shadow
@text.gsub!(/\\[Ss]/) { "\006" }

# font
@text.gsub!(/\\[Ff][Oo][Nn][Tt]\[(.*?)\]/) { "\007[#{$1}]" }

# pause and wait
@text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "\010[#{$1}]" }
@text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\011[#{$1}]" }

# write speed
@text.gsub!(/\\[Ww][Ss]\[([0-9]+)\]/) { "\013[#{$1}]" }

# armor, items, skills, and weapons
@text.gsub!(/\\[Oo][Aa]\[([0-9]+)\]/) {
item = $data_armors[$1.to_i]
"\014[#{$1}]" + " " + item.name
}
@text.gsub!(/\\[Oo][Ii]\[([0-9]+)\]/) {
item = $data_items[$1.to_i]
"\015[#{$1}]" + " " + item.name
}
@text.gsub!(/\\[Oo][Ss]\[([0-9]+)\]/) {
item = $data_skills[$1.to_i]
"\016[#{$1}]" + " " + item.name
}
@text.gsub!(/\\[Oo][Ww]\[([0-9]+)\]/) {
item = $data_weapons[$1.to_i]
"\017[#{$1}]" + " " + item.name
}

# text justification
@text.gsub!(/\\[Tt][Cc]/) { "\020" }
@text.gsub!(/\\[Tt][Ll]/) { "\021" }
@text.gsub!(/\\[Tt][Rr]/) { "\022" }

# Resize the window to fit the contents?
if @mode == FIT_WINDOW_TO_TEXT
width = 1
text = @text.split("\n")
height = 0
i = 0
for line in text
# don't count this line's width if it has the ignr code
if !line.include?("\023")
width = [width, self.contents.text_size(line).width].max
delta = self.contents.text_size(line).height
height += delta + (6 * i) + 3
if i < 3
i += 1
end
end
end

if @face_graphic != "" and ($game_system.face_graphic_position == CENTER or $game_system.face_graphic_position == BOTTOM)
width += @face.bitmap.width
if height < @face.bitmap.height
height = @face.bitmap.height - 32
end
end

if height == 0
height = 1
end

self.width = width + 48
self.height = height + 48
self.contents = Bitmap.new(width + 16, height)
if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
else
if self.width != $game_system.window_height or self.height != $game_system.window_width
self.width = $game_system.window_width
self.height = $game_system.window_height
self.contents = Bitmap.new(self.width - 32, self.height - 32)
if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
end
end

reset_window

get_x_value

@count = Graphics.frame_count
@pause_time = 0
@ignore = false
@done = false
@face_frame = 0
end



# If number input
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new(digits_max)
@input_number_window.number = number
@input_number_window.x = self.x + 8
@input_number_window.y = self.y + $game_temp.num_input_start * 32
end
end
#--------------------------------------------------------------------------
# * Set Window Position and Opacity Level
#--------------------------------------------------------------------------
def reset_window (change_opacity = true)
# x-coordinate depends on justification
if @message_event == -1
if @justification == RIGHT
self.x = 640 - self.width
elsif @justification == LEFT
self.x = 0
else # center
self.x = (640 - self.width) / 2
end
else
if @message_event == 0 or $game_map.events[@message_event] == nil
# center on player
event_x = $game_player.screen_x
else
# center on the event specified
event_x = $game_map.events[@message_event].screen_x
end
self.x = event_x - self.width / 2
@comic.x = self.x + (self.width / 2) + 4
end

if $game_temp.in_battle
self.y = 16
else
if @message_event == -1
case @message_position
when 0 # up
self.y = 16
when 1 # middle
self.y = (480 - self.height) / 2
when 2 # down
self.y = 480 - self.height - 24
end
else
if @message_event == 0 or $game_map.events[@message_event] == nil
# above player
self.y = $game_player.screen_y - self.height - 48
else
# above event specified
self.y = $game_map.events[@message_event].screen_y - self.height - 48
end
@comic.y = self.y + self.height - 2
end
end
if self.y < 0 + (@name == "" ? 0 : 16)
self.y = 0 + (@name == "" ? 0 : 16)
elsif self.y > 480 - self.height
self.y = 480 - self.height
end
if self.x < 0
self.x = 0
elsif self.x > 680 - self.width - 48
self.x = 640 - self.width
end

if change_opacity
if $game_system.message_frame == 0
self.opacity = 255
else
self.opacity = 0
end
self.back_opacity = $game_system.back_opacity
end

# face stuff
if @face_graphic != ""
# the player has chosen to show a face graphic
if @done and $game_system.resting_face != ""
@face.bitmap = RPG::Cache.picture(@face_graphic + $game_system.resting_face)
if @face_frame * $game_system.face_frame_width >= @face.bitmap.width
@face_frame = 0
end
else
@face.bitmap = RPG::Cache.picture(@face_graphic)
end

# picture y-coordinate
if @face_graphic_position == ABOVE
@face.y = self.y - @face.bitmap.height
@face_offset = 0
elsif @face_graphic_position == CENTER
delta = (@face.bitmap.height - self.height) / 2
@face.y = self.y - delta
if $game_system.animated_faces
@face_offset = $game_system.face_frame_width + 16
else
@face_offset = @face.bitmap.width + 16
end
elsif @face_graphic_position == BOTTOM
@face.y = self.y + self.height - @face.bitmap.height
if $game_system.animated_faces
@face_offset = $game_system.face_frame_width + 16
else
@face_offset = @face.bitmap.width + 16
end
else # side
delta = (@face.bitmap.height - self.height) / 2
@face.y = self.y - delta
@face_offset = 0
end

# picture x-coordinate
if @face_graphic_justification == LEFT
if @face_graphic_position == SIDE
@face.x = self.x - @face.bitmap.width
else
@face.x = self.x + 10
end
else
if $game_system.animated_faces
offset = @face.bitmap.width - $game_system.face_frame_width
else
offset = 0
end
if @face_graphic_position == SIDE
@face.x = self.x + self.width + offset
else
@face.x = self.x + self.width - @face.bitmap.width - 10 + offset
@face_offset = 0
end
end

if $game_system.animated_faces
@face.src_rect = Rect.new(@face_frame * $game_system.face_frame_width, 0, $game_system.face_frame_width, @face.bitmap.height)
if @done and $game_system.resting_face != ""
pause = $game_system.resting_animation_pause
else
pause = $game_system.animation_pause
end
if Graphics.frame_count % pause == 0
@animate_face = true
end
if @animate_face
if Graphics.frame_count % 3 == 0
@face_frame += 1
if @face_frame * $game_system.face_frame_width >= @face.bitmap.width
@face_frame = 0
@animate_face = false
end
end
end
end
end

# name window
if @name != "" and @name != nil
@name_window.set_name(@name)
@name_window.x = self.x
@name_window.y = self.y - 36
end

# If choice
if $game_temp.choice_max > 0
@choice_window.set_choices($game_temp.choices)
# determine x and y coords for choice window
if $game_system.choice_justification == LEFT
@choice_window.x = self.x
else
@choice_window.x = self.x + self.width - @choice_window.width
end
if $game_system.choice_position == ABOVE
# check to make sure there is enough room above the textbox
if self.y < @choice_window.height
# not enough room above, place below
@choice_window.y = self.y + self.height
else
# draw above
@choice_window.y = self.y - @choice_window.height
end
elsif $game_system.choice_position == BOTTOM
# check to make sure there is enough room below the textbox
if (480 - self.y - self.height) < @choice_window.height
# not enough room below, place above
@choice_window.y = self.y - @choice_window.height
else
# draw below
@choice_window.y = self.y + self.height
end
else # side
if $game_system.choice_justification == LEFT
# check to make sure there's room on the left side
if self.y < @choice_window.width
# not enough room on the side, check to make sure there's room below
if (480 - self.y - self.height) < @choice_window.height
# not enough room below, place above
@choice_window.y = self.y - @choice_window.height
else
# draw below
@choice_window.y = self.y + self.height
end
else
# place on the left side
@choice_window.y = self.y
@choice_window.x = self.x - @choice_window.width
end
else # right
# check to make sure there's room on the right side
if (680 - (self.y + self.width)) < @choice_window.width
# not enough room on the side, check to make sure there's room below
if (480 - self.y - self.height) < @choice_window.height
# not enough room below, place above
@choice_window.y = self.y - @choice_window.height
else
# draw below
@choice_window.y = self.y + self.height
end
else
# place on the left side
@choice_window.y = self.y
@choice_window.x = self.x + self.width
end
end
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super

if !@show
return
else
self.visible = true
if @face_graphic != ""
@face.opacity = 255
end
if $game_system.comic_enabled and @message_event != -1
@comic.opacity = 255
end
if @name != ""
@name_window.visible = true
if $game_system.name_window
@name_window.dummy_window.visible = true
end
end
if @input_number_window != nil
@input_number_window.contents_opacity = 255
end
reset_window
end


if (@contents_showing and $game_system.message_event != -1 and @shake == 0) or $game_system.animated_faces
reset_window(false)
end

if $game_system.shake != 0 # shake the window
if @ascending
if @target_x != self.x
self.x += 1
else
@ascending = false
@target_x = self.x - ($game_system.shake * 2)
end
else
if @target_x != self.x
self.x -= 1
else
@ascending = true
@target_x = self.x + ($game_system.shake * 2)
end
end
end

if @wait > 0
@wait -= 1
if @wait == 0
terminate_message
return
end
end

# If fade in
if @fade_in
self.contents_opacity += 24
if @face_graphic != ""
@face.opacity += 24
end
if $game_system.comic_enabled and @message_event != -1
@comic.opacity += 24
end
if @name != ""
@name_window.visible = true
end
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
end

# write the text
if @text != nil and @text != ""
speed = $game_system.write_speed
if $game_system.text_skip
if $game_system.skip_mode == WRITE_FASTER and Input.press?(Input::C)
# the player is holding the action button, write faster
speed /= 3
elsif $game_system.skip_mode == WRITE_ALL and @write_all
# the player pressed the action button, write all the text
while (c = @text.slice!(/./m)) != nil
write_char(c)
end
return
end
end
while @ignore
c = @text.slice!(/./m)
if c != nil
write_char(c)
end
end
if @pause_time > 0
@pause_time -= 1
return
end
if Graphics.frame_count - @count >= speed
if $game_system.sound_effect != ""
Audio.se_play("Audio/SE/" + $game_system.sound_effect, 80, 100)
end
@count = Graphics.frame_count
c = @text.slice!(/./m)
if c != nil
write_char(c)
end
end
return
end

@done = true

# If inputting number
if @input_number_window != nil
@input_number_window.update
# Confirm
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[$game_temp.num_input_variable_id] =
@input_number_window.number
$game_map.need_refresh = true
# Dispose of number input window
@input_number_window.dispose
@input_number_window = nil
terminate_message
end
return
end

if @wait != 0
return
end

# If message is being displayed and contents are all written
if @contents_showing
# if choice
if $game_temp.choice_max > 0
if !@choice_window.active
@choice_window.visible = true
@choice_window.active = true
@choice_window.index = 0
end
@choice_window.update
else
# If choice isn't being displayed, show pause sign
self.pause = true
end
return
end
end

#--------------------------------------------------------------------------
# * Process and write the given character
#--------------------------------------------------------------------------
def write_char(c)
if c == "\000"
# Return to original text
c = "\\"
end
# If \C[n]
if c == "\001"
# Change text color
@text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
# go to next text
return
end
# If \G
if c == "\002"
# Make gold window
if @gold_window == nil
@gold_window = Window_Gold.new
@gold_window.x = 560 - @gold_window.width
if $game_temp.in_battle
@gold_window.y = 192
else
@gold_window.y = self.y >= 128 ? 32 : 384
end
@gold_window.opacity = self.opacity
@gold_window.back_opacity = self.back_opacity
end
# go to next text
return
end
# If \skip
if c == "\003"
# toggle text skipping
#$game_system.text_skip = !$game_system.text_skip
# go to next text
return
end
# If \b
if c == "\004"
# toggle bold
self.contents.font.bold = !self.contents.font.bold
# go to next text
return
end
# If \i
if c == "\005"
# toggle italics
self.contents.font.italic = !self.contents.font.italic
# go to next text
return
end
# If \s
if c == "\006"
# toggle shadow
#$game_system.shadowed_text = !$game_system.shadowed_text
# go to next text
return
end
# If \font
if c == "\007"
# change font
@text.sub!(/\[(.*?)\]/, "")
font = $1.to_s
@font = font
if font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = font
end
# go to next text
return
end
# If \p[n]
if c == "\010"
@text.sub!(/\[([0-9]+)\]/, "")
@pause_time = $1.to_i
# go to next text
return
end

# If \w[n]
if c == "\011"
@text.sub!(/\[([0-9]+)\]/, "")
@wait = $1.to_i
# go to next text
return
end

# If \ws[n]
if c == "\013"
@text.sub!(/\[([0-9]+)\]/, "")
$game_system.write_speed = $1.to_i
# go to next text
return
end
# If \oa[n]
if c == "\014"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_armors[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24
# go to next text
return
end

# If \oi[n]
if c == "\015"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_items[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24
# go to next text
return
end

# If \os[n]
if c == "\016"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_skills[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24
# go to next text
return
end

# If \ow[n]
if c == "\017"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
@text.sub!(" ", "")
item = $data_weapons[index]
# draw the icon
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(@x + 2, (@y * 32) + 4, icon, Rect.new(0, 0, 24, 24))
@x += 24

# go to next text
return
end

# If c
if c == "\020"
# center justify
@text_justification = CENTER
get_x_value
# go to next text
return
end

# If l
if c == "\021"
# left justify
@text_justification = LEFT
get_x_value
# go to next text
return
end

# If r
if c == "\022"
# right justify
@text_justification = RIGHT
get_x_value
# go to next text
return
end

# If \ignr
if c == "\023"
# set ignore flage
@ignore = true
# go to next text
return
end

# if \c (hex color)
if c == "\026"
# convert hex color to RGB
@text.sub!(/\[([0123456789abcdef]+)\]/, "")
hex_code = $1.to_s

red = ("0x" + hex_code.slice(0..1)).hex
blue = ("0x" + hex_code.slice(2..3)).hex
green = ("0x" + hex_code.slice(4..5)).hex

self.contents.font.color = Color.new(red, blue, green)
return
end

# If new line text
if c == "\n"
# Add 1 to y
if !@ignore
@y += 1
end
if @text != ""
get_x_value
end
@ignore = false
# go to next text
return
end
if @ignore
return
end
# Draw text
line = self.contents.text_size("dj").height
if $game_system.shadowed_text
old_color = self.contents.font.color.clone
self.contents.font.color = $game_system.shadow_color
self.contents.draw_text(6 + @x, line * @y + 2, 40, 32, c)
self.contents.font.color = old_color
end
self.contents.draw_text(4 + @x, line * @y, 40, 32, c)
# Add x to drawn text width
@x += self.contents.text_size(c).width
end

def get_x_value
# text justification - offset for first line
if @text_justification == CENTER
# get the length of the current line
w = self.contents.text_size(@text.split("\n")[0]).width
@x = (self.width - w - 48) / 2
elsif @text_justification == RIGHT
# get the length of the current line
w = self.contents.text_size(@text.split("\n")[0]).width
@x = self.width - w - 48
else # left
if @face_graphic == ""
@x = 0
else
@x = @face_offset
end
end
end
end
#==============================================================================
# ** Window_InputNumber
#------------------------------------------------------------------------------
# This window is for inputting numbers, and is used within the
# message window.
#==============================================================================
class Window_InputNumber < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# digits_max : digit count
#--------------------------------------------------------------------------
def initialize(digits_max)
@digits_max = digits_max
@number = 0
# Calculate cursor width from number width (0-9 equal width and postulate)
dummy_bitmap = Bitmap.new(32, 32)
@cursor_width = dummy_bitmap.text_size("0").width + 8
dummy_bitmap.dispose
super(0, 0, @cursor_width * @digits_max + 32, 64)
self.contents = Bitmap.new(width - 32, height - 32)
if $game_system.font == ""
self.contents.font.name = Font.default_name
else
self.contents.font.name = $game_system.font
end
self.z += 9999
self.opacity = $game_system.opacity
self.back_opacity = $game_system.back_opacity
@index = 0
refresh
update_cursor_rect
end

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if $game_system.font_color.nil?
self.contents.font.color = normal_color
else
self.contents.font.color = $game_system.font_color
end
if $game_system.windowskin != ""
self.windowskin = RPG::Cache.windowskin($game_system.windowskin)
else
self.windowskin = RPG::Cache.windowskin($data_system.windowskin_name)
end
s = sprintf("%0*d", @digits_max, @number)
for i in 0...@digits_max
# Draw text
if $game_system.shadowed_text
old_color = self.contents.font.color.clone
self.contents.font.color = $game_system.shadow_color
self.contents.draw_text(i * @cursor_width + 6, 2, 32, 32, s[i,1])
self.contents.font.color = old_color
end
self.contents.draw_text(i * @cursor_width + 4, 0, 32, 32, s[i,1])
end
end
end[/spoiler]

second:
[spoiler]#===================================
# Leon's Mission Script v2.0
#----------------------------------------------------------------------
# 2006-09-22
#===================================
=begin
Description:
I did a drastic overhaul on this Mission/Quest script to make it much better and user friendly.
Features:
There is 2 new features:
1. If the user doesn't know of the mission, it doesn't appear in the list, nor does a slot for it.
2. Completed missions are in green.
3. Number of missions. (X/Y) X is completed missions, Y can be either known missions,
or your game's total missions. Set Mission_Setup to 'true' if you want known missions,
false for total.
Instructions:
Put it above main.
The instructions have changed alot more than the features. Just go through
the short list below, and you'll know. Just remember, go in order, and if you have 10
different missions in 1 spot, you must have the same number in each other segment
of the module, with the exception of the lines of text. (Yes, i made that one all the easier.)
Changing the status of the missions is different than before as well.
$game_party.mission[mission_id] = x
Mission ID: The ID of the mission, as defined in the module. In this example,
"Lost Cat" would be 0
X:
1 = they do not know the mission exists. This is optional, unless they forget a mission.
2 = they know the mission, but it is incomplete
3 = the mission is complete.
BY DEFAULT, ALL MISSIONS ARE UNKNOWN unless specified in the script before the game begins.
Do NOT post my work in any other forums without my permission, and NEVER take credit
for my work.
=end
#==================================
# ** Mission_Menu
#==================================
module Mission_Menu
#--------------------------------------------------------------------
# * Mission Name- Write the mission number, and the name you want to appear.
# ~ mission_id => "mission name"
#--------------------------------------------------------------------
Mission_Name = {
0 => "Lost Cat",
1 => "Old Blade",
2 => "Seize Sentries",
3 => "Hidden Heirloom",
4 => "A Gooey Mess.",
5 => "Hidden Horror"
}
#--------------------------------------------------------------------
# * Mission_Sprite. holds data on the name of the sprite, it's hue, name, locale, and
# * reward all in one.
# ~ mission_id => ["sprite name", hue, name, location, Reward]
#--------------------------------------------------------------------
Mission_Sprite = {
0 => ["113-Civilian13", 330, "Amy", "Logres", "Potion x 3"],
1 => ["005-Fighter05", 0, "L'eric", "Logres", "Rusty Sword"],
2 => ["002-Fighter02", 0, "Wallace", "Resistance H.Q.", "500 Gold"],
3 => ["122-Civilian22", 30, "Old Woman", "Cyris Home", "Sound Effect"],
4 => ["011-Lancer03", 0, "Soldier", "Cyris Barracks", "Kite Shield"],
5 => ["006-Fighter06", 0, "Lady", "Cyris", "Lion's Head Earring"]
}
#--------------------------------------------------------------------
# * Defines the mission. Remember, if it is too long for 1 line, you can drop it
# * down to line 2.
# ~ mission_id => "Line One"
#--------------------------------------------------------------------
Mission_L1 = {
0 => "Amy has lost her cat and needs help",
1 => "Somebody said they saw L'eric's blade",
2 => "Head north toward enemy territory, and",
3 => "Seek out the caverns south of Cyris. There",
4 => "A monster to the west of the town every",
5 => "Somewhere in the Belin Caverns, there is a"
}
#--------------------------------------------------------------------
# * Same as the above one.
# ~ mission_id => "Line Two"
#--------------------------------------------------------------------
Mission_L2 = {
0 => "finding him. He likes to play in the",
1 => "just south of here by the river. He ",
2 => "capture two sentry towers. Be careful ",
3 => "you will find a blue chest. Retrieve its",
4 => "now and then terrorizes the caravans.",
5 => "creature holding an item the lady in"
}
#--------------------------------------------------------------------
# * Same as the above one.
# ~ mission_id => "Line Three"
#--------------------------------------------------------------------
Mission_L3 = {
0 => " North East side of Tiberian Plains.",
1 => "wants Will to confirm the story, and",
2 => "and don't get caught. Return to Wallace",
3 => "contents and bring it back to the old",
4 => "A soldier in the barracks has asked you",
5 => "Cyris is looking for. She said the monster"
}
#--------------------------------------------------------------------
# * Same as the above one.
# ~ mission_id => "Line Four"
#--------------------------------------------------------------------
Mission_L4 = {
1 => "if it is true, bring back the sword.",
2 => "once this job is complete.",
3 => "woman.",
4 => "to exterminate it.",
5 => "would be hiding."
}
#--------------------------------------------------------------------
# * Same as the above one.
# ~ mission_id => "Line Five"
#--------------------------------------------------------------------
Mission_L5 = {
}
#--------------------------------------------------------------------
# * Same as the above one.
# ~ mission_id => "Line Six"
#--------------------------------------------------------------------
Mission_L6 = {
}
#--------------------------------------------------------------------
# * Same as the above one.
# ~ mission_id => "Line Seven"
#--------------------------------------------------------------------
Mission_L7 = {
}
#--------------------------------------------------------------------
# * Same as the above one.
# ~ mission_id => "Line Eight"
#--------------------------------------------------------------------
Mission_L8 = {
}
#--------------------------------------------------------------------
# * Mission Set-up
#--------------------------------------------------------------------
Mission_Setup = true
end
#----------------------------------------------------------------------
# * Game_Party
#----------------------------------------------------------------------
class Game_Party
#--------------------------------------------------------------------
# * Attributes
#--------------------------------------------------------------------
attr_accessor :mission
#--------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------
alias leon_gp_mission_initialize initialize
#--------------------------------------------------------------------
# * Object initialization
#--------------------------------------------------------------------
# Leon_Edit add an array for each mission in @mission.
# [mission_id, 1]
#--------------------------------------------------------------------
def initialize
leon_gp_mission_initialize
@mission = {
0 => 1,
1 => 2,
2 => 3,
3 => 2
}
end
end
#--------------------------------------------------------------------
# * Ends Game_Party
#--------------------------------------------------------------------
#----------------------------------------------------------------------
# * Window_Missionhelp
#----------------------------------------------------------------------
class Window_Missionhelp < Window_Base
#--------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------
def initialize
super(0, 0, 400, 60)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------
def update(help_text)
self.contents.clear
self.contents.draw_text(0, 0, 440, 32, help_text)
end

end
#----------------------------------------------------------------------
# * End Window_Missionhelp
#----------------------------------------------------------------------
#----------------------------------------------------------------------
# Window_MissionNum
#----------------------------------------------------------------------
class Window_MissionNum < Window_Base
#--------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------
def initialize
super(400, 0, 240, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

#--------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------
def refresh
self.contents.clear
mis = Mission_Menu
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, 32, "Missions:")
self.contents.font.color = normal_color
@mission_comp = []
@mission_know = []
#Calls Mission number of completed missions
for i in 0...$game_party.mission.keys.size
if $game_party.mission[$game_party.mission.keys[i]] == 3
@mission_comp.push(i)
end
end
#Calls Mission number of missions
for j in 0...$game_party.mission.keys.size
if $game_party.mission[$game_party.mission.keys[j]] > 1
@mission_know.push(j)
end
end
#if Mission_Setup is false...
if mis::Mission_Setup == false
if @mission_comp.size == $game_party.mission.size
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
"/" + $game_party.mission.size.to_s, 2)
self.contents.font.color = normal_color
else
self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
"/" + $game_party.mission.size.to_s, 2)
end
#if Mission_Setup is true...
elsif mis::Mission_Setup == true
if @mission_comp.size == @mission_know.size
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
"/" + @mission_know.size.to_s, 2)
self.contents.font.color = normal_color
else
self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
"/" + @mission_know.size.to_s, 2)
end
end
end
end
#----------------------------------------------------------------------
# * End Window_Missionnum
#----------------------------------------------------------------------

#----------------------------------------------------------------------
# Window_Missionlist
#----------------------------------------------------------------------
class Window_Missionlist < Window_Selectable
#--------------------------------------------------------------------
# * Attribute listings
#--------------------------------------------------------------------
attr_accessor :mission
#--------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------
def initialize
super(0, 60, 260, 420)
self.contents = Bitmap.new(width - 32, height - 32)
self.index = 0
refresh
end
#--------------------------------------------------------------------
# * Mission
#--------------------------------------------------------------------
def mission
return @data[self.index]
end
#--------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
mis = Mission_Menu
@data = []
for i in 0...$game_party.mission.keys.size
if $game_party.mission[$game_party.mission.keys[i]] > 1
@data.push($game_party.mission.keys[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------
# * Draw_Item
#--------------------------------------------------------------------
def draw_item(index)
mis = Mission_Menu
mission_name = @data[index]
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
if $game_party.mission[mission_name] == 3
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name])
else
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name])
end
end

end
#----------------------------------------------------------------------
# * End Window_Missionlist
#----------------------------------------------------------------------
#----------------------------------------------------------------------
# Window_Missioncomp
#----------------------------------------------------------------------
class Window_Missioncomp < Window_Base
#--------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------
def initialize(mission)
super(260, 365, 380, 115)
self.contents = Bitmap.new(width - 32, height - 32)
refresh(mission)
end
#--------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------
def refresh(mission)
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 52, 440, 32, "Status:")
self.contents.draw_text(170, 52, 440, 32, "Reward:")
self.contents.font.color = normal_color
#person place status reward
mis = Mission_Menu
if mis::Mission_Sprite.has_key?(mission)
if $game_party.mission[mission] > 1
self.contents.draw_text(36, 6, 440, 32,
mis::Mission_Sprite[mission][2] + ", " + mis::Mission_Sprite[mission][3])
case $game_party.mission[mission]
when 1
self.contents.draw_text(62, 52, 400, 32, "")
when 2
self.contents.draw_text(62, 52, 400, 32, "Incomplete")
self.contents.draw_text(242, 52, 138, 32, "Unknown")
when 3
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(62, 52, 400, 32, "Complete")
self.contents.draw_text(242, 52, 138, 32, mis::Mission_Sprite[mission][4])
end
bitmap = RPG::Cache.character(mis::Mission_Sprite[mission][0],
mis::Mission_Sprite[mission][1])
cw = bitmap.width / 4
ch = bitmap.height / 4
facing = 0
src_rect = Rect.new(0, facing * ch, cw, ch)
self.contents.blt(0, 0, bitmap, src_rect)
end
end
end

def clear
self.contents.clear
end

end
#--------------------------------------------------------------------
# * Ends Window_Missioncomp
#--------------------------------------------------------------------

#----------------------------------------------------------------------
# Window_Missiondesc
#----------------------------------------------------------------------
class Window_Missiondesc < Window_Base
#--------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------
def initialize(mission)
super(260, 60, 380, 305)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------
def refresh(mission)
self.contents.clear
mis = Mission_Menu
self.contents.draw_text(0, 0, 348, 32, mis::Mission_L1[mission].to_s)
self.contents.draw_text(0, 32, 348, 32, mis::Mission_L2[mission].to_s)
self.contents.draw_text(0, 64, 348, 32, mis::Mission_L3[mission].to_s)
self.contents.draw_text(0, 96, 348, 32, mis::Mission_L4[mission].to_s)
self.contents.draw_text(0, 128, 348, 32, mis::Mission_L5[mission].to_s)
self.contents.draw_text(0, 160, 348, 32, mis::Mission_L6[mission].to_s)
self.contents.draw_text(0, 192, 348, 32, mis::Mission_L7[mission].to_s)
self.contents.draw_text(0, 224, 348, 32, mis::Mission_L8[mission].to_s)
end
end
#--------------------------------------------------------------------
# * Ends Window_Missiondesc
#--------------------------------------------------------------------

#====================================
# Scene_MissionMenu
#====================================
class Scene_MissionMenu
#--------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------
# * Main
#--------------------------------------------------------------------
def main

@missionhelp_window = Window_Missionhelp.new
@missionlist_window = Window_Missionlist.new
@missionnum_window = Window_MissionNum.new
@missioncomp_window = Window_Missioncomp.new(@missionlist_window.mission)
@missiondesc_window = Window_Missiondesc.new(@missionlist_window.mission)
@mission = @missionlist_window.mission

@missiondesc_window.refresh(@missionlist_window.mission)
@missioncomp_window.refresh(@missionlist_window.mission)

Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@missionhelp_window.dispose
@missiondesc_window.dispose
@missioncomp_window.dispose
@missionlist_window.dispose
@missionnum_window.dispose
end
#--------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------
def update
mis = Mission_Menu
@missionlist_window.update
@missionnum_window.update
@missionhelp_window.update("Select a mission to see details.")
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or Input.repeat?(Input::DOWN) or Input.repeat?(Input::UP)
@missiondesc_window.refresh(@missionlist_window.mission)
@missioncomp_window.refresh(@missionlist_window.mission)
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
end
end

end
#--------------------------------------------------------------------
# * Ends Scene_Missionmenu
#--------------------------------------------------------------------[/spoiler]

third:[spoiler]# HP/SP gauge animation indication Ver1.03
# 07/01/11
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return (@exp_list[@level+1] > 0 ?
@exp_list[@level+1] - @exp_list[@level] : 0)
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
alias :initialize_gauge :initialize
def initialize(x, y, width, height)
initialize_gauge(x, y, width, height)
# Initialize HP and SP gauge values
@hp_gauge = {}
@sp_gauge = {}
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
alias :dispose_gauge :dispose
def dispose
# ƒQ[ƒW‚̍폜
gauge_delete
# ƒIƒŠƒWƒiƒ‹‚̉ð•úˆ—
dispose_gauge
end
#--------------------------------------------------------------------------
# * Gauge Delete
#--------------------------------------------------------------------------
def gauge_delete
# HP ƒQ[ƒW‚̏Á‹Ž
for gauge in @hp_gauge.values
gauge[0].bitmap.dispose
gauge[0].dispose
end
# SP ƒQ[ƒW‚̍XV
for gauge in @sp_gauge.values
gauge[0].bitmap.dispose
gauge[0].dispose
end
@hp_gauge = {}
@sp_gauge = {}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias :update_gauge :update
def update
update_gauge
# HP ƒQ[ƒW‚̍XV
for gauge in @hp_gauge.values
gauge_refresh(gauge, 0)
end
# SP ƒQ[ƒW‚̍XV
for gauge in @sp_gauge.values
gauge_refresh(gauge, 1)
end
end
#--------------------------------------------------------------------------
# * Draw HP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# ‰•`‰æ‚̏ꍇ
if @hp_gauge[actor] == nil
# ƒQ[ƒW‚
height = 10
# FÝ’èBcolor1:ŠO˜gCcolor2:’†˜g
# color3:‹óƒQ[ƒWƒ_[ƒNƒJƒ‰[Ccolor4:‹óƒQ[ƒWƒ‰ƒCƒgƒJƒ‰[
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(64, 0, 0, 192)
color4 = Color.new(0, 0, 0, 192)
# ‹óƒQ[ƒW‚Ì•`‰æ
@hp_frame = gauge_rect(width, height, color1, color2, color3, color4)
sprite = Sprite.new
sprite.bitmap = Bitmap.new(width, height)
sprite.x = self.x + x + 16
sprite.y = self.y + y + 42 - height
sprite.z = self.z + 1
count = rand(400)
# •Ï”rate‚É Œ»Ý‚ÌHP/MHP‚ð‘ã“ü
if actor.maxhp != 0
rate = ((width - 4) * actor.hp.to_f / actor.maxhp).ceil
else
rate = width - 4
end
# ˆÊ’u“™î•ñ‚Ì‹L‰¯
@hp_gauge[actor] = [sprite, actor, rate, count, x, y - height]
# ƒQ[ƒW•`‰æ
gauge_refresh(@hp_gauge[actor], 0)
# ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚̏ꍇA‰Šúó‘Ô‚Í”ñ•\Ž¦
@hp_gauge[actor][0].visible = false if self.is_a?(Window_Target)
end
# •Ï”rate‚É Œ»Ý‚ÌHP/MHP‚ð‘ã“ü
if actor.maxhp != 0
rate = ((width - 4) * actor.hp.to_f / actor.maxhp).ceil
else
rate = width - 4
end
@hp_gauge[actor][2] = rate
# ƒIƒŠƒWƒiƒ‹‚ÌHP•`‰æˆ—‚ðŒÄ‚яo‚µ
draw_actor_hp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw SP process
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# ‰•`‰æ‚̏ꍇ
if @sp_gauge[actor] == nil
# ƒQ[ƒW‚
height = 10
# FÝ’èBcolor1:ŠO˜gCcolor2:’†˜g
# color3:‹óƒQ[ƒWƒ_[ƒNƒJƒ‰[Ccolor4:‹óƒQ[ƒWƒ‰ƒCƒgƒJƒ‰[
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 64, 64, 192)
color4 = Color.new(0, 0, 0, 192)
# ‹óƒQ[ƒW‚Ì•`‰æ
@sp_frame = gauge_rect(width, height, color1, color2, color3, color4)
sprite = Sprite.new
sprite.bitmap = Bitmap.new(width, height)
sprite.x = self.x + x + 16
sprite.y = self.y + y + 42 - height
sprite.z = self.z + 1
count = rand(400)
# •Ï”rate‚É Œ»Ý‚ÌHP/MHP‚ð‘ã“ü
if actor.maxsp != 0
rate = ((width - 4) * actor.sp.to_f / actor.maxsp).ceil
else
rate = width - 4
end
# ˆÊ’u“™î•ñ‚Ì‹L‰¯
@sp_gauge[actor] = [sprite, actor, rate, count, x, y - height]
# ƒQ[ƒW•`‰æ
gauge_refresh(@sp_gauge[actor], 1)
# ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚̏ꍇA‰Šúó‘Ô‚Í”ñ•\Ž¦
@sp_gauge[actor][0].visible = false if self.is_a?(Window_Target)
end
# •Ï”rate‚É Œ»Ý‚ÌHP/MHP‚ð‘ã“ü
if actor.maxsp != 0
rate = ((width - 4) * actor.sp.to_f / actor.maxsp).ceil
else
rate = width - 4
end
@sp_gauge[actor][2] = rate
# ƒIƒŠƒWƒiƒ‹‚ÌHP•`‰æˆ—‚ðŒÄ‚яo‚µ
draw_actor_sp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Drawing of gauge
#--------------------------------------------------------------------------
def gauge_rect(width, height, color1, color2, color3, color4)
bitmap = Bitmap.new(width, height)
# ˜g•`‰æ
bitmap.fill_rect(0, 0, width, height, color1)
bitmap.fill_rect(1, 1, width - 2, height - 2, color2)
# ‹óƒQ[ƒW‚Ì•`‰æ
bitmap.gradation_rect(2, 2, width-4, height-4, color3, color4, 1)
return bitmap
end
#--------------------------------------------------------------------------
# œ ŽÀƒQ[ƒW‚̍XV
#--------------------------------------------------------------------------
def gauge_refresh(gauge, type)
# ƒ^ƒCƒv‚É‚æ‚蕪Šò
case type
when 0 # HPƒQ[ƒW‚̏ꍇ
graphic = RPG::Cache.system("Gauge_HP")
rate = gauge[2] * 100 / (gauge[0].bitmap.width - 4)
point = (rate < 50 ? 8 : 0) + (rate < 25 ? 8 : 0)
frame = @hp_frame
when 1 # SPƒQ[ƒW‚̏ꍇ
graphic = RPG::Cache.system("Gauge_SP")
rate = gauge[2] * 100 / (gauge[0].bitmap.width - 4)
point = (rate < 50 ? 8 : 0) + (rate < 25 ? 8 : 0)
frame = @sp_frame
end
# ƒJƒEƒ“ƒg‚̍XV
gauge[3] = (gauge[3] - 2) % 400
# ‹óƒQ[ƒW‚Ì‚Ì•`‰æ
gauge[0].bitmap.fill_rect(0, 0, gauge[0].bitmap.width,
gauge[0].bitmap.height, Color.new(0, 0, 0, 0))
gauge[0].bitmap.blt(0, 0, frame, frame.rect)
# ƒQ[ƒW‚Ì’†g‚ð•`‰æ‰Â”\‚ȏꍇ
if gauge[2] > 0
# ŽÀƒQ[ƒW‚Ì•`‰æ
gauge[0].bitmap.blt(2, 2, graphic,
Rect.new(gauge[3], point, gauge[2], gauge[0].bitmap.height - 4), 192)
gauge[0].bitmap.fill_rect(3, 3, gauge[2] - 2,
gauge[0].bitmap.height - 6,Color.new(0, 0, 0, 0))
gauge[0].bitmap.blt(3, 3, graphic,
Rect.new(gauge[3]+1,point+1,gauge[2]-2,gauge[0].bitmap.height- 6), 128)
end
# ƒQ[ƒWÀ•W‚̍XV
gauge[0].x = [self.x - self.ox + gauge[4] + 16, self.x + 16].max
gauge[0].y = [self.y - self.oy + gauge[5] + 42, self.y + 16].max
gauge[0].src_rect = Rect.new([self.ox - gauge[4], 0].max,
[self.oy - gauge[5] - 26, 0].max,
[self.ox + self.width - gauge[4] - 32, gauge[0].bitmap.width].min,
[self.oy + self.height - gauge[5] - 32, gauge[0].bitmap.height].min)
gauge[0].visible = self.visible
end
#--------------------------------------------------------------------------
# Set X-position for gauge
#--------------------------------------------------------------------------
def x=(new_x)
super(new_x)
if @hp_gauge != nil
# HP ƒQ[ƒW‚̍XV
for gauge in @hp_gauge.values + @sp_gauge.values
gauge[0].x = self.x + gauge[4] + 16
end
end
end
#--------------------------------------------------------------------------
# Set Y-position for gauge
#--------------------------------------------------------------------------
def y=(new_y)
super(new_y)
if @hp_gauge != nil
# HP ƒQ[ƒW‚̍XV
for gauge in @hp_gauge.values + @sp_gauge.values
gauge[0].y = self.y + gauge[5] + 42
end
end
end
#--------------------------------------------------------------------------
# Set Z-depth for gauge
#--------------------------------------------------------------------------
def z=(new_z)
super(new_z)
if @hp_gauge != nil
# HP ƒQ[ƒW‚̍XV
for gauge in @hp_gauge.values + @sp_gauge.values
gauge[0].z = self.z + 1
end
end
end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
alias :gauge_set_text :set_text
def set_text(text, align = 0)
# ƒeƒLƒXƒg‚ƃAƒ‰ƒCƒ“ƒƒ“ƒg‚̏*‚È‚*‚Æ‚àˆê•û‚ª‘O‰ñ‚ƈá‚Á‚Ä‚¢‚éê‡
if text != @text or align != @align
# ƒQ[ƒW‚̍폜
gauge_delete
# ƒIƒŠƒWƒiƒ‹‚̏ˆ—
gauge_set_text(text, align)
end
end
#--------------------------------------------------------------------------
# * Set Actor
# actor : status displaying actor
#--------------------------------------------------------------------------
alias :gauge_set_actor :set_actor
def set_actor(actor)
if actor != @actor
# ƒQ[ƒW‚̍폜
gauge_delete
# ƒIƒŠƒWƒiƒ‹‚̏ˆ—
gauge_set_actor(actor)
end
end
#--------------------------------------------------------------------------
# * Set Enemy
# enemy : name and status displaying enemy
#--------------------------------------------------------------------------
alias :gauge_set_enemy :set_enemy
def set_enemy(enemy)
# ƒQ[ƒW‚̍폜
gauge_delete
# ƒIƒŠƒWƒiƒ‹‚̏ˆ—
gauge_set_enemy(enemy)
end
end

#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias :initialize_gauge :initialize
def initialize
initialize_gauge
@viewport2.z = 100
end
end
#==============================================================================
# ** Bitmap
#------------------------------------------------------------------------------
# New routine added to the Bitmap class.
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Rectangle Gradation Indicator
# color1: Start color
# color2: Ending color
# align: 0: On side gradation
# 1: Vertically gradation
# 2: The gradation (intense concerning slantedly heavily note)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
#==============================================================================
# ** Sprite
#------------------------------------------------------------------------------
# Class for sprites added to various effect handling used within RPGXP
#==============================================================================
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80 + self.viewport.ox
@_damage_sprite.oy = 20 + self.viewport.oy
@_damage_sprite.x = self.x + self.viewport.rect.x
@_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
@_damage_sprite.z = 3000
@_damage_duration = 40
end
def animation(animation, hit)
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def loop_animation(animation)
return if animation == @_loop_animation
dispose_loop_animation
@_loop_animation = animation
return if @_loop_animation == nil
@_loop_animation_index = 0
animation_name = @_loop_animation.animation_name
animation_hue = @_loop_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_loop_animation_sprites = []
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_loop_animation_sprites.push(sprite)
end
update_loop_animation
end
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
sprite.y = self.y + self.viewport.rect.y -
self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end

#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGXP's data structures and more.
#==============================================================================
module RPG
#============================================================================
# ** Cache
#----------------------------------------------------------------------------
# A module that loads each of RPGXP's graphic formats, creates a Bitmap
# object, and retains it.
#============================================================================
module Cache
def self.system(filename)
self.load_bitmap("Graphics/Pictures/", filename)
end
end
end[/spoiler]

forth: [spoiler]#==============================================================================
# Tons of Add-ons by Blizzard
# Version: 3.71b
# Date v1.00b: 14.11.2006
# Date v1.10b: 17.11.2006
# Date v1.60b: 4.12.2006
# Date v1.62b: 6.12.2006
# Date v1.70b: 13.12.2006
# Date v1.87b: 12.01.2007
# Date v2.20b: 16.01.2007
# Date v2.30b: 22.01.2007
# Date v2.31b: 24.01.2007
# Date v2.40b: 1.02.2007
# Date v2.50b: 4.02.2007
# Date v2.70b: 7.02.2007
# Date v2.71b: 12.02.2007
# Date v2.80b: 17.02.2007
# Date v3.70b: 19.02.2007
# Date v3.71b: 23.02.2007
#
#
# VERY IMPORTANT NOTE:
#
# For any new add-on the version will increase by 0.1, for any update of the
# collection or any update on an add-on the version will increase by 0.01. Also
# from v3.7b on there is a recognition constant available which will make the
# Tons of Add-ons much more compatible with many of my scripts. I noticed
# serious issues with several of my older scripts.
#
#
# Important note:
#
# All Add-ons are initially turned off in any later version than 1.87b!
# Also note that "Full Reflection System" is BELOW HP/SP Absorbtion, because of
# incompatibility issues.
#
#
# Compatibility:
#
# 95% chance of compatibility with SDK. May cause incompatibility issues with
# exotic CBS-es. Some will corrupt your old savegames. If you experience the
# "Stack level too deep" error, you might already use one of these add-ons.
# All of these add-ons here work with each other with a chance of 99%. This
# add-on collection itself WILL corrupt your old savegames.
#
#
# Featured add-ons so far:
#
# - 37 add-ons by Blizzard
#
# Ideas:
#
# - Blizzard
# - GuardianAngelX72
# - BanisherOfEden
# - italianstal1ion
# - indinera
# - Yami
# - blazinhandle (for getting me to do the AP in EQUAP already...)
#
#
# Features:
#
# ----> Graphic (make your game look nice):
# - Better Tilemap update (will update autotiles faster)
# - Animated Title (have an animated title screen without .gifs)
# - Center Battler (they will be centered instead of lined next to each other)
# - HP/SP/EXP gradient/slant bars (including 6 styles, opacity and least lag)
# - Location names (shows pictures of the location the player visits)
# - Black fade (shows a black screen when changing the map)
# - Simple Shaded Text (draws a shadow behind your text)
# - Blizz-Art lagless HUD (Heads Up Display using either HP/SP/EXP or simple)
# - Screen Tremble (makes your screen shake vertically, too)
# - Animation stack (shows animation of all inflicted status effects)
# - Simple facesets (shows a face instead of the spriteset in the main menu)
#
# ----> Utility (make your game more unique and better/help you during debug):
# - FPS Modulator (increase the fps rate up 3 times like in an emulator)
# - Speed Modulator (change the main character's speed on the map)
# - ABSEAL (the best event anti-lag for maps ever)
# - Fullscreen? (asks the player at game start if he wishes to switch to full)
# - Death Toll (counts killed enemies and actor deaths)
# - Window_BattleResult (displays gained items in a different, but better way)
# - Unique Skill Commands (different name for the Skill command for each class)
# - Ultimate Font Override (will override the font from any RMXP version)
# - Heal at LvlUp (heals characters who level up)
# - Weapon/Armor HP/SP Plus (max HP and max SP can also be increased)
# - EQUAP Skills (equipment skills, equip to learn + AP system like FF9)
# - Picture Movie Scene (easily create picture based cutscenes)
# - Target 'em all! (make skills target all battlers)
# - Quick Passability Test (let's you debug maps faster and more convenient)
# - Dynamic Passability Minimap (never was a minimap so easy to use)
# - Enemy status in battle (displays enemies' HP, SP and state)
#
# ----> Status effect (non-standard status effects):
# - Zombie (Healing items will hurt and light attacks are effective)
# - Regen (progressive healing aka poison, but the other way)
# - Auto-Revive (or Auto-Life, will be automatically revived after dieing)
# - Fury Status (if a specific character dies, another one will become Fury)
# - Invincible Status (this status will nullify ANY DAMAGE done by enemies)
# - Half SP (this status will halve SP cost when skills are used)
# - Full Reflection System (finally a Reflect that actually DOES work)
#
# ----> Skill (non-standard skills):
# - Absorb HP/SP (with considering undead enemies)
# - Death Roulette (kills a random target)
# - Blue Magic skill (can learn enemy's skills)
#
#
# Version history:
#
# v1.1b:
#
# -> added Black fade by Blizzard
#
# v1.6b:
#
# -> added Ultimate Font Override by Blizzard
# -> added Simple Shaded Text by Blizzard
# -> added Heal at LvlUp by Blizzard
# -> added Fury Status by Blizzard
# -> added Invincible Status by Blizzard
#
# v1.62b:
#
# -> upgraded Death Toll by Blizzard to 1.2b
#
# v1.7b:
#
# -> added Half SP by Blizzard
#
# v1.87b:
#
# -> added Blizz-Art lagless HUD by Blizzard
# -> upgraded Animated Title by Blizzard to 1.33b
# -> upgraded Centered Battlers by Blizzard to 2.1b
# -> upgraded HP/SP/EXP bars by Blizzard to 4.11b
# -> upgraded Speed Modulator by Blizzard to 1.01b
# -> upgraded Regen Status Effect by Blizzard to 1.1b
# -> upgraded Auto-Revive by Blizzard to 1.21b
# -> updated FPS Modulator by Blizzard
#
# v2.2b:
#
# -> added Weapon/Armor HP/SP Plus by Blizzard
# -> added Full Reflection System by Blizzard
# -> added EQ Skills by Blizzard
# -> added Picture Movie Scene by Blizzard
#
# v2.3b:
#
# -> added Screen Tremble by Blizzard
#
# v2.31b:
#
# -> updated Screen Tremble by Blizzard
# -> updated Better Tilemap update by Blizzard
#
# v2.4b:
#
# -> added Animation Stack by Blizzard
# -> upgraded Picture Movie Scene by Blizzard to 2.02b
# -> updated Screen Tremble by Blizzard
#
# v2.5b:
#
# -> added Target 'em all! by Blizzard
# -> upgraded Unique Skill Commands by Blizzard to 1.11b
#
# v2.7b:
#
# -> added Quick Passability Test by Blizzard
# -> added Dynamic Passability Minimap by Blizzard
# -> upgraded Picture Movie Scene by Blizzard to 2.03b
#
# v2.71b:
#
# -> upgraded Dynamic Passability Minimap by Blizzard to 1.01b
#
# v2.8b:
#
# -> added Enemy status in battle by Blizzard
#
# v3.7b:
#
# -> added Simple Facesets by Blizzard
# -> changed EQ Skills by Blizzard to EQUAP Skills and upgraded to v3.0b
# -> upgraded Unique Skill Commands by Blizzard to v1.2b
# -> updated Center Battle by Blizzard
# -> updated Weapon/Armor HP/SP Plus by Blizzard
# -> added constant for recognition by other scripts to improve compatibility
# -> Why suddenly v3.7b? 37 add-ons are featured so far!
#
# v3.71b:
#
# -> upgraded Simple Facesets by Blizzard to v1.02b
# -> fixed a bug with the compatibility mode
#
#
# Instructions:
#
# - Explanation:
#
# Every Add-on has its own instructions. Please read and follow them.
#
# - Configuration:
#
# Configure the part just below to define which add-ons you want to use and
# which not. The configuration is split into two part for reason, don't change
# this. It will work fine if you leave it as it is.
#
# - For scripters:
#
# If you have any ideas how to improve this collection, just say so. I will
# add you into the credits of this add-on collection if you have an own add-on.
# I will not add any add-ons made by somebody else than yourself, you can't ask
# me for somebody else to add an add-on. The creator has to ask me himself.
#
#
# Side note:
#
# These add-ons were mostly tested in a different enviroment or not at all.
#
#
# Useless facts:
#
# - Tons of Add-ons already exceeds many CMS-es and even several CBS-es in
# number of lines of code.
# - Chaos Project uses only about 70% of the Tons of Add-ons.
# - A good code is a short code that does what it is supposed to, not the
# "Microsoft" way where you have many actually redundant lines of code.
# Simple, short and straight, that's what makes codes efficient!
# - In Russia Blizzard makes his scripts SDK compatible with YOU!
# - Tons of Add-ons might become more compatible than the SDK
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr/
# or send me an e-mail:
# boris_blizzard@yahoo.de
#==============================================================================
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# #
# ### ### # # ##### # #### # # #### ### ##### # ### # # #
# # # # # ## # # # # # # # # # # # # # # ## # #
# # # # # # # #### # # ## # # #### # # # # # # # # # #
# # # # # # ## # # # # # # # # ##### # # # # # ## #
# ### ### # # # # #### ### # # # # # # ### # # #
# #
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
$tons_version = 3.71
module TONS_OF_ADDONS

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration 1
#
# You can enable/disable any add-on here if you wish. Set the value to false
# to disable it. These features CANNOT be turned on/off during the game.
#
# NAME_OF_THE_ADDON = true
# NAME_OF_THE_ADDON = false
#
# where NAME_OF_THE_ADDON is the same variable as the one used below.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# the graphic add-ons
ANIMATED_TITLE = false
# the utility add-ons
FULLSCREEN = false
EQUAP_SKILLS = false
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration 1
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

end
#==============================================================================
# Game_System
#==============================================================================
class Game_System

attr_accessor :BETTER_TILEMAP_UPDATE
attr_accessor :CENTER_BATTLER
attr_accessor :BARS
attr_accessor :LOCATION_NAMES
attr_accessor :BLACKFADE
attr_accessor :SHADED_TEXT
attr_accessor :HUD
attr_accessor :TREMBLE
attr_accessor :ANIMATION_STACK
attr_accessor :FACESETS
attr_accessor :FPS_MODULATOR
attr_accessor :SPEED_MODULATOR
attr_accessor :ABSEAL
attr_accessor :DEATH_TOLL
attr_accessor :WINDOW_BATTLERESULT
attr_accessor :UNIQUE_SKILL_COMMANDS
attr_accessor :ULTIMATE_FONT_OVERRIDE
attr_accessor :HEAL_AT_LVLUP
attr_accessor :HPSPPLUS
attr_accessor :TARGET_EM_ALL
attr_accessor :QUICK_PASSABILITY_TEST
attr_accessor :MINIMAP
attr_accessor :ENEMY_STATUS
attr_accessor :REGEN_STATUS
attr_accessor :AUTO_REVIVE
attr_accessor :FURY_STATUS
attr_accessor :INVINCIBLE_STATUS
attr_accessor :HALF_SP
attr_accessor :REFLECT
attr_accessor :ABSORB_HP_SP
attr_accessor :DEATH_ROULETTE
attr_accessor :BLUE_MAGIC_SKILL

alias init_tons_of_addons_later initialize
def initialize
init_tons_of_addons_later
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration 2
#
# You can enable/disable any add-on here if you wish. Set the value to false
# to disable it initially. To turn it on/off ingame, just use the Call script
# command with one of these syntaxes:
#
# $game_system.NAME_OF_THE_ADDON = true
# $game_system.NAME_OF_THE_ADDON = false
#
# where NAME_OF_THE_ADDON is the same variable as the one used below.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# the graphic add-ons
@BETTER_TILEMAP_UPDATE = false
@CENTER_BATTLER = false
@BARS = false
@LOCATION_NAMES = false
@BLACKFADE = false
@SHADED_TEXT = false
@HUD = false
@TREMBLE = false
@ANIMATION_STACK = false
@FACESETS = true
# the utility add-ons
@FPS_MODULATOR = false
@SPEED_MODULATOR = false
@ABSEAL = false
@DEATH_TOLL = false
@WINDOW_BATTLERESULT = false
@UNIQUE_SKILL_COMMANDS = false
@ULTIMATE_FONT_OVERRIDE = false
@HEAL_AT_LVLUP = false
@HPSPPLUS = false
@TARGET_EM_ALL = false
@QUICK_PASSABILITY_TEST = false
@MINIMAP = false
@ENEMY_STATUS = false
# the status effect add-ons
@REGEN_STATUS = false
@AUTO_REVIVE = false
@FURY_STATUS = false
@INVINCIBLE_STATUS = false
@HALF_SP = false
@REFLECT = false
# the skill add-ons
@ABSORB_HP_SP = false
@DEATH_ROULETTE = false
@BLUE_MAGIC_SKILL = false
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration 2
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end

end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# I suggest you don't edit anything below this line except for the
# configuration for the add-ons.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# #
# #### #### ### #### # # # ### ##### #
# # # # # # # # # # # # # # #
# # ## #### # # #### ##### # # ##### #
# # # # # ##### # # # # # # # #
# #### # # # # # # # # ### ##### #
# #
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
#==============================================================================
# Better Tilemap update by Blizzard
# Version: 1.0b
# Date: 13.8.2006
#
# new in 1.0b:
# - change method of updating
#
# This will add a little faster update of autotile frames to allow a more
# natural feeling.
#==============================================================================
#==============================================================================
# Tilemap
#==============================================================================
class Tilemap

alias upd_fps_later update
def update
if $game_system.BETTER_TILEMAP_UPDATE
upd_fps_later if Graphics.frame_count % (Graphics.frame_rate / 5) == 0
end
upd_fps_later
end

end
#==============================================================================
# Animated title screen by Blizzard
# Version: 1.33b
# Date: 17.3.2006
# Date v1.3: 26.5.2006
# Date v1.32b: 14.11.2006
# Date v1.33b: 12.1.2007
#
#
# v1.3 features:
# - completely overworked and 99% SDK compatible
#
# v1.32b features:
# - slightly improved code
#
# v1.33b features:
# - slightly improved code
#
#
# Instructions:
#
# - if you want to change the delay between the frames change "DELAY"
# - name the frames of your title pictures "title0", "title1" and so on.
# - to change the number of frames, change the value of "PICS"
# - be sure to set "title0" as your title screen in the database
#
# That's all. N-Joy! =D
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DELAY = 20 # change the delay
PICS = 1 # number of pictures/frames
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title

alias initialize_animated_title initialize
def initialize
initialize_animated_title
@frame = 0
@counter = 0
end

alias update_animated_title update
def update
if TONS_OF_ADDONS::ANIMATED_TITLE and PICS > 1
@counter += 1
if @counter == DELAY
title_update
@counter = 0
end
end
update_animated_title
end

def title_update
@frame += 1
@frame %= PICS
@sprite.bitmap = RPG::Cache.title("title#{@frame}")
Graphics.transition
end
end
#==============================================================================
# Centered Battlers by Blizzard
# Version: 2.1b
# Date: 14.11.2006
# Date v2.1b: 12.1.2007
#
# new in v2.0b:
# - the new code is much more compatible and not merged into the Regen add-on.
#
# new in v2.1b:
# - compatible with "Easy LvlUp Notifier"
#==============================================================================
#==============================================================================
# Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite

alias upd_center_battler_later update
def update
upd_center_battler_later
return unless $game_system.CENTER_BATTLER
return if @battler == nil
if @battler.is_a?(Game_Actor)
self.x = case $game_party.actors.size
when 1 then @battler.screen_x + 240
when 2 then @battler.screen_x + 80 + @battler.index * 160
when 3 then @battler.screen_x + 80
when 4 then @battler.screen_x
end
elsif @battler.is_a?(Game_Enemy)
self.x = @battler.screen_x
end
self.y = @battler.screen_y
self.z = @battler.screen_z
end

end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias upd_center_battler_later update
def update
if $game_system.CENTER_BATTLER and @lvlup_windows != nil
for i in 0...@lvlup_windows.size
@lvlup_windows[i].x = case $game_party.actors.size
when 1 then 240
when 2 then 80 + i * 320
when 3 then 80 + i * 160
when 4 then i * 160
end
end
end
upd_center_battler_later
end

alias phase3_setup_command_window_center_battler_later phase3_setup_command_window
def phase3_setup_command_window
phase3_setup_command_window_center_battler_later
return unless $game_system.CENTER_BATTLER
@actor_command_window.x = case $game_party.actors.size
when 1 then 240
when 2 then 80 + @actor_index * 320
when 3 then 80 + @actor_index * 160
when 4 then @actor_index * 160
end
@actor_command_window.index = 0
end
end
#==============================================================================
# Arrow_Actor
#==============================================================================
class Arrow_Actor < Arrow_Base

alias upd_center_battler_later update
def update
upd_center_battler_later
return unless $game_system.CENTER_BATTLER
if self.actor != nil
self.x = case $game_party.actors.size
when 1 then 240 + self.actor.screen_x
when 2 then 2 * self.actor.screen_x
when 3 then 80 + self.actor.screen_x
when 4 then self.actor.screen_x
end
self.y = self.actor.screen_y
end
end
end
#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base

alias refresh_center_battler_later refresh
def refresh
unless $game_system.CENTER_BATTLER
refresh_center_battler_later
return
end
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = case @item_max
when 1 then 4 + 240
when 2 then 4 + 80 + i * 320
when 3 then 4 + 80 + i * 160
when 4 then 4 + i * 160
end
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end
#==============================================================================
# Blizz-Art Gradient styler with HP/SP/EXP bars by Blizzard
# Version: 4.11
# Date v4.0: 13.11.2006
# Date v4.11: 12.1.2007
#
#
# v2.0+
# - 2 styles, better code
# v3.0+
# - 6 styles, far better code
# v4.0+
# - 6 styles, overworked and extremely delagged, enjoy the most lagless
# gradient/slant bar code ever
# v4.11
# - added instructions and a recognition constant for plugins
#
#
# Instructions:
#
# You can change style and opacity by using the "Call script" event command.
# Use one of of these syntaxes:
#
# $game_system.bar_style = X
# $game_system.bar_opacity = Y
#
# X is a number from 0 to 5 and is the ID number of the style. Y is a number
# from 0 to 255 and indicates the opacity. Values out of range will be
# corrected.
#==============================================================================
BLIZZ_ART = true
#==============================================================================
# Game_System
#==============================================================================
class Game_System

attr_accessor :bar_style
attr_reader :bar_opacity

alias init_blizzart_later initialize
def initialize
init_blizzart_later
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#
# Configure this part manually if you have no "Options" controller for the
# styles and the opacity. (style: 0~5, opacity: 0~256) (256 is the same as 255)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@bar_style = 5
@bar_opacity = 256
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end

def bar_opacity=(alpha)
if alpha > 256
alpha = 256
elsif alpha < 0
alpha = 0
end
@bar_opacity = alpha
end

end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler

def now_exp
return @exp - @exp_list[@level]
end

def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end

end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
def gradient_bar(x, y, w, color1, color2, color3, rate)
return unless $game_system.BARS
return if $game_system.bar_style < 0 or $game_system.bar_style > 5
styles = [1, 3, 4, 5]
rx = color3.red
gx = color3.green
bx = color3.blue
offset = 5
x += offset
y += 26
if styles.include?($game_system.bar_style)
offset += 2
w = w / 8 * 8
y -= 1
if $game_system.bar_style == 5
y -= 2
else
x += 1
end
end
r = color1.red
g = color1.green
b = color1.blue
r_rate = color2.red - r
g_rate = color2.green - g
b_rate = color2.blue - b
alpha = $game_system.bar_opacity
return if alpha == 0
alpha -= 1 if alpha == 256
if $game_system.bar_style < 5
for i in 0...(offset + 3)
fill_rect(x - i, y + i - 2, w + 3, 1, Color.new(0, 0, 0, 255))
end
for i in 0...(offset + 1)
fill_rect(x - i, y + i - 1, w + 1, 1, Color.new(255, 255, 255, 255))
end
if $game_system.bar_style < 2
for i in 0...w + offset
red = color3.red * i / (w + offset)
green = color3.green * i / (w + offset)
blue = color3.blue * i / (w + offset)
oy = i < offset ? offset-i : 0
off = i < offset ? i : i > w ? w+offset-i : offset
fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue, alpha))
end
if (w*rate).to_i >= offset
for i in 0...((w*rate).to_i+offset)
red = r + r_rate * i / ((w + offset)* rate)
green = g + g_rate * i / ((w + offset)* rate)
blue = b + b_rate * i / ((w + offset)* rate)
oy = i < offset ? offset-i : 0
off = i < offset ? i : i > w*rate ? (w*rate).to_i+offset-i : offset
fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue, alpha))
end
else
for i in 0...(w * rate).to_i
for j in 0...offset
red = r + r_rate * i / (w * rate)
green = g + g_rate * i / (w * rate)
blue = b + b_rate * i / (w * rate)
set_pixel(x + i - j + 1, y + j - 1, Color.new(red, green, blue, alpha))
end
end
end
else
for i in 0...offset
red = color3.red * i / offset
green = color3.green * i / offset
blue = color3.blue * i / offset
fill_rect(x - i + 1, y + i - 1, w, 1, Color.new(red, green, blue, alpha))
if $game_system.bar_style == 4
if i < offset / 2
red = (r + r_rate) * (i+1) / (offset / 2)
green = (g + g_rate) * (i+1) / (offset / 2)
blue = (b + b_rate) * (i+1) / (offset / 2)
else
red = (r + r_rate) * (offset+1-i) / (offset / 2 + 1)
green = (g + g_rate) * (offset+1-i) / (offset / 2 + 1)
blue = (b + b_rate) * (offset+1-i) / (offset / 2 + 1)
end
else
red = r + r_rate * i / offset
green = g + g_rate * i / offset
blue = b + b_rate * i / offset
end
fill_rect(x - i + 1, y + i - 1, w*rate, 1, Color.new(red, green, blue, alpha))
end
end
if styles.include?($game_system.bar_style)
for i in 0...w
for j in 0...offset
if styles.include?($game_system.bar_style) and i % 8 < 2
set_pixel(x + i - j + 1, y + j - 1, Color.new(0, 0, 0, alpha))
end
end
end
end
else
fill_rect(x+1, y-3, w+2, 12, Color.new(255, 255, 255, 192))
for i in 0...10
if i < 5
red = rx * (i+1) / 5
green = gx * (i+1) / 5
blue = bx * (i+1) / 5
else
red = rx * (11-i) / 6
green = gx * (11-i) / 6
blue = bx * (11-i) / 6
end
fill_rect(x+2, y+i-2, w, 1, Color.new(red, green, blue, alpha))
if i < 5
red = (r + r_rate) * (i+1) / 5
green = (g + g_rate) * (i+1) / 5
blue = (b + b_rate) * (i+1) / 5
else
red = (r + r_rate) * (11-i) / 6
green = (g + g_rate) * (11-i) / 6
blue = (b + b_rate) * (11-i) / 6
end
fill_rect(x+2, y+i-2, w*rate, 1, Color.new(red, green, blue, alpha))
end
for i in 0...w/8
fill_rect(x+2+i*8, y-2, 1, 10, Color.new(0, 0, 0, alpha))
fill_rect(x+2+(i+1)*8-1, y-2, 1, 10, Color.new(0, 0, 0, alpha))
end
end
end

end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
alias draw_actor_hp_blizzart_later draw_actor_hp
def draw_actor_hp(actor, x, y, w = 148)
unless $game_system.BARS
draw_actor_hp_blizzart_later(actor, x, y, w)
return
end
w -= 12
rate = actor.hp.to_f / actor.maxhp
if rate > 0.6
color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
elsif rate > 0.2 and rate <= 0.6
color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
elsif rate <= 0.2
color1 = Color.new(400 * rate, 0, 0, 192)
color2 = Color.new(240, 0, 0, 192)
end
color3 = Color.new(0, 80, 0, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
if $scene.is_a?(Scene_Battle)
draw_actor_hp_blizzart_later(actor, x, y, w)
else
draw_actor_hp_blizzart_later(actor, x, y)
end
end
alias draw_actor_sp_blizzart_later draw_actor_sp
def draw_actor_sp(actor, x, y, w = 148)
unless $game_system.BARS
draw_actor_sp_blizzart_later(actor, x, y, w)
return
end
w -= 12
rate = actor.sp.to_f / actor.maxsp
if rate > 0.4
color1 = Color.new(60 - 66 * (rate-0.4), 20, 80, 192)
color2 = Color.new(180 - 200 * (rate-0.4), 60, 240, 192)
elsif rate <= 0.4
color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate, 192)
color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate, 192)
end
color3 = Color.new(0, 0, 80, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
if $scene.is_a?(Scene_Battle)
draw_actor_sp_blizzart_later(actor, x, y, w)
else
draw_actor_sp_blizzart_later(actor, x, y)
end
end
alias draw_actor_exp_blizzart_later draw_actor_exp
def draw_actor_exp(actor, x, y, w = 148)
unless $game_system.BARS
draw_actor_exp_blizzart_later(actor, x, y)
return
end
w += 12
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(80, 80, 80, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
draw_actor_exp_blizzart_later(actor, x, y)
end

end
#==============================================================================
# Location names with pictures by Blizzard
# Version: 2.0
# Date: 14.11.2006
#
# NOTE: This script WILL corrupt old savegames!
#
# Instructions:
# Connect map IDs with picture names. All pictures MUST be in the the Names
# folder in your picture folder.
#==============================================================================
#==============================================================================
# Game_System
#==============================================================================
class Game_System

attr_accessor :map_name_id
attr_accessor :name_timer

alias init_names_later initialize
def initialize
init_names_later
@map_name_id = 0
@name_timer = 0
end

end
#==============================================================================
# Name_Sprite
#==============================================================================
class Name_Sprite < RPG::Sprite

attr_accessor :timer

def initialize
super
if $game_system.map_name_id == $game_map.map_id
@timer = $game_system.name_timer
else
@timer = 0
end
self.opacity = @timer * 15 if @timer < 16
self.opacity = 255 - (@timer * 15) if @timer > 78
$game_system.map_name_id = $game_map.map_id
self.bitmap = get_image($game_map.map_id)
self.dispose if self.bitmap == nil
end

def get_image(id)
case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START of Database
#
# Use this template to configure this add-on:
# when ID then name = "FILE_NAME"
# ID - map ID where the picture should be displayed
# FILE_NAME - the file name of the picture file in the Pictures/Names folder
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 2 then name = "MAP002_pic"
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END of Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
else
return nil
end
bitmap = RPG::Cache.picture("Names\\" + name)
return bitmap
end

def dispose
$game_system.name_timer = @timer
super
end

end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map

attr_accessor :name

alias init_name_later initialize
def initialize
init_name_later
@name = Name_Sprite.new if $game_system.LOCATION_NAMES
end

alias upd_name_later update
def update
if @name != nil
unless @name.disposed?
@name.timer += 1
@name.opacity += 15 if @name.timer < 16
@name.opacity -= 15 if @name.timer > 78
if @name.opacity == 0
@name.dispose
@name = nil
end
else
@name = nil
end
end
upd_name_later
end

alias dispose_name_later dispose
def dispose
dispose_name_later
unless @name == nil
$game_system.name_timer = @name.timer
@name.dispose
end
@name = nil
end

end
#==============================================================================
# Black fade by Blizzard
# Version: 1.0
# Date: 28.4.2006
#
#
# Replaces the standard fading between maps with a black screen. Note that this
# add-on is much less compatible than other add-ons and therefore it might
# cause problems
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
TRANSIT = 8 # how long does the transition take
BLACKTIME = 12 # how long does black screen stay
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map

alias transfer_player_black_fade_later transfer_player
def transfer_player
unless $game_system.BLACKFADE
transfer_player_black_fade_later
return
end
$game_temp.player_transferring = false
if $game_map.map_id != $game_temp.player_new_map_id
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
case $game_temp.player_new_direction
when 2 then $game_player.turn_down
when 4 then $game_player.turn_left
when 6 then $game_player.turn_right
when 8 then $game_player.turn_up
end
$game_player.straighten
$game_map.update
Graphics.freeze if $game_temp.transition_processing # added
@spriteset.dispose
# added from here
if $game_temp.transition_processing
Graphics.transition(TRANSIT)
Graphics.freeze
Graphics.transition(BLACKTIME)
Graphics.freeze
end
# to here
@spriteset = Spriteset_Map.new
if $game_temp.transition_processing
$game_temp.transition_processing = false
Graphics.transition(TRANSIT) # instead of 20 now TRANSIT
end
$game_map.autoplay
Graphics.frame_reset
Input.update
end

end
#==============================================================================
# Simple Shaded Text by Blizzard
# Version: 1.0c
# Date: 2.7.2006
#==============================================================================
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap

alias draw_text_shaded_text_later draw_text
def draw_text(x2, y2, w2 = 0, h2 = 0, text2 = "", a2 = 0)
if x2.is_a?(Rect)
x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2
else
x, y, w, h, text, a = x2, y2, w2, h2, text2, a2
end
unless $game_system.SHADED_TEXT
draw_text_shaded_text_later(x, y, w, h, text, a)
return
end
save_color = self.font.color.clone
self.font.color = Color.new(0, 0, 0, 255)
draw_text_shaded_text_later(x+1, y+1, w, h, text, a)
self.font.color = save_color
draw_text_shaded_text_later(x, y, w, h, text, a)
end

end
#==============================================================================
# Blizz-Art lagless HUD by Blizzard
# Version: 1.1b
# Date: 16.12.2006
# Date v1.1b: 12.1.2007
#
#
# IMPORTANT:
#
# The "not simple" method of using this add-on REQUIRES Blizz-Art Gradient
# styler for HP/SP/EXP bars, names and Gold.
#
#
# Instructions:
#
# This add-on will add a HUD into your game. Configure the part below. The
# meanings of the variables are:
#
# SIMPLE - set this to false to use Blizz-Art Gradient styler instead of
# the normal bars
# FULL_DISPLAY - set to true to show the stats of all party members in the
# display (otherwise hold D and press Q/W to cycle through the
# actors)
# TOP - set this value to false and the HUD will appear on the bottom
#
# Side-Note:
#
# This add-on comes BELOW the Gradient Styler. This HUD was made for 1, 2, 3 or
# 4 characters. More than 4 characters are not displayed.
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start HUD Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SIMPLE = true
FULL_DISPLAY = false
TOP = true
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End HUD Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_System
#==============================================================================
class Game_System

attr_accessor :index
attr_accessor :bar_style unless FULL_DISPLAY
attr_reader :bar_opacity

alias init_blizzart_hud_later initialize
def initialize
init_blizzart_hud_later
@index = 0 unless FULL_DISPLAY
unless BLIZZ_ART
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#
# Configure this part manually if you have no "Options" controller for the
# styles and the opacity. (style: 0~5, opacity: 0~256) (256 is the same as 255)
# Note that this WILL be overriden if you use Blizz-Art Gradient styler.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@bar_style = 5
@bar_opacity = 256
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
end

def bar_opacity=(alpha)
if alpha > 256
alpha = 256
elsif alpha < 0
alpha = 0
end
@bar_opacity = alpha
end

end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap

def gradient_bar_simple(x, y, w, color1, color2, color3, rate)
rx = color3.red
gx = color3.green
bx = color3.blue
w = w / 8 * 8
y += 3
r = color1.red
g = color1.green
b = color1.blue
r_rate = color2.red - r
g_rate = color2.green - g
b_rate = color2.blue - b
alpha = $game_system.bar_opacity
return if alpha == 0
alpha -= 1 if alpha == 256
fill_rect(x+1, y-3, w+2, 14, Color.new(255, 255, 255, 192))
for i in 0...12
if i < 6
red = rx * (i+1) / 6
green = gx * (i+1) / 6
blue = bx * (i+1) / 6
else
red = rx * (13-i) / 7
green = gx * (13-i) / 7
blue = bx * (13-i) / 7
end
fill_rect(x+2, y+i-2, w, 1, Color.new(red, green, blue, alpha))
if i < 6
red = (r + r_rate) * (i+1) / 6
green = (g + g_rate) * (i+1) / 6
blue = (b + b_rate) * (i+1) / 6
else
red = (r + r_rate) * (13-i) / 7
green = (g + g_rate) * (13-i) / 7
blue = (b + b_rate) * (13-i) / 7
end
fill_rect(x+2, y+i-2, w*rate, 1, Color.new(red, green, blue, alpha))
end
end

unless BLIZZ_ART
alias draw_text_shaded_text_later draw_text
def draw_text(x2, y2, w2 = 0, h2 = 0, text2 = "", a2 = 0)
if x2.is_a?(Rect)
x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2
else
x, y, w, h, text, a = x2, y2, w2, h2, text2, a2
end
save_color = self.font.color.clone
self.font.color = Color.new(0, 0, 0, 255)
draw_text_shaded_text_later(x+1, y+1, w, h, text, a)
self.font.color = save_color
draw_text_shaded_text_later(x, y, w, h, text, a)
end
end
def draw_text_full(x2, y2, w2 = 0, h2 = 0, text2 = "", a2 = 0)
if x2.is_a?(Rect)
x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2
else
x, y, w, h, text, a = x2, y2, w2, h2, text2, a2
end
save_color = self.font.color.clone
self.font.color = Color.new(0, 0, 0, 255)
draw_text_shaded_text_later(x+1, y+1, w, h, text, a)
draw_text_shaded_text_later(x-1, y+1, w, h, text, a)
draw_text_shaded_text_later(x-1, y-1, w, h, text, a)
draw_text_shaded_text_later(x+1, y-1, w, h, text, a)
self.font.color = save_color
draw_text_shaded_text_later(x, y, w, h, text, a)
end

end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
def draw_actor_exp_alt(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 64, 32, "next")
self.contents.font.color = normal_color
self.contents.draw_text(x + 56, y, 84, 32, actor.next_rest_exp_s, 2)
end

alias draw_actor_exp_alt_blizzart_hud_later draw_actor_exp_alt
def draw_actor_exp_alt(actor, x, y, w = 148)
w -= 12
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(80, 80, 80, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
draw_actor_exp_alt_blizzart_hud_later(actor, x, y)
end
def draw_actor_hp_hud(actor, x, y, w = 148)
w -= 12
rate = actor.hp.to_f / actor.maxhp
if rate > 0.6
color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
elsif rate > 0.2 and rate <= 0.6
color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
elsif rate <= 0.2
color1 = Color.new(400 * rate, 0, 0, 192)
color2 = Color.new(240, 0, 0, 192)
end
color3 = Color.new(0, 80, 0, 192)
self.contents.gradient_bar_simple(x, y, w, color1, color2, color3, rate)
y -= 9
self.contents.font.color = system_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(x + 4, y, 32, 32, $data_system.words.hp)
hp_x = x + w - 128
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(hp_x, y, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = normal_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text_full(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
self.contents.font.color.alpha = 255
end

def draw_actor_sp_hud(actor, x, y, w = 148)
w -= 12
rate = actor.sp.to_f / actor.maxsp
if rate > 0.4
color1 = Color.new(60 - 66 * (rate-0.4), 20, 80, 192)
color2 = Color.new(180 - 200 * (rate-0.4), 60, 240, 192)
elsif rate <= 0.4
color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate, 192)
color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate, 192)
end
color3 = Color.new(0, 0, 80, 192)
self.contents.gradient_bar_simple(x, y, w, color1, color2, color3, rate)
y -= 9
self.contents.font.color = system_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(x + 4, y, 32, 32, $data_system.words.sp)
sp_x = x + w - 128
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(sp_x, y, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text_full(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end

def draw_actor_exp_hud(actor, x, y, w = 148)
w -= 12
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(80, 80, 80, 192)
self.contents.gradient_bar_simple(x, y, w, color1, color2, color3, rate)
y -= 9
self.contents.font.color = system_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(x + 4, y, 80, 32, "next")
self.contents.font.color = normal_color
self.contents.font.color.alpha = 192
self.contents.draw_text_full(x + 56, y, 84, 32, actor.next_rest_exp_s, 2)
self.contents.font.color.alpha = 255
end

end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler

def now_exp
return @exp - @exp_list[@level]
end

def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end

end
#==============================================================================
# Hud
#==============================================================================
class Hud < Window_Base

def initialize
super(-12, -16, 192, 112)
self.opacity = 0
unless TOP
self.y += 400
self.y -= 16 unless SIMPLE
end
self.height += 32 unless SIMPLE
refresh
end

def refresh
self.contents.clear if self.contents != nil
if FULL_DISPLAY
num = $game_party.actors.size
self.width = 32 + 160 * num
else
num = $game_party.actors.size
self.width = 192
end
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 16
self.contents.font.bold = true
@names = []
@levels = []
@hps = []
@sps = []
@exps = []
for i in 0...num
if FULL_DISPLAY
actor = $game_party.actors[i]
else
actor = $game_party.actors[$game_system.index]
end
self.contents.font.italic = true
self.contents.font.size += 2
self.contents.font.color = system_color
self.contents.draw_text(i*160, -8, 152, 32, actor.name, 1)
self.contents.font.italic = false
if SIMPLE
self.contents.font.size -= 2
draw_actor_hp_hud(actor, i*160, 16, 160)
draw_actor_sp_hud(actor, i*160, 32, 160)
draw_actor_exp_hud(actor, i*160, 48, 160)
else
draw_actor_hp(actor, i*160, 8, 160)
draw_actor_sp(actor, i*160, 32, 160)
draw_actor_exp_alt(actor, i*160, 56, 160)
self.contents.font.size -= 2
end
end
text = "#{$data_system.words.gold}: #{$game_party.gold}"
self.contents.font.color = Color.new(255, 255, 0)
if SIMPLE
self.contents.draw_text(0, 56, 152, 32, text)
else
self.contents.draw_text(0, 84, 152, 32, text)
end
for actor in $game_party.actors
@names.push(actor.name)
@levels.push(actor.level)
@hps.push(actor.hp)
@sps.push(actor.sp)
@exps.push(actor.exp)
end
@gold = $game_party.gold
end

def test_changes
return true if $game_party.gold != @gold
if FULL_DISPLAY
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.name != @names[i] or actor.level != @levels[i] or
actor.hp != @hps[i] or actor.sp != @sps[i]
return true
end
end
else
index = $game_system.index
actor = $game_party.actors[index]
if actor.name != @names[index] or actor.level != @levels[index] or
actor.hp != @hps[index] or actor.sp != @sps[index]
return true
end
end
return false
end

end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map

alias main_blizzart_hud_later main
def main
@hud = Hud.new if $game_system.HUD
main_blizzart_hud_later
@hud.dispose if @hud != nil
end

alias upd_blizzart_hud_later update
def update
if $game_system.HUD
@hud = Hud.new if @hud == nil
else
@hud.dispose if @hud != nil
@hud = nil
end
if @hud != nil
if Input.press?(Input::Z) and Input.trigger?(Input::L)
$game_system.index += $game_party.actors.size - 1
$game_system.index %= $game_party.actors.size
@hud.refresh
elsif Input.press?(Input::Z) and Input.trigger?(Input::R)
$game_system.index += 1
$game_system.index %= $game_party.actors.size
@hud.refresh
elsif @hud.test_changes
@hud.refresh
end
end
upd_blizzart_hud_later
end

end
#==============================================================================
# Screen Tremble by Blizzard
# Version: 1.0c
# Date: 22.1.2007
# Date v1.0b: 24.1.2007
#
#
# new in 1.0b:
# - improved code and better method of shaking the screen apart
#
# new in 1.0c:
# - improved code and better method of shaking the screen apart
#
#
# Compatibility:
#
# 95% of full compatibility with SDK. WILL corrupt old savegames. Might glitch
# with exotic CBS-es or exotic Map modifications.
#
#
# Explanation:
#
# This add-on will add an advanced feature of screen shaking: Vertical shaking!
#
#
# Configuration:
#
# Change TREMBLE_SWITCH to a switch ID number. Turn this switch on to enable
# vertical screen-shaking. You MUST have screen shaking turned on. This add-on
# will not work if no screen shaking is activated at all. You can't have only
# vertical screen shaking.
#==============================================================================
TREMBLE_SWITCH = 189
#==============================================================================
# Game_Screen
#==============================================================================
class Game_Screen

attr_reader :tremble

alias init_tremble_later initialize
def initialize
init_tremble_later
@tremble = 0
@tremble_power = 0
@tremble_direction = 1
end

alias upd_tremble_later update
def update
upd_tremble_later
return unless $game_system.TREMBLE
if $game_switches[TREMBLE_SWITCH] and (@shake_duration >= 1 or @tremble != 0)
delta = (@tremble_power * (@shake_speed + 1) * @tremble_direction) / 10.0
if @shake_duration <= 1 and @tremble * (@tremble + delta) < 0
@tremble = 0
else
@tremble += delta
end
@tremble_direction = -1 if @tremble > @tremble_power * 1.5
@tremble_direction = 1 if @tremble < -@tremble_power * 1.5
@shake_duration -= 1 if @shake_duration >= 1
end
end
alias start_tremble start_shake
def start_shake(power, speed, duration)
start_tremble(power, speed, duration)
@tremble_power = power * 8 / 7 if $game_switches[TREMBLE_SWITCH]
end

end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map

alias upd_tremble_later update
def update
if $game_switches[TREMBLE_SWITCH]
@viewport1.oy = $game_screen.tremble
else
@viewport1.oy = 0
end
upd_tremble_later
end
end
#==============================================================================
# Spriteset_Battle
#==============================================================================
class Spriteset_Battle

alias upd_tremble_later update
def update
if $game_switches[TREMBLE_SWITCH]
@viewport1.oy = $game_screen.tremble
else
@viewport1.oy = 0
end
upd_tremble_later
end
end
#==============================================================================
# Animation Stack by Blizzard
# Version: 1.0
# Date: 1.2.2007
#
#
# This add-on will make the display of all status effect animations possible.
#
#
# LOOPS - set this value to the number of how many time an animation should
# loop before the next one is being displayed
#==============================================================================
LOOPS = 3
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler

alias init_anima_stack_later initialize
def initialize
init_anima_stack_later
@anima_count = 0
@anima_index = 0
end

alias state_animation_id_anima_stack_later state_animation_id
def state_animation_id
unless $game_system.ANIMATION_STACK
return state_animation_id_anima_stack_later
end
if @states.size == 0
@anima_count = 0
@anima_index = 0
return 0
end
size = 0
loop do
@anima_index %= @states.size
state = $data_states[@states[@anima_index]]
break unless $data_animations[state.animation_id] == nil
@anima_index += 1
size += 1
return 0 if size == @states.size
end
state = $data_states[@states[@anima_index]]
if @anima_count > 2*LOOPS*$data_animations[state.animation_id].frame_max
@anima_count = 0
@anima_index += 1
else
@anima_count += 1
end
return state.animation_id
end

end
#==============================================================================
# Simple facesets by Blizzard
# Version: 1.02b
# Date: 18.2.2007
#
#
# This litte add-on will change the spritesets in the main menu to facesets or
# any other pictures you might be using. Name the pictures exactly like the
# spritesets and add _face to their name. Put them into the "Characters"
# folder. Size is not fixed, the script will put it into the correct place,
# it's up to you to find the right size.
#
# Note:
# This might not be comtpatible with exotic CMS-es.
#==============================================================================
FACE_HUE = false # set it to true to apply the same hue as the spriteset
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window

alias draw_actor_graphic_faces_later draw_actor_graphic
def draw_actor_graphic(actor, x, y)
if $game_system.FACESETS and self.is_a?(Window_MenuStatus)
if actor != nil and actor.character_name != ""
draw_actor_face(actor, x, y)
end
else
draw_actor_graphic_faces_later(actor, x, y)
end
end

def draw_actor_face(actor, x, y)
hue = (FACE_HUE ? actor.character_hue : 0)
bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x-bitmap.width/2, y-bitmap.height, bitmap, src_rect)
end
end
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# #
# # # ##### # # # ##### # # #
# # # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# ### # # ##### # # # #
# #
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
#==============================================================================
# FPS Modulator by Blizzard
# Version: 1.0b
# Date: 12.2.2006
#
# Holding SHIFT and pressing Q/W will allow you to speed up the game like in an
# emulator up to 3 times (sorry, RMXP doesn't support more).
# Remove the triple commented lines (###) to allow this feature even in the
# normal game, not only the Debug mode.
#==============================================================================
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map

alias update_fps_later update
def update
if $game_system.FPS_MODULATOR
if $DEBUG ###
if Input.press?(Input::A) and Input.press?(Input::R)
Graphics.frame_rate += 40
return
elsif Input.press?(Input::A) and Input.trigger?(Input::L)
Graphics.frame_rate -= 40 unless Graphics.frame_rate == 40
return
end
end ###
end
update_fps_later
end
end
#==============================================================================
# Speed Modulator by Blizzard
# Version: 1.01b
# Date: 12.2.2006
# Date v1.01: 12.1.2007
#
# Pressing Q/W will allow you to speed up the main character. Pressing SHIFT
# will reset his speed immediately.
# Remove the triple commented lines (###) to allow this feature even in the
# normal game, not only the Debug mode.
#==============================================================================
#==============================================================================
# Game_Player
#==============================================================================
class Game_Player

alias upd_speed_later update
def update
if $game_system.SPEED_MODULATOR
if $DEBUG ###
if Input.trigger?(Input::A)
@move_speed = 4
return
elsif not Input.press?(Input::A) and not Input.press?(Input::X) and
Input.trigger?(Input::R)
@move_speed += 1 unless @move_speed == 6
return
elsif not Input.press?(Input::A) and not Input.press?(Input::X) and
Input.trigger?(Input::L)
@move_speed -= 1 unless @move_speed == 1
return
end
end ###
end
upd_speed_later
end

end
#==============================================================================
# Blizz-ABS Event Anti-Lag (ABSEAL) by Blizzard
# Version: 1.0
# Date: 25.10.2006
#
#
# Compatibility:
#
# 99% compatible with SDK, not tested altough. 99% chance of compatibility with
# anything.
#
#
# Advantages compared to other Anti-Lag Systems:
#
# - much more compatible
# - faster and better processing
# - about 5 times less code
# - built-in option to disable in specific maps
# - configurable strength
#
#
# Introduction:
#
# This script will decrease the lag caused by too many events in maps by only
# updating the events visible on the screen and a little bit beyond.
# "Auto-Start" and "Parallel process" events are NOT affected by this script.
#
#
# Configuration:
#
# Put in "DISABLE_ANTI_LAG_IDS" any map IDs where the ABSEAL should be
# disabled. Change FACTOR to how many "tile squares" it should update beyond
# the screen. 2 is default, values under 1 will be corrected. Floating point
# numbers will be corrected.
#
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DISABLE_ANTI_LAG_IDS = []
FACTOR = 2
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_Event
#==============================================================================
class Game_Event

alias upd_player_blizzabs_later update
def update
upd_player_blizzabs_later if self.update?
end

def update?
return true unless $game_system.ABSEAL
return true if DISABLE_ANTI_LAG_IDS.include?($game_map.map_id)
return true if self.trigger == 3 or self.trigger == 4
factor = FACTOR < 1 ? 1 : FACTOR.to_i
return false if self.real_x <= $game_map.display_x - factor * 128
return false if self.real_y <= $game_map.display_y - factor * 128
return false if self.real_x >= $game_map.display_x + 2560 + factor * 128
return false if self.real_y >= $game_map.display_y + 1920 + factor * 128
return true
end

end
#==============================================================================
# Sprite_Character
#==============================================================================
class Sprite_Character
alias upd_player_blizzabs_later update
def update
unless $game_system.ABSEAL
upd_player_blizzabs_later
return
end
if @character.is_a?(Game_Event)
upd_player_blizzabs_later if @character.update?
else
upd_player_blizzabs_later
end
end
end
#==============================================================================
# FullScreen? by Blizzard
# Version: 1.21b
# Date: 14.11.2006
#
# new in v1.21b:
# - better code, easier to use
#==============================================================================
#==============================================================================
# Window_Command
#==============================================================================
class Window_FullScreen < Window_Selectable
def initialize(width, commands)
super(0, 0, width, commands.size * 32 + 64)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32 + 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
refresh
self.index = 0
end
def refresh
self.contents.clear
qu = "Switch to fullscreen?"
self.contents.draw_text(0, 0, width - 32, 32, qu, 1)
for i in 0...@item_max
draw_item(i, normal_color)
end
end
def draw_item(index, color)
rect = Rect.new(4, 32+32 * index, self.contents.width - 8, 32)
rect2 = Rect.new(4+1, 32+32 * index+1, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = color
self.contents.draw_text(rect, @commands[index], 1)
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = 64
x = (self.contents.width - cursor_width) / 2
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x, y + 32, cursor_width, 32)
end
end

#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title

alias main_fullscreen? main
def main
if TONS_OF_ADDONS::FULLSCREEN and not $DEBUG
unless $game_started
Graphics.freeze
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new
$game_system.windowskin_name = $data_system.windowskin_name
@window = Window_FullScreen.new(320, ["Yes" ,"No"])
@window.x = 320 - @window.width / 2
@window.y = 240 - @window.height / 2
@window.opacity = 0
Graphics.transition(10)
loop do
Graphics.update
Input.update
@window.update
update_window
break if $game_started
end
Graphics.freeze
@window.dispose
Graphics.transition(10)
Graphics.freeze
end
else
$game_started = true
end
main_fullscreen?
end

def update_window
if Input.trigger?(Input::C)
if @window.index == 0
$game_system.se_play($data_system.decision_se)
keybd = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v'
keybd.call 0xA4, 0, 0, 0
keybd.call 13, 0, 0, 0
keybd.call 13, 0, 2, 0
keybd.call 0xA4, 0, 2, 0
else
$game_system.se_play($data_system.cancel_se)
end
$game_started = true
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$game_started = true
end
end
end
#==============================================================================
# Death Toll by Blizzard
# Version: 1.2b
# Date: 10.10.2006
# Date v1.2b: 6.12.2006
#
#
# Instructions:
#
# Set ID to the variable ID you want to use to store the number of killed
# enemies. To show the number just use in a message \v[X] where X is the same
# number as you set ID.
#
# new in 1.2b:
# Counts now actor deaths, too. The numbers are stored in the variables with
# the ID "DT_ID + actor's ID", so i.e. for DT_ID = 26, variable number 26 will
# contain killed enemies, number 27 will contain the deaths of actor with ID 1,
# number 28 will contain the deaths of actor with ID 2, etc.
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DT_ID = 26 # variable ID
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias main_dt_later main
def main
@td_flag = 0
main_dt_later
end

alias upd_dt_later update
def update
@td_flag = $game_troop.enemies.size if @td_flag == 0
upd_dt_later
end

alias battle_end_td_later battle_end
def battle_end(result)
battle_end_td_later(result)
return unless $game_system.DEATH_TOLL
count = 0
for enemy in $game_troop.enemies
count += 1 unless enemy.exist? or enemy.hidden
end
$game_variables[DT_ID] += @td_flag - count
end
end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor

def hp=(val)
super(val)
$game_variables[DT_ID + self.id] += 1 if val <= 0
end

end

#==============================================================================
# Window_BattleResult Add-on by Blizzard
# Version: 1.0
# Date 27.8.2006
#
#
# Compatibility:
#
# 99% chance of compatibility with everything.
#
#
# Features:
#
# - instead of displaying each item seperatedly, it displays now item and
# quantity
#==============================================================================
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
alias init_result_addon_later initialize
def initialize(exp, gold, treasures)
unless $game_system.WINDOW_BATTLERESULT
init_result_addon_later(exp, gold, treasures)
return
end
@exp = exp
@gold = gold
set_treasures(treasures)
super(160, 0, 320, @treasures[0].size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end

alias refresh_result_addon_later refresh
def refresh
unless $game_system.WINDOW_BATTLERESULT
refresh_result_addon_later
return
end
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for i in 0...@treasures.size
draw_item(@treasures[0][i], 4, y, @treasures[1][i])
y += 32
end
end

def set_treasures(treasures)
items = []
weapons = []
armors = []
stuff = []
qua = []
for i in treasures
items.push(i.id) if i.is_a?(RPG::Item)
weapons.push(i.id) if i.is_a?(RPG::Weapon)
armors.push(i.id) if i.is_a?(RPG::Armor)
end
for id in items
if stuff.include?($data_items[id])
qua[stuff.index($data_items[id])] += 1
else
stuff.push($data_items[id])
qua.push(1)
end
end
for id in weapons
if stuff.include?($data_weapons[id])
qua[stuff.index($data_weapons[id])] += 1
else
stuff.push($data_weapons[id])
qua.push(1)
end
end
for id in armors
if stuff.include?($data_armors[id])
qua[stuff.index($data_armors[id])] += 1
else
stuff.push($data_armors[id])
qua.push(1)
end
end
@treasures = []
@treasures.push(stuff)
@treasures.push(qua)
end

def draw_item(item, x, y, qua = 1)
return if item == nil
w1 = self.contents.text_size("0").width
w2 = self.contents.text_size("x ").width
x += w1 + w2 + 4
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.font.color = normal_color
self.contents.draw_text(4, y, w1, 32, qua.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(w1 + 8, y, w2, 32, "x")
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end

end
#==============================================================================
# Unique Skill Commands by Blizzard
# Version: 1.2b
# Date: 14.11.2006
#
#
# - new in 1.2b:
# Now corresponding to the Actor ID instead of the class ID and only refreshes
# the window if neccessary.
#==============================================================================
#==============================================================================
# Window_Command
#==============================================================================
class Window_Command

attr_accessor :actor

def setup_command_name
return unless $game_system.UNIQUE_SKILL_COMMANDS
return if @actor == nil
old_command = @commands[1]
@commands[1] = case @actor.id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Database
#
# Just like usual in all of my scripts and add-on the template is:
# when X then "COMMAND"
# X - class ID on the database
# COMMAND - the unique skill command for the appropriate class
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 1 then "Technic"
when 2 then "Lancetech"
when 3 then "Powers"
when 4 then "Skills"
when 5 then "Arrowmagic"
when 6 then "Ammo"
when 7 then "White Magic"
when 8 then "Magic"
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
refresh if old_command != @commands[1]
end

end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias phase3_setup_command_window_unique_command_later phase3_setup_command_window
def phase3_setup_command_window
phase3_setup_command_window_unique_command_later
@actor_command_window.actor = @active_battler
@actor_command_window.setup_command_name
end

end
#==============================================================================
# Ultimate Font Override by Blizzard
# Version: 1.0b
# Date: 19.10.2006
#
# You can change the font/fontsize with the "Call script" event command or
# directly through a script by using these methods:
#
# $game_system.fontname = "FONTNAME"
# $game_system.fontsize = FONTSIZE
#
# It will override the font from any RMXP version. It is also possible to
# change the font during the game. It will be saved, too.
#==============================================================================
#==============================================================================
# Game_System
#==============================================================================
class Game_System

attr_reader :fontname
attr_reader :fontsize

alias init_ultimate_font_override_later initialize
def initialize
init_ultimate_font_override_later
self.fontname = "Arial"
self.fontsize = 24
end

def fontname=(name)
$defaultfonttype = $fontface = @fontname = name
end

def fontsize=(size)
$defaultfontsize = $fontsize = @fontsize = size
end

end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
alias init_font_override_later initialize
def initialize(w, h = nil)
if w.is_a?(Numeric) and h.is_a?(Numeric)
init_font_override_later(w, h)
else
init_font_override_later(w)
end
return unless $game_system.ULTIMATE_FONT_OVERRIDE
if $game_system.fontname != nil and not $scene.is_a?(Scene_Title)
self.font.name = $game_system.fontname
self.font.size = $game_system.fontsize
else
self.font.name = "Arial"
self.font.size = 24
end
end

end
#==============================================================================
# Heal at LvlUp by Blizzard
# Version: 1.0b
# Date: 4.12.2006
#
#
# Compatiblity:
#
# Might not work with exotic CBS-es.
#==============================================================================
#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base

alias refesh_heal_at_lvlup_later refresh
def refresh
if $game_system.HEAL_AT_LVLUP
for i in 0...$game_party.actors.size
if @level_up_flags[i]
$game_party.actors[i].hp = $game_party.actors[i].maxhp
$game_party.actors[i].sp = $game_party.actors[i].maxsp
end
end
end
refesh_heal_at_lvlup_later
end

end
#==============================================================================
# "Weapon/Armor HP/SP Plus" Add-on by Blizzard
# Version: 1.0b
# Date: 18.8.2006
#
#
# Compatibility:
#
# 95% chance of compatibility with SDK. May cause slight incompatibility issues
# with CBS-es, but can be made compatible easily.
#
#
# Features:
#
# - uses static (i.e. 500 HP more) or dynamic (i.e. 30% HP more) increasements
# - easy to set up
# - does NOT change any rxdata files
# - this script comes UNDER SDK SCRIPTS if you use any
#
#
# Instructions:
#
# - Explanation:
#
# This script will add the option for Weapons/Armors to have HP/SP pluses while
# equipped just like the usual STR, DEX, INT etc. pluses.
#
# - Configuration
#
# Find the phrase saying "START" (CTRL+F) to find the database parts. Use the
# following template to configure your database:
#
# when ID then return [EXPR, VAL]
#
# ID - Weapon/Armor ID in the normal database
# EXPR - set to false if you want "static" increasement or true if you want
# "dynamic" increasement
# VAL - if you use static increasement, set this value to any integer you want
# (i.e. 100, -500, 831 etc.) to increase the HP/SP, otherwise set it to
# any decimal value of the final HP/SP (i.e. 1.2 = 20% more, 2.3 = 130%
# more, 0.7 = 30% less)
#
# VAL can be a negative integer (static increasement) OR a decimal number
# greater than 0 (dynamic increasement).
#
# Change MAX_HP and MAX_SP to different values if you use another max HP and/or
# max SP limit than 9999.
#
#
# Side Note:
#
# It took more to write the instructions than to write and test script itself.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
# or send me an e-mail:
# boris_blizzard@yahoo.de
#==============================================================================
MAX_HP = 9999 # change if needed, 9999 is standard
MAX_SP = 9999 # change if needed, 9999 is standard
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler

alias maxsp_hpsp_add_on_later maxsp
def maxsp
val = [MAX_SP, maxsp_hpsp_add_on_later].min
@sp = val if @sp > val
return val
end

end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler

alias maxhp_hpsp_add_on_later maxhp
def maxhp
return maxhp_hpsp_add_on_later unless $game_system.HPSPPLUS
val = [MAX_HP, maxhp_hpsp_add_on_later].min
@hp = val if @hp > val
return val
end

alias base_maxhp_hpsp_add_on_later base_maxhp
def base_maxhp
return base_maxhp_hpsp_add_on_later unless $game_system.HPSPPLUS
plus = 0
multi = 1.0
weapon = $data_weapons[@weapon_id]
armor = []
armor.push($data_armors[@armor1_id])
armor.push($data_armors[@armor2_id])
armor.push($data_armors[@armor3_id])
armor.push($data_armors[@armor4_id])
if weapon != nil
multi *= weapon.hp_plus[1] if weapon.hp_plus[0]
plus += weapon.hp_plus[1] if not weapon.hp_plus[0]
end
for i in 0...4
if armor[i] != nil
multi *= armor[i].hp_plus[1] if armor[i].hp_plus[0]
plus += armor[i].hp_plus[1] if not armor[i].hp_plus[0]
end
end
return (multi * (plus + base_maxhp_hpsp_add_on_later)).to_i
end

alias base_maxsp_hpsp_add_on_later base_maxsp
def base_maxsp
return base_maxsp_hpsp_add_on_later unless $game_system.HPSPPLUS
plus = 0
multi = 1.0
weapon = $data_weapons[@weapon_id]
armor = []
armor.push($data_armors[@armor1_id])
armor.push($data_armors[@armor2_id])
armor.push($data_armors[@armor3_id])
armor.push($data_armors[@armor4_id])
if weapon != nil
multi *= weapon.sp_plus[1] if weapon.sp_plus[0]
plus += weapon.sp_plus[1] if not weapon.sp_plus[0]
end
for i in 0...4
if armor[i] != nil
multi *= armor[i].sp_plus[1] if armor[i].sp_plus[0]
plus += armor[i].sp_plus[1] if not armor[i].sp_plus[0]
end
end
return (multi * (plus + base_maxsp_hpsp_add_on_later)).to_i
end

end
#==============================================================================
# module RPG
# Weapon
#==============================================================================
class RPG::Weapon

attr_reader :hp_plus
attr_reader :sp_plus

def init_hpsp_add_on
@hp_plus = quota_hp
@sp_plus = quota_sp
end

def quota_hp
case @id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Weapon HP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 1 then return [false, 350]
when 5 then return [true, 1.2]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Weapon HP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
else
return [false, 0]
end
end

def quota_sp
case @id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Weapon SP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 25 then return [false, 500]
when 29 then return [true, 1.5]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Weapon SP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
else
return [false, 0]
end
end

end
#==============================================================================
# module RPG
# Armor
#==============================================================================
class RPG::Armor

attr_reader :hp_plus
attr_reader :sp_plus

def init_hpsp_add_on
@hp_plus = quota_hp
@sp_plus = quota_sp
end

def quota_hp
case @id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Armor HP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 1 then return [true, 1.1]
when 5 then return [true, 0.5]
when 13 then return [false, 90]
when 17 then return [false, -450]
when 9 then return [true, 1.3]
when 21 then return [true, 1.3]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Armor HP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
else
return [false, 0]
end
end

def quota_sp
case @id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Armor SP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 9 then return [true, 1.3]
when 21 then return [true, 1.3]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Armor SP plus Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
else
return [false, 0]
end
end

end
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title

alias main_hpsp_add_on_later main
def main
main_hpsp_add_on_later
for id in 1...$data_weapons.size
$data_weapons[id].init_hpsp_add_on
end
for id in 1...$data_armors.size
$data_armors[id].init_hpsp_add_on
end
end

end
#==============================================================================
# EQUAP Skills by Blizzard
# Version: 3.0b
# Date: 28.05.2006
# Date v2.0: 13.06.2006
# Date v2.02b: 16.1.2007
# Date v3.0b: 19.2.2007
#
#
# Explanation:
#
# This add-on will allow you to bound skills to equipment. Equip it and you
# learn the skill, unequip it and you will forget it. The AP system allows to
# gain AP for skills and learn the permanently if the max AP for the skill are
# gathered. (This system is a very similar one to FF9's AP Skill System.)
#
#
# v2.0:
# - Fixed bug, that appeared, when more equipment parts had the same skill
# - New multi-skill support
#
# v2.02b:
# - improved coding a little bit
#
# v3.0b:
# - Completely overworked and added optional AP system (similar to FF9)
# (I want to mention here I made this especially for blazinhandle =) )
#
#
# Compatibility:
#
# 99% chance of full compatibility with SDK, not tested altough. WILL cause
# incompatibility with custom equipment scripts but there are instructions how
# to configure the script. Please note, that this script depends on the layout
# of your Equip Screen and needs to be put UNDER a CMS script if you are using
# one. Also there needs to be something changed if you are using another script,
# that uses dummy elements. Add your dummy element IDs to the triple commented
# array (###). This add-on WILL corrupt your old savegames. Might not work with
# some CMS-es.
#
#
# Instructions:
#
# - Configuration:
# Press CRTL+SHIFT+F and type into the window one of the following:
#
# Start EQ Database
# Start MAXAP Database
# Start GAINAP Database
#
# You can jump now to the database directly. There are more instructions.
# Also change EQUAP_ELEMENT = XXX, where XXX is the ID number of the dummy
# element, that determines, which skill is bound to the equipment. Be sure to
# give that element every EQ skill or the system WILL glitch.
#
# - Merge with a Custom Equipment System:
# The lines, that need to be edited are double commented with ##. If you are no
# at least a bit of experienced scripter, it may be better to ask somebody else
# to perform the edit for you. Please note, that the person, who is going to
# edit this script needs the custom equipment script for reference.
#
#
# NOTE:
# DO NOT USE EQUAP SKILLS AS NORMAL SKILLS! THE SYSTEM WORKS WITH TEMPORARY
# LEARNING AND FORGETTING THE EQUAP SKILL. IF YOU LET YOUR CHARACTER LEARN AN
# EQUAP SKILL BY NORMAL MEANS, HE WILL FORGET IT AFTER HE UNEQUIPS THE
# APPROPRIATE EQUIPMENT!
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr/
# or send me an e-mail:
# boris_blizzard@yahoo.de
#==============================================================================
if TONS_OF_ADDONS::EQUAP_SKILLS
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start EQUAP General Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
EQUAP_ELEMENT = 17 # your EQ element ID
DUMMY_ELEMENTS = [EQUAP_ELEMENT] ### add more dummy elements if you have any
DISPLAY_AP_GAIN = true # uses a modified Battle Result to display gained AP
DISPLAY_AP_REQ = true # show CURRENT_AP/NEEDED_AP in the skill's name
GAIN_DEAD = false # dead actor also gain AP, no matter what
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End EQUAP General Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_System
#==============================================================================
class Game_System

def maxap(id)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of MAXAP Database
#
# Here you can define the APs needed to learn a skill. If you add no skills
# here the AP system is automatically disabled. Configure it like this template:
#
# when SKILL_ID then return MAXAP
#
# SKILL_ID - the ID of the skill that will be learned with AP
# MAXAP - how many AP are required to learn the skill
#
# Note:
# Don't forget to assign your AP skills to equipment in the EQ Database below.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
case id
when 1 then return 0
end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
return 0
end

def gainap(id)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of GAINAP Database
#
# Here you can define how many AP you will get from enemy troops. Configure it
# like this template:
#
# when TROOP_ID then return GAINAP
#
# TROOP_ID - the ID of the enemy troop
# GAINAP - how many AP will the player get from this troop.
#
# Note:
# This will automatically be disabled if there are no AP skills.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
case id
when 1 then return 2
end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
return 0
end

def eq_database(ids)
skill_ids = []
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of EQ Database
#
# This is your equipment database. To add one or more new EQUAP skills to a
# weapon is very simple. Add another "when"-branch in the script snipplet below
# (they have comments next to it). Configure it like this template:
#
# when "weapon ID"
# @skill_ids.push(EQUAP_SKILL_ID1)
# @skill_ids.push(EQUAP_SKILL_ID2)
#
# The same works for armors:
#
# when "armor_ID"
# @skill_ids.push(EQUAP_SKILL_ID1)
# @skill_ids.push(EQUAP_SKILL_ID2)
#
# Please note, that you need to configure this for every equipment part
# separately. That means you need to set it seperately for shields, armors,
# helmets and accessories. This also goes for custom equipment additions.
#
# The lines are commented below so you should have no problems with the script.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
case ids[0]
when 6 # weapon ID
skill_ids.push(10) # EQUAP skill ID
skill_ids.push(11) # EQUAP skill ID
when 10 # weapon ID
skill_ids.push(8) # EQUAP skill ID
skill_ids.push(12) # EQUAP skill ID
end
case ids[1]
when 1 # armor1 ID
skill_ids.push(1) # EQUAP skill ID
skill_ids.push(25) # EQUAP skill ID
when 19 # armor1 ID
skill_ids.push(25) # EQUAP skill ID
end
case ids[2]
when 5 # armor2 ID
skill_ids.push(15) # EQUAP skill ID
when 18 # armor2 ID
skill_ids.push(27) # EQUAP skill ID
end
case ids[3]
when 13 # armor3 ID
skill_ids.push(2) # EQUAP skill ID
skill_ids.push(25) # EQUAP skill ID
when 3 # armor3 ID
skill_ids.push(7) # EQUAP skill ID
skill_ids.push(4) # EQUAP skill ID
end
case ids[4] ## add more ids if you are using a custom number of equip parts
when 29 # armor4 ID
skill_ids.push(10) # EQUAP skill ID
when 8 # armor4 ID
skill_ids.push(32) # EQUAP skill ID
skill_ids.push(29) # EQUAP skill ID
end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of EQ Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
return skill_ids
end

end

#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler

def elements_correct(element_set)
elements = element_set.clone
return 100 if elements == []
multiplier = 0
size = 0
for i in elements
unless DUMMY_ELEMENTS.include?(i)
multiplier += self.element_rate(i)
size += 1
end
end
return 100 if size == 0
return multiplier/size
end

end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler

alias setup_equap_later setup
def setup(id)
setup_equap_later(id)
if $ap_enabled
@ap = {}
for id in 1...$data_skills.size
@ap[id] = 0 if $game_system.maxap(id) != 0
end
end
end

def add_ap(val)
return unless $ap_enabled
for key in @ap.keys
if @skills.include?(key)
max = $game_system.maxap(key)
@ap[key] = self.ap(key) + val
@ap[key] = max if @ap[key] > max
@ap[key] = 0 if @ap[key] < 0
end
end
end

def ap(id)
return (!$ap_enabled ? 0 : @ap[id] == nil ? 0 : @ap[id])
end

end
#==============================================================================
# Game_Troop
#==============================================================================
class Game_Troop

attr_reader :id

alias setup_equap_later setup
def setup(troop_id)
setup_equap_later(troop_id)
@id = troop_id if $ap_enabled
end

end
#==============================================================================
# Window_EquipRight
#==============================================================================
class Window_EquipRight

alias dispose_equap_later dispose
def dispose
ids = []
ids.push(@actor.weapon_id) ## this part here needs to be edited if a custom
ids.push(@actor.armor1_id) ## number of equipment parts is used. In that
ids.push(@actor.armor2_id) ## case it is enough to add more of these
ids.push(@actor.armor3_id) ## commands here. Also be sure to use the correct
ids.push(@actor.armor4_id) ## names for the IDs like ie. "armor3_id"
skill_ids = $game_system.eq_database(ids)
for id in 1...$data_skills.size
skill = $data_skills[id]
if skill.element_set.include?(EQUAP_ELEMENT)
if not $ap_enabled or @actor.ap(id) < $game_system.maxap(id)
@actor.forget_skill(id)
end
end
end
for id in skill_ids
@actor.learn_skill(id)
end
dispose_equap_later
end

end
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult

def refresh_extra(aps)
self.contents.fill_rect(0, 0, self.width, 32, Color.new(0, 0, 0, 0))
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size($data_system.words.gold).width
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(aps.to_s).width
self.contents.draw_text(x, 0, cx, 32, aps.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, "AP")
end
end
#==============================================================================
# Window_Skill
#==============================================================================
class Window_Skill

alias draw_item_equap_later draw_item
def draw_item(index)
skill = @data[index]
aps = $game_system.maxap(skill.id)
if DISPLAY_AP_REQ and aps != 0 and not $scene.is_a?(Scene_Battle)
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
text = "#{skill.name} (#{@actor.ap(skill.id)}/#{aps})"
self.contents.draw_text(x + 28, y, 204, 32, text, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
else
draw_item_equap_later(index)
end
end

end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias start_phase5_equap_later start_phase5
def start_phase5
start_phase5_equap_later
if $ap_enabled and DISPLAY_AP_GAIN
aps = $game_system.gainap($game_troop.id)
@result_window.refresh_extra(aps)
for actor in $game_party.actors
actor.add_ap(aps) if GAIN_DEAD or not actor.dead?
end
end
end

end
#==============================================================================
# AP enabled test
#==============================================================================
sys = Game_System.new
skills = load_data("Data/Skills.rxdata")
skills.delete(nil)
$ap_enabled = false
for skill in skills
if sys.maxap(skill.id) != 0
$ap_enabled = true
break
end
end
sys = nil
skills = nil
end
#==============================================================================
# Picture Movie Scene by Blizzard
# Version: 2.03b
# Date: 3.11.2006
#
#
# Compatibility:
#
# No incompatibility issues known.
#
# Complexity:
# - very low
#
# Special knowledge REQUIRED:
# - reading long and boring instructions
# - using the "Call script" event command
#
# Special knowledge RECOMMENED:
# - REALLY using the "Call script" event command
#
#
# Explanation:
#
# This script will allow you to create picture scenes for different purposes.
# You can create Credits, Intros or just picture (comic) movies.
#
#
# Instructions:
#
# Use following syntax to call this script:
#
# $scene = Scene_Pictures.new("STRING", DELAY, BLACKDELAY, EXIT, "FILE", RETURN)
#
# STRING - name of the pictures to be loaded
# DELAY - time of displaying pictures
# BLACKDELAY - time delay of displaying between the pictures
# EXIT - allow exiting (true by default) the scene by pressing ESC/ENTER
# FILE - the name of the music file to be played (none by default)
# RETURN - to which scene to return when done (Scene_Map is default)
#
# All your pictures must be named like STRING and put into a new folder called
# Scene inside the Pictures folder with the order number attached.
#
# Examples:
#
# 1)
# $scene = Scene_Pictures.new("animat", 5, 1, false)
#
# A scene will be created where the first picture is located in:
# Graphics/Pictures/Scene/animat1.png
# The next will be
# Graphics/Pictures/Scene/animat2.png
# It will display pictures as long as there are some.
# The scene can't be interrupted.
#
# 2)
# $scene = Scene_Pictures.new("i_n_t_r_o_" 5, 1, true, nil, Scene_Title.new)
#
# Graphics/Pictures/Scene/i_n_t_r_o_1.png will be the first.
# Graphics/Pictures/Scene/i_n_t_r_o_2.png will be the next after that.
# It can be interrupted and will start the title scene after finishing.
#
# 3)
# $scene = Scene_Pictures.new("credits", 5, 1)
#
# Graphics/Pictures/Scene/credits1.png will be the first.
# Graphics/Pictures/Scene/credits2.png will be the next after that.
#
#
# Side notes:
#
# If you want to use this scene an intro before the Title, you have to apply
# the syntax mentioned above in the Main script. Just change the
# $scene = Scene_Title.new
# to the desired syntax and don't forget to set its returning to Scene_Title.
# All your BGMs should be in the Audio/BGM folder
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
# or send me an e-mail:
# boris_blizzard@yahoo.de
#==============================================================================
class Scene_Pictures
def initialize(pics, del, hold, int = true, file = nil, scene = Scene_Map.new)
$game_system = Game_System.new if $game_system == nil
@names = pics
@delay = del
@hold = hold
@int = int
@file = file
@next_scene = scene
end
def main
$scene = @next_scene
@next_scene = nil
Graphics.transition
Graphics.freeze
delaying(true)
Audio.bgm_stop
if @file != nil
Audio.bgm_play("Audio/BGM/" + @file, 100, 100)
@file = nil
end
i = 1
loop do
break if there_are_no_more_files(@names + i.to_s)
@pic = RPG::Sprite.new
@pic.bitmap = RPG::Cache.picture("Scene/" + @names + i.to_s)
@pic.x = 320 - @pic.bitmap.width/2
@pic.y = 240 - @pic.bitmap.height/2
Graphics.transition(12)
break if delaying
Graphics.freeze
@pic.dispose
@pic = nil
Graphics.transition(12)
break if delaying(true)
Graphics.freeze
i += 1
end
unless @pic == nil or @pic.disposed?
@pic.dispose
Graphics.transition(12)
else
Graphics.transition(4)
end
delaying(true)
Audio.bgm_fade(800)
Graphics.freeze
end
def delaying(just_hold = false)
for i in 0...(just_hold ? @hold : @delay)*40
Graphics.update
if @int
Input.update
return true if Input.press?(Input::C) or Input.press?(Input::B)
end
end
return false
end

def there_are_no_more_files(name)
return (not FileTest.exist?("Graphics/Pictures/Scene/" + name + ".png") and
not FileTest.exist?("Graphics/Pictures/Scene/" + name + ".jpg"))
end

end
#==============================================================================
# Target 'em all! by Blizzard
# Version: 1.0b
# Date: 27.9.2006
#
#
# This add-ons will allow you to create skills that can target all enemies and
# all party members. Include all such skill IDs in the FULL_TARGET_IDS array
# and seaprate them with commas. Note that you should make the skill target all
# enemies/all party members/etc. to avoid the cursor being displayed.
#==============================================================================
FULL_TARGET_IDS = []
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias make_skill_action_result_target_all_later make_skill_action_result
def make_skill_action_result
if $game_system.TARGET_EM_ALL and
FULL_TARGET_IDS.include?(@active_battler.current_action.skill_id)
@target_battlers = []
for enemy in $game_troop.enemies
@target_battlers.push(enemy) if enemy.exist?
end
for actor in $game_party.actors
@target_battlers.push(actor) if not actor.dead?
end
end
make_skill_action_result_target_all_later
end
end
#==============================================================================
# Quick Passability Test by Blizzard
# Version: 1.0b
# Date: 7.2.2007
#
#
# Important:
#
# This add-ons ONLY works in Debug mode/Testplay mode and is mainly considered
# for debugging maps faster.
#
#
# Instructions:
#
# This will put a mask on your map that shows the passability. Trigger on/off
# the mask by pressing F6. You can define the color the passable part should
# have by changing the TILE_COLOR constant. Use this template:
#
# TILE_COLOR = Color.new(R, G, B, A)
#
# R - red
# G - green
# B - blue
# A - alpha (opacity)
#
# Every value needs to be set to a number between 0~255. Alpha over 128 is not
# recommened. This will only work with the map, events are not considered.
# This add-on will not work if the map's width * maps's height is bigger than
# 19200, because the sprite would take up too much RAM and your OS would block
# and freeze the game.
#==============================================================================
TILE_COLOR = Color.new(255, 64, 0, 96)
#==============================================================================
# Game_Map
#==============================================================================
QUICK_PASS = true
class Game_Map

attr_reader :passables

alias setup_minimap_later setup
def setup(map_id)
setup_minimap_later(map_id)
setup_passability_net(true)
end

def setup_passability_net(force_flag = false)
if @passables == nil or @passables == [] or force_flag
@passables = []
s1 = $game_system.minimap_w / $game_map.width
s2 = $game_system.minimap_h / $game_map.height
if ($DEBUG and $game_system.QUICK_PASSABILITY_TEST and
width * height <= 19200) or ($game_system.MINIMAP and s1 != 0 and
s2 != 0)
for i in 0...$game_map.height
Graphics.update if $game_map.width * $game_map.height >= 19200
for j in 0...$game_map.width
if $game_map.virtual_passable?(j, i, 2) or $game_map.virtual_passable?(j, i, 4) or
$game_map.virtual_passable?(j, i, 6) or $game_map.virtual_passable?(j, i, 8)
@passables.push([j, i])
end
end
end
end
end
end

def virtual_passable?(x, y, d)
return false unless valid?(x, y)
bit = (1 << (d / 2 - 1)) & 0x0f
for i in [2, 1, 0]
tile_id = data[x, y, i]
if tile_id == nil
return false
elsif @passages[tile_id] & bit != 0
return false
elsif @passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
return true
end

end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map

alias main_quick_passability_later main
def main
main_quick_passability_later
@passable.dispose if @passable != nil
end

alias upd_quick_passability_later update
def update
upd_quick_passability_later
if $DEBUG and $game_system.QUICK_PASSABILITY_TEST
if @passable != nil
if Input.trigger?(Input::F6)
@passable.dispose
@passable = nil
else
@passable.x = -$game_map.display_x/4
@passable.y = -$game_map.display_y/4
end
elsif Input.trigger?(Input::F6)
@passable = create_passable_help
unless @passable == nil
@passable.x = -$game_map.display_x/4
@passable.y = -$game_map.display_y/4
end
end
end
end

def create_passable_help
coos = $game_map.passables
if coos != [] and $game_map.width * $game_map.height <= 19200
passable = RPG::Sprite.new
passable.bitmap = Bitmap.new($game_map.width*32, $game_map.height*32)
for i in 0...coos.size
passable.bitmap.fill_rect(coos[i][0]*32, coos[i][1]*32, 32, 32, TILE_COLOR)
end
passable.z = 10000
return passable
end
end

end
#==============================================================================
# Dynamic Passability Minimap by Blizzard
# Version: 1.01b
# Date: 7.2.2007
#
#
# Compatibility:
#
# This add-on NEEDS "Quick Passability Test" by Blizzard. This add-on WILL
# corrupt your old savegames. Might not work with special map add-ons. Does NOT
# work with pixel-movement without changing the code slightly.
#
#
# Why this minimap script better is than any other (aka features):
#
# - simple display to avoid lag
# - custom size, position and opacity, changeable even during the game
# - no bitmaps, no pictures to import, only plain script
#
#
# Explanation:
#
# This add-on will draw a real-time minimap on the specified X and Y
# coordinate on your screen. It will show the player, events that do NOT have a
# comment in their code that says "no_minimap", that are not parallel process
# and that are not auto-start and that are not erased yet. Events with a
# teleport/transfer player command will be shown in a different color. Any
# event with and comment with "evil" in their code will be also displayed
# differently.
#
#
# Instructions:
#
# You can trigger the minimap visible/invisible with F5 during the game. Set up
# the starting configuration below. The colors follow a template of:
#
# WHAT_COLOR = Color.new(R, G, B)
#
# R - red
# G - green
# B - blue
#
# Change the colors of the dots on the map as you prefer it.
#
# PLAYER_COLOR - the player on the minimap
# EVENT_COLOR - any event on the minimap that is not erased, is not auto-start,
# is not parallel process and does not have a comment in its code
# with the word "no_minimap"
# TELEPORT_COLOR - any event like the one above, but that has a teleport/
# transfer_player command
# EVIL_COLOR - any event with a comment with the word "evil"
# MINIMAP_X - default X of the minimap on the screen
# MINIMAP_Y - default Y of the minimap on the screen
# MINIMAP_WIDTH - default maximal allowed width of the minimap
# MINIMAP_HEIGHT - default maximal allowed height of the minimap
# MINIMAP_OPACITY - default opacity of the minimap on the screen
#
# You have the possibility to change the minimap's size, coordinates and
# opacity during the game process. The command you need to type in into a
# "Call Script" command window are:
#
# $game_system.mini_coos(X, Y)
# $game_system.mini_size(W, H)
# $game_system.mini_opaq(A)
#
# X - new X
# Y - new Y
# W - new width
# H - new height
# A - new opacity
#
# Any changes will be applied instantly. Note that you don't need to use ALL
# commands.
#
#
# Note:
#
# Changing X, Y and opacity during the game will result in just moving the
# sprite. The minimap will not work if the maximal allowed size is smaller than
# the map size. (i.e. if your minimap is 160x120, maps like 170x130, 180x15 or
# 20x140 will not work.)
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PLAYER_COLOR = Color.new(0, 255, 0)
EVENT_COLOR = Color.new(0, 128, 255)
TELEPORT_COLOR = Color.new(255, 255, 0)
EVIL_COLOR = Color.new(255, 0, 0)
MINIMAP_X = 0
MINIMAP_Y = 0
MINIMAP_WIDTH = 160
MINIMAP_HEIGHT = 160
MINIMAP_OPACITY = 160
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if QUICK_PASS != true
p "Attention! Minimap is missing a vital add-on! Application will now close!"
exit
end
#==============================================================================
# Game_System
#==============================================================================
class Game_System

attr_reader :minimap_x
attr_reader :minimap_y
attr_reader :minimap_w
attr_reader :minimap_h
attr_reader :minimap_a
attr_accessor :minimap_visible

alias init_minimap_later initialize
def initialize
init_minimap_later
@minimap_visible = false
@minimap_x = [[MINIMAP_X, 0].max, 640].min
@minimap_y = [[MINIMAP_Y, 0].max, 480].min
@minimap_w = [[MINIMAP_WIDTH, 0].max, 640].min
@minimap_h = [[MINIMAP_HEIGHT, 0].max, 480].min
@minimap_a = [[MINIMAP_OPACITY, 0].max, 255].min
end

def mini_coos(x, y)
@minimap_x = [[x, 0].max, 640].min
@minimap_y = [[y, 0].max, 480].min
end

def mini_size(w, h)
@minimap_w = [[w, 0].max, 640].min
@minimap_h = [[h, 0].max, 480].min
$game_map.setup_passability_net
end

def mini_opaq(a)
@minimap_a = [[a, 0].max, 255].min
end

end
#==============================================================================
# Game_Event
#==============================================================================
class Game_Event < Game_Character

attr_reader :erased

def conditions
for page in @event.pages.reverse
c = page.condition
next if c.switch1_valid and not $game_switches[c.switch1_id]
next if c.switch2_valid and not $game_switches[c.switch2_id]
if c.variable_valid
next if $game_variables[c.variable_id] < c.variable_value
end
if c.self_switch_valid
key = [@map_id, @event.id, c.self_switch_ch]
next if $game_self_switches[key] != true
end
return true
end
return false
end

end

#==============================================================================
# Mini_Map
#==============================================================================
class Mini_Map < RPG::Sprite

def initialize(viewport = nil)
super
self.z = 10100
create_minimap
end

def create_minimap
coos = $game_map.passables
@w = $game_system.minimap_w
@h = $game_system.minimap_h
s = [@w / $game_map.width, @h / $game_map.height]
if s[0] > s[1]
@size = s[1]
else
@size = s[0]
end
if @size == 0
self.dispose
return
end
self.bitmap = Bitmap.new(@size*$game_map.width, @size*$game_map.height)
self.bitmap.fill_rect(0, 0, @w, @h, Color.new(0, 0, 0))
color = Color.new(128, 128, 128, 255)
for coo in coos
self.bitmap.fill_rect(coo[0]*@size, coo[1]*@size, @size, @size, color)
end
@events = get_events
create_sevents
update
end

def update
super
ev = get_events
if ev != @events
@events = ev
destroy_sevents
create_sevents
end
self.x = $game_system.minimap_x
self.y = $game_system.minimap_y
self.opacity = $game_system.minimap_a
for i in 0...@sevents.size
@sevents[i].x = @events[i].x * @size + self.x
@sevents[i].y = @events[i].y * @size + self.y
@sevents[i].opacity = $game_system.minimap_a
end
if @w != $game_system.minimap_w or @h != $game_system.minimap_h
self.bitmap.dispose
destroy_sevents
create_minimap
end
end

def create_sevents
@sevents = []
for i in 0...@events.size
sprite = RPG::Sprite.new
sprite.bitmap = Bitmap.new(@size, @size)
if @events[i].is_a?(Game_Player)
c = PLAYER_COLOR
elsif event_comment(@events[i], "evil")
c = EVIL_COLOR
elsif @events[i].list != nil
c = EVENT_COLOR
for j in @events[i].list
if j.code == 201
c = TELEPORT_COLOR
break
end
end
else
c = EVENT_COLOR
end
sprite.bitmap.fill_rect(0, 0, @size, @size, c)
sprite.z = 10200
@sevents.push(sprite)
end
end

def destroy_sevents
@sevents.each {|i| i.dispose}
@sevents = nil
end

def get_events
events = [$game_player]
for event in $game_map.events.values
if not event.erased and not [3, 4].include?(event.trigger) and
not event_comment(event, "no_minimap") and event.conditions
events.push(event)
end
end
return events
end

def event_comment(event, comment)
return false unless event.list.is_a?(Array)
for command in event.list
return true if command.code == 108 and command.parameters[0] == comment
end
return false
end

def dispose
destroy_sevents if @sevents != nil
super
end

end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map

alias main_minimap_later main
def main
@minimap = Mini_Map.new if $game_system.minimap_visible
main_minimap_later
@minimap.dispose if @minimap != nil
end

alias upd_minimap_later update
def update
upd_minimap_later
if $game_system.MINIMAP
if @minimap != nil
if Input.trigger?(Input::F5)
@minimap.dispose
@minimap = nil
$game_system.minimap_visible = false
else
@minimap.update
end
elsif Input.trigger?(Input::F5)
@minimap = Mini_Map.new
if @minimap.disposed?
$game_system.minimap_visible = false
@minimap = nil
else
$game_system.minimap_visible = true
end
end
end
end

alias transfer_player_minimap_later transfer_player
def transfer_player
if $game_system.minimap_visible
@minimap.dispose
@minimap = nil
end
transfer_player_minimap_later
@minimap = Mini_Map.new if $game_system.minimap_visible
if @minimap != nil and @minimap.disposed?
@minimap = nil
$game_system.minimap_visible = false
end
end

end
#==============================================================================
# Enemy status in battle by Blizzard
# Version: 1.0b
# Date: 17.2.2007
#
# Compatibility:
# Might cause incompatibility issues with exotic CBS-es, CMS-es and custom
# enemy status displays.
#
# This add-on will not only show enemies' names, but even HP, SP and status in
# the help window during battle.
#==============================================================================
#==============================================================================
# Window_Help
#==============================================================================
class Window_Help < Window_Base

alias set_enemy_status_later set_enemy
def set_enemy(enemy)
if $game_system.ENEMY_STATUS
set_actor(enemy)
else
set_enemy_status_later(enemy)
end
end

end
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# #
# ##### ##### ### ##### # # ##### ##### ##### ##### ##### ### ##### #
# # # # # # # # # # # # # # # # #
# ##### # # # # # # ##### #### #### #### #### # # #
# # # ##### # # # # # # # # # # # #
# ##### # # # # ### ##### ##### # # ##### ### # #
# #
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
#==============================================================================
# Zombie Status Effect by Blizzard
# Version: 1.01
# Date: 26.9.2006
#
# The only thing you can't make in the database is that you can't make actors
# weak against light and you can't make them get damage instead of healing.
# Somewhere in your Game_Battler 3 script in "def skill_effect" should be these
# lines:
#
# last_hp = self.hp
# self.hp -= self.damage
# effective |= self.hp != last_hp
# effective |= states_plus(skill.plus_state_set)
# effective |= states_minus(skill.minus_state_set)
#
# Under the line "last_hp = self.hp" add these lines:
#
# if self.damage .is_a?(Numeric) and self.damage < 0 and
# self.states.include?(ZOMBIE_STATUS_ID)
# self.damage = -self.damage
# end
# if skill.element_set.include?(LIGHT_ELEMENT_ID) and
# self.states.include?(ZOMBIE_STATUS_ID)
# self.damage = (self.damage * 1.5).to_i
# end
#
# Replace ZOMBIE_STATUS_ID and LIGHT_ELEMENT_ID with the appropriate IDs from
# your database. Light will now do 1.5 times more damage and healing will be
# executed as damage.
#==============================================================================
#==============================================================================
# Regen Status Effect by Blizzard
# Version: 1.1b
# Date: 4.5.2006
# Date v1.1b: 12.1.2007
#
# new in 1.1b:
# - fixed glitches, improved code and made it possible to have Regen and Poison
# at the same time (they nullificate each other on the map, but not in battle)
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REGEN_ID = 18 # set this to the status effect ID that will be Regen
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party

alias check_map_slip_damage_regen_later check_map_slip_damage
def check_map_slip_damage
check_map_slip_damage_regen_later
if $game_system.REGEN_STATUS
for actor in @actors
if actor.hp > 0 and actor.states.include?(REGEN_ID)
actor.hp += [actor.maxhp / 100, 1].max
end
end
end
end

end
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler
alias slip_damage_regen_later? slip_damage?
def slip_damage?
if $game_system.REGEN_STATUS
return true if @states.include?(REGEN_ID) and not $scene.is_a?(Scene_Map)
end
return slip_damage_regen_later?
end

alias slip_damage_effect_regen_later slip_damage_effect
def slip_damage_effect
unless $game_system.REGEN_STATUS
slip_damage_effect_regen_later
return
end
if not @states.include?(REGEN_ID) and slip_damage?
slip_damage_effect_regen_later
end
if @states.include?(REGEN_ID)
dam = -self.maxhp / 10
if dam.abs > 0
amp = [dam.abs * 15 / 100, 1].max
dam -= rand(amp+1) + rand(amp+1) - amp
end
self.hp -= dam
self.damage = 0 if self.damage == nil
self.damage += dam
end
return true
end
end
#==============================================================================
# Auto-Revive by Blizzard
# Version: 1.21b
# Date: 5.6.2006
# Date v1.2b: 14.11.2006
# Date v1.21b: 12.1.2007
#
# new in 1.2b
# - less and better code, much more compatible, easier to use
#
# new in 1.21b
# - removed an obsolete constant
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AUTO_REVIVE_ID = 19 # ID of the status effect
REVIVE_ANIMATION_ID = 25 # ID of the Revive animation
REVIVE_TEXT = "Auto-Revive!" # Text displayed
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
alias all_dead_autorevive_later? all_dead?
def all_dead?
return all_dead_autorevive_later? unless $game_system.AUTO_REVIVE
for actor in @actors
return false if actor.states.include?(AUTO_REVIVE_ID)
end
return all_dead_autorevive_later?
end
end
#==============================================================================
# Sprite
#==============================================================================
class RPG::Sprite

alias damage_regen_later damage
def damage(damage, critical)
if damage != REVIVE_TEXT
damage_regen_later(damage, critical)
return
end
dispose_damage
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, REVIVE_TEXT, 1)
bitmap.draw_text(-1, 12+1, 160, 36, REVIVE_TEXT, 1)
bitmap.draw_text(1, 12-1, 160, 36, REVIVE_TEXT, 1)
bitmap.draw_text(1, 12+1, 160, 36, REVIVE_TEXT, 1)
bitmap.font.color.set(0, 192, 255)
bitmap.font.size = 32
bitmap.draw_text(0, 12, 160, 36, REVIVE_TEXT, 1)
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias judge_autorevive_later judge
def judge
return judge_autorevive_later unless $game_system.AUTO_REVIVE
for actor in $game_party.actors
if actor.states.include?(AUTO_REVIVE_ID) and actor.hp == 0
actor.hp += actor.maxhp / 5
actor.remove_state(AUTO_REVIVE_ID)
actor.remove_state(1)
actor.animation_id = REVIVE_ANIMATION_ID
actor.damage = REVIVE_TEXT
actor.damage_pop = true
@status_window.refresh
end
end
return judge_autorevive_later
end
end
#==============================================================================
# Fury Status by Blizzard
# Version: 1.0b
# Date: 10.10.2006
#
#
# Compatibility:
#
# Could cause problems with exotic CBS-es.
#
#
# Instructions:
#
# - Explanation:
# This add-on will make specific characters get inflicted with the status
# effect called "Fury" if another specific character gets killed during battle.
# Also make the status effect end after the battle is over.
#
# - Configuration:
# Configure your database further below like this template:
#
# when X then return Y
#
# X is the ID of the dead character and Y the ID of the character who will
# inflicted with Fury. Set FURY_ID to the status effect ID.
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr/
# or send me an e-mail:
# boris_blizzard@yahoo.de
#
#==============================================================================
FURY_ID = 23
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias upd_fury_later update
def update
if $game_system.FURY_STATUS
ids = []
for actor in $game_party.actors
ids.push(database(actor.id)) if actor.dead?
end
for actor in $game_party.actors
actor.remove_state(FURY_ID)
end
for id in ids
if $game_actors[id] != nil and $game_party.actors.include?($game_actors[id])
$game_actors[id].add_state(FURY_ID) unless $game_actors[id].dead?
end
end
end
upd_fury_later
end

def database(id)
case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Fury Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 1 then return 2
when 2 then return 7
when 7 then return 8
when 8 then return 1
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Fury Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
else
return 0
end
end

end

#==============================================================================
# Invincible Status by Blizzard
# Version: 1.0b
# Date: 4.12.2006
#
#
# Compatibility:
#
# Could cause problems with exotic CBS-es.
#
#
# Instructions:
#
# - Explanation:
# This add-on will allow having a status effect that makes a character
# invincible. Set INVINCIBLE_ID to the status effect ID.
#==============================================================================
INVINCIBLE_ID = 17
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler
alias hp_actor_invincible_later hp=
def hp=(val)
if $game_system.INVINCIBLE_STATUS
return if @states.include?(INVINCIBLE_ID) and val < @hp
end
hp_actor_invincible_later(val)
end

def damage=(val)
@damage = val
if $game_system.INVINCIBLE_STATUS and val.is_a?(Numeric)
@damage = 0 if @states.include?(INVINCIBLE_ID) and val > 0
end
end
end
#==============================================================================
# Half SP by Blizzard
# Version: 1.3
# Date: 8.4.2006
# Date v1.3: 13.12.2006
#
# new in v1.3b:
# - totally overworked and improved code
#
#
# Compatibility:
#
# Should be 100% compatible with anything. Can cause incompatibility issues
# with exotic CBS-es and exotic CMS-es, but only if different Skills Windows
# are used. There is a high chance that this problem can be solved by renaming
# the defined class "Window_Skill" just below into the name of the class your
# CBS/CMS is using. The exact line is triple commented with ###.
#
#
# Instructions:
#
# - Explanation:
# This add-on will allow having a status effect that halves SP consumption
# during usage of skills. Set HALF_SP_ID to the status effect ID.
#==============================================================================
HALF_SP_ID = 18
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler

alias sp_actor_halfsp_later sp=
def sp=(val)
if val < self.sp and $game_system.HALF_SP
cost = self.sp - val
val += (cost / 2.0).ceil if @states.include?(HALF_SP_ID)
end
sp_actor_halfsp_later(val)
end

alias skill_can_use_halfsp_later? skill_can_use?
def skill_can_use?(skill_id)
if $game_system.HALF_SP and self.states.include?(HALF_SP_ID)
return false if ($data_skills[skill_id].sp_cost / 2.0).ceil > self.sp
end
return skill_can_use_halfsp_later?(skill_id)
end

end
#==============================================================================
# Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable ###

alias draw_item_halfsp_later draw_item
def draw_item(index)
draw_item_halfsp_later(index)
if $game_system.HALF_SP and @actor.states.include?(HALF_SP_ID)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
sp_cost = (skill.sp_cost / 2.0).ceil
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x + 232, y, 48, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(x + 232, y, 48, 32, "#{sp_cost}", 2)
end
end
end
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# #
# ##### # # # # # #
# # # # # # # #
# ##### ### # # # #
# # # # # # # #
# ##### # # # ##### ##### #
# #
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
#==============================================================================
# Absorbing SP and HP by Blizzard
# Version: 1.7b
# Date: 8.5.2006
# Date v1.7: 14.11.2006
#
# new in v1.7b:
# - overworked code, fixed bugs and glitches, added "undead SP"
#
# Just include all the skill IDs that are supposed to steal HP/SP. You can also
# define undead enemies who will (due to common belief...) revert the HP absorb
# effect. Also you may add any IDs of enemies who use the same undead effect,
# but on SP, add the IDs into UNDEAD_SP. Note that you can make enemies who
# only are "undead" for HP stealing, SP stealing or even both.
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SKILL_IDS_HP = [90] # add any Skill IDs and separate them with commas
SKILL_IDS_SP = [91] # add any Skill IDs and separate them with commas
UNDEAD_IDS = [1] # add IDS and separate them with commas
UNDEAD_SP = [32] # add IDS and separate them with commas
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler

alias skill_effect_hpsp_absorb_later skill_effect
def skill_effect(user, skill)
unless $game_system.ABSORB_HP_SP
return skill_effect_hpsp_absorb_later(user, skill)
end
@flag = false
last_hp = self.hp
save = skill_effect_hpsp_absorb_later(user, skill)
if SKILL_IDS_SP.include?(skill.id) and self.damage.is_a?(Numeric)
self.hp = last_hp
if self.is_a?(Game_Enemy) and UNDEAD_SP.include?(self.id)
self.damage = -self.damage
end
if self.sp >= self.damage
self.sp -= self.damage
else
self.damage = self.sp
self.sp = 0
end
elsif SKILL_IDS_HP.include?(skill.id) and self.damage.is_a?(Numeric)
self.hp = last_hp
if self.is_a?(Game_Enemy) and UNDEAD_IDS.include?(self.id)
self.damage = -self.damage
end
if self.hp >= self.damage
self.hp -= self.damage
else
self.damage = self.hp
self.hp = 0
end
end
return save
end

end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias update_phase4_step5_hpsp_absorb_later update_phase4_step5
def update_phase4_step5
unless $game_system.ABSORB_HP_SP
update_phase4_step5_hpsp_absorb_later
return
end
@help_window.visible = false
@status_window.refresh
damages = 0
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
damages += target.damage if target.damage.is_a?(Numeric)
end
end
@status_window.refresh if check_absorb(@active_battler,
@active_battler.current_action.skill_id, damages)
@skill = nil
@phase4_step = 6
end
def check_absorb(user, id, damage)
if SKILL_IDS_HP.include?(id)
user.hp += damage
user.damage = -damage
user.damage_pop = true
return true
elsif SKILL_IDS_SP.include?(id)
user.sp += damage
user.damage = -damage
user.damage_pop = true
return true
end
return false
end

end
#==============================================================================
# Full Reflection System by Blizzard
# Version: 1.4
# Date: 5.9.2006
# Date v1.4: 16.1.2007
#
#
# new in v1.4:
#
# - overworked code and fixed all the glitches
# - the power comes back X times stronger if it is reflected from X battlers
# (ie. like in the Final Fantasy series)
# - spells now get reflected to anybody from the enemy party, not only the user
# (makes it possible to split damage from the FF feature mentioned above)
# - added a fix so it works with HP/SP Absorb
#
#
# Compatiblity:
#
# Is compatible with nearly everything. You might experience problems with
# exotic CBS-es
#
#
# Configuration:
#
# Make a status effect and call it "Reflect". Remember the ID number. Now make
# an animation that should be displayed when reflecting magic.
#
# REFLECT_ID - the ID of the reflect status
# REFLECT_ANIMATION - the ID of animation displayed when magic is being
# reflecting
# BREAK_REFLECT - IDs of skills that go through Reflection no matter what
# MISS_DAMAGE - what is displayed in your game if somebody gets missed
# (usually "Miss")
#
#
# Note:
#
# A magical skill is considered a skill that has a either INT-F greater than
# zero or MDEF-F greater than zero.
#
#
# Important note:
#
# It is better if you don't use sounds and screen/target flashing in the
# animation for the reflecting effect.
#==============================================================================
REFLECT_ID = 21
REFLECT_ANIMATION = 103
BREAK_REFLECT = []
MISS_DAMAGE = "Miss"
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler

alias skill_effect_reflect_later skill_effect
def skill_effect(user, skill, reflect = false)
return skill_effect_reflect_later(user, skill) unless $game_system.REFLECT
if not test_reflection(skill) or reflect
return skill_effect_reflect_later(user, skill)
end
return false
end

def test_reflection(skill)
return (@states.include?(REFLECT_ID) and (skill.int_f > 0 or
skill.mdef_f > 0) and not BREAK_REFLECT.include?(skill.id))
end

end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias update_phase4_step4_reflect_later update_phase4_step4
def update_phase4_step4
unless $game_system.REFLECT
update_phase4_step4_reflect_later
return
end
for i in 0...@target_battlers.size
if @skill != nil and @active_battler.current_action.kind == 1 and
@target_battlers[i].test_reflection(@skill)
@target_battlers[i].animation_id = REFLECT_ANIMATION
@target_battlers[i] = swap_targets(@target_battlers[i], @active_battler)
target = @target_battlers[i]
dam = 0
dam = target.damage if target.damage.is_a?(Numeric)
target.skill_effect(@active_battler, @skill, true)
target.damage += dam if target.damage.is_a?(Numeric)
end
@target_battlers[i].animation_id = @animation2_id
@target_battlers[i].animation_hit = (@target_battlers[i].damage != MISS_DAMAGE)
end
@wait_count = 6
@phase4_step = 5
end

def swap_targets(battler1, battler2)
if battler1.is_a?(Game_Enemy) and battler2.is_a?(Game_Enemy)
actors = []
for actor in $game_party.actors
actors.push(actor) if actor.exist?
end
battler3 = actors[rand(actors.size)]
elsif battler1.is_a?(Game_Actor) and battler2.is_a?(Game_Actor)
enemies = []
for enemy in $game_troop.enemies
enemies.push(enemy) if enemy.exist?
end
battler3 = enemies[rand(enemies.size)]
elsif battler1.is_a?(Game_Enemy) and battler2.is_a?(Game_Actor)
actors = []
for actor in $game_party.actors
actors.push(actor) if actor.exist?
end
battler3 = actors[rand(actors.size)]
elsif battler1.is_a?(Game_Actor) and battler2.is_a?(Game_Enemy)
enemies = []
for enemy in $game_troop.enemies
enemies.push(enemy) if enemy.exist?
end
battler3 = enemies[rand(enemies.size)]
else
battler3 = battler2
end
if SKILL_IDS_HP != nil and SKILL_IDS_SP != nil and
SKILL_IDS_HP.include?(@skill) or SKILL_IDS_SP.include?(@skill)
loop do
break if battler2 != battler3
if battler2.is_a?(Game_Actor)
actors = []
for actor in $game_party.actors
actors.push(actor) if actor.exist?
end
battler3 = actors[rand(actors.size)]
elsif battler2.is_a?(Game_Enemy)
enemies = []
for enemy in $game_troop.enemies
enemies.push(enemy) if enemy.exist?
end
battler3 = enemies[rand(enemies.size)]
end
end
end
return battler3
end

end
#==============================================================================
# Death Roulette by Blizzard
# Version: 1.0
# Date: 7.8.2006
#
#
# This skill will kill a random target: hero or enemy. To make somebody immune
# to this skill, just set the immunity to the Death Status effect to F. Make
# the skill target nobody.
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DEATH_ROULETTE_IDS = [666] # add any Skill IDs and separate them with commas
DEAD_ID = 1 # the Status effect ID of the "dead" Status effect
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias make_skill_action_result_death_roulette_later make_skill_action_result
def make_skill_action_result
unless $game_system.DEATH_ROULETTE
make_skill_action_result_death_roulette_later
return
end
id = @active_battler.current_action.skill_id
if DEATH_ROULETTE_IDS.include?(id)
roulette = []
for enemy in $game_troop.enemies
roulette.push(enemy) if enemy.exist?
end
for actor in $game_party.actors
roulette.push(actor) if not actor.dead?
end
@target_battlers.push(roulette[rand(roulette.size)])
end
make_skill_action_result_death_roulette_later
if DEATH_ROULETTE_IDS.include?(id)
immune = @target_battlers[0].state_ranks[DEAD_ID]
if immune == 0 or immune == 6
@target_battlers[0].damage = "Can't kill"
else
@target_battlers[0].hp = 0
@target_battlers[0].damage = "Dead!"
end
end
end

end
#==============================================================================
# Blue Magic via skill by Blizzard
# Version: 1.0
# Date: 14.11.2006
#
#
# This actor will learn one of the enemy's skills. Making this skill target
# all enemies, ONLY ONE SKILL WILL BE LEARNED FROM A RANDOM ENEMY! Make the
# skill do no damage to the enemy and use the hit rate to determine the success
# chance of the skill.
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BLUE_MAGIC_IDS = [92] # add any Skill IDs and separate them with commas
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle

alias make_skill_action_result_blue_later make_skill_action_result
def make_skill_action_result
make_skill_action_result_blue_later
return unless $game_system.BLUE_MAGIC_SKILL
if BLUE_MAGIC_IDS.include?(@active_battler.current_action.skill_id)
@target_battlers.each {|target| target.damage = nil}
target = @target_battlers[rand(@target_battlers.size)]
if target.is_a?(Game_Enemy)
if rand(100) < $data_skills[@active_battler.current_action.skill_id].hit
ids = []
for action in target.actions
ids.push(action.skill_id) if action.kind == 1
end
if ids.size > 0
skill = $data_skills[ids[rand(ids.size)]]
if @active_battler.skills.include?(skill.id)
target.damage = skill.name + " known"
else
@active_battler.learn_skill(skill.id)
target.damage = skill.name + " learned"
end
else
target.damage = "None available"
end
else
target.damage = "Miss"
end
end
end
end

end
[/spoiler]

five:
[spoiler]#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy Party Switcher by Blizzard
# Version 2.43b
# Type: Party Changing System
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
# Date v1.5b: 3.11.2006
# Date v1.51b: 29.11.2006
# Date v1.52b: 6.12.2006
# Date v1.7b: 23.2.2007
# Date v1.8b: 30.4.2007
# Date v2.0b: 7.8.2007
# Date v2.1b: 24.8.2007
# Date v2.11b: 24.9.2007
# Date v2.3b: 26.1.2008
# Date v2.32b: 28.1.2008
# Date v2.4b: 29.1.2008
# Date v2.41b: 6.8.2008
# Date v2.42b: 14.10.2008
# Date v2.43b: 20.10.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Special Thanks to:
#
# Zeriab for pointing out a few glitches and shortening the code in an
# earlier version. =D
#
#
# IMPORTANT NOTE:
#
# Be sure to set the MAX_PARTY to the maximum size of your party. There is
# already a preconfiguration of 4.
#
#
# Compatibility:
#
# 98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
# incompatibility issued with other Party Change Systems. Can cause problems
# with CBS-es if you use the battle switch feature. WILL corrupt your old
# savegames.
#
#
# Features:
#
# - set party members for "not _available" (shown transparent in the reserve)
# - remove party members from the reserve list ("disabled_for_party")
# - set party members, who MUST be in the party (shown transparent in the
# current party, "must_be_in_party")
# - set up forced positions for party members
# - set up forced party size
# - option either to wipe the party (for multi-party use) or only remove
# every member (except 1) from the party.
# - easy to use and easy to switch party members
# - also supports small parties (2 or 3 members) and large parties (5 or
# more)
# - uses facesets optionally
#
# v1.5b:
# - better, shorter and more efficient code (less memory use, less CPU use)
# - fixed potential bugs
#
# v1.7b:
# - improved coding
# - facesets now optional
# - no extra bitmap files needed anymore
# - works now with Tons of Add-ons
#
# v1.8b:
# - added "forced position"
# - added "forced party size"
#
# v2.0b:
# - fixed the bug where you could empty the party... again...
# - fixed the bug that appeared when you pressed SHIFT
# - added option to allow an empty party
# - added "EXP for party members in reserve" option
# - made the forced_size for party work more convenient
# - improved coding
# - slightly decreased lag
#
# v2.1b:
# - fixed a bug
# - improved coding
# - rewritten conditions using classic syntax to avoid RGSS conditioning bug
# - now can serve as enhancement for CP Debug System
#
# v2.11b:
# - improved coding and performance
#
# v2.3b:
# - optional feature to call the Party Switcher during battle
#
# v2.32b:
# - fixed crash problem with SDK 2.x when using the BATTLE_SWITCH option
# - fixed SP display glitch when using BARS from Tons of Add-ons
#
# v2.4b:
# - now you can activate party order change only in the party switcher
# - add option for automatic party order change only in battle
#
# v2.41b:
# - fixed problem where you could put together a party where everybody is
# dead
#
# v2.42b:
# - added possibility to change the BATTLE_SWITCH setting during the game
#
# v2.43b:
# - fixed a problem with SDK 2.x
#
#
# How to use:
#
# To call this script, make a "Call script" command in an event.
#
# 1. Syntax: $scene = Scene_PartySwitcher.new
# No extra feature will be applied and you can switch the party as you
# wish.
#
# 2. Syntax: $scene = Scene_PartySwitcher.new(XXX)
# You can replace XXX for 1 to remove all party members except one (either
# one, who must be in the party or a random one), or replace XXX with 2,
# to cause a wipe party. Wiping a party will disable the of the current
# members and a NEW party of the remaining members must be formed. If you
# replace it with 3, the current party configuration will be stored for a
# later fast switch-back. If XXX is 10, all actors will be available for
# party switching no matter if the are "not_available" or
# "disabled_for_party". This feature if used by the CP Debug System. No
# faceset will be used in this case for a more convenient working.
#
# 3. Syntax: $scene = Scene_PartySwitcher.new(XXX, 1)
# You can use the XXX as described above or just set it to 0 to disable
# it. Also the "1" in the syntax will reset any disabled_for_party and is
# made to be used after multi-party use.
#
# 4. Syntax: $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
# You can replace ZZZ with 1 to replace the party with a stored one AND
# store the current or replace it with 2 to replace the party with a
# stored one, but without storing the current. USE THIS ONLY IF YOU ASSUME
# TO HAVE A STORED PARTY READY! You can simply test if there is a store
# party by putting this code into the conditional branch script:
#
# $game_system.stored_party != nil
#
# This syntax will not open the Party Switcher and it will override the
# commands XXX and YYY, so you can replace these with any number.
#
# 5. To activate/deactivate the option of order change only, simply use the
# event command "Call Script" with following syntax:
#
# $game_system.order_only = true/false
#
# If the setting is set to true, the switcher will allow only party order
# change. The same goes for battle change (if you are using the
# BATTLE_SWITCH option), but the syntax is different:
#
# $game_system.battle_order_only = true/false
#
# The BATTLE_SWITCH option can be changed during the game by using
# following syntax:
#
# $game_system.battle_switch = true/false
#
# This option is intially set to the same setting as BATTLE_SWITCH is.
#
# Character faces go into the "Characters" folder and they have the same name
# as the character spritesets have with _face added
#
# Example:
#
# sprite - Marlen.png
# face - Marlen_face.png
#
# Other syntaxes:
# $game_actors[ID].not_available = true/false
# $game_actors[ID].disabled_for_party = true/false
# $game_actors[ID].must_be_in_party = true/false
# $game_actors[ID].forced_position = nil/0/1/2/...
# OR
# $game_party.actors[POS].not_available = true/false
# $game_party.actors[POS].disabled_for_party = true/false
# $game_party.actors[POS].must_be_in_party = true/false
# $game_party.actors[POS].forced_position = nil/0/1/2/...
#
# ID - the actor's ID in the database
# POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
# not_available
# - will disable the possibility of an already unlocked character to be in
# the current party
#
# disabled_for_party
# - will cause the character NOT to appear in the party switch screen at all
#
# must_be_in_party
# - will cause the character to be automatically moved into the current party
# and he also cannot be put in the reserve
#
# forced_position
# - will enforce the player to be at a specific position in the party, set
# this value to nil to disable this feature, use it in combination with
# must_be_in_party and $game_party.forced_size or you might experience
# bugs,
#
# $game_party.forced_size = nil/0/1/2/...
#
# Using this syntax will enforce a specific party size. The EPS won't exit
# until this size is filled up or there are no more in the reserve. EPS will
# automatically "correct" this number if there are not enough characters in
# the reserve to fill up a party of forced_size. Set this value to nil to
# disable the size requirement. Note that the actor DO NOT HAVE TO be set in
# normal order without any empty position like in version 1.x.
#
#
# Additional note:
#
# For your own sake, do not apply the attribute "must_be_in_party" to a
# character at the same time with "not_available" or "disabled_for_party" as
# this WILL disrupt your party and party switch system. Use "forced_position"
# together with "must_be_in_party" to avoid bugs. Be careful when using
# "forced_position" with "$game_party.forced_size". Add actors at the very
# end to be sure the player can't put others after them if the "forced_size"
# is smaller than the maximum party size.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# how many party members do you use
MAX_PARTY = 4
# set to true to use facesets instead of spritesets
FACESETS = true
# allows a party with 0 members
ALLOW_EMPTY_PARTY = false
# allows switching the party in battle
BATTLE_SWITCH = false
# name of the call command in the party menu in battle
SWITCH_COMMAND = 'Switch'
# gives all other characters EXP (specify in %)
EXP_RESERVE = 50
# gives "not available" characters EXP (specify in %)
EXP_NOT_AVAILABLE = 0
# gives "disabled for party" characters EXP (specify in %)
EXP_DISABLED_FOR_PARTY = 0
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
# recognition variable for plug-ins
$easy_party_switcher = 2.43
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :must_be_in_party
attr_accessor :disabled_for_party
attr_accessor :not_available
attr_accessor :forced_position

alias setup_eps_later setup
def setup(actor_id)
setup_eps_later(actor_id)
@must_be_in_party = @disabled_for_party = @not_available = false
end

end
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :stored_party
attr_accessor :order_only
attr_accessor :battle_order_only
attr_accessor :battle_switch

alias init_eps_later initialize
def initialize
init_eps_later
@order_only = @battle_order_only = false
@battle_switch = BlizzCFG::BATTLE_SWITCH
end

end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
attr_accessor :actors
attr_accessor :forced_size

def any_forced_position
return (@actors.any? {|actor| actor != nil && actor.forced_position != nil})
end

end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
alias draw_actor_graphic_eps_later draw_actor_graphic
def draw_actor_graphic(actor, x, y)
if actor != nil && actor.character_name != ''
classes = [Window_Current, Window_Reserve, Window_HelpStatus]
if BlizzCFG::FACESETS && !$all_available && classes.include?(self.class)
draw_actor_face_eps(actor, x, y)
else
if classes.include?(self.class)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
x += bitmap.width / 8 + 24
y += bitmap.height / 4 + 16
end
draw_actor_graphic_eps_later(actor, x, y)
end
end
end
def draw_actor_face_eps(actor, x, y)
if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
hue = 0
else
hue = actor.character_hue
end
bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
if actor.not_available || actor.must_be_in_party
self.contents.blt(x, y, bitmap, src_rect, 128)
else
self.contents.blt(x, y, bitmap, src_rect)
end
end

end
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult

attr_reader :exp

end
#==============================================================================
# Window_Current
#==============================================================================
class Window_Current < Window_Selectable
def initialize
super(0, 0, 240 + 32, (BlizzCFG::MAX_PARTY > 4 ? 480 : BlizzCFG::MAX_PARTY * 120))
self.contents = Bitmap.new(width - 32, 448 + (BlizzCFG::MAX_PARTY-4) * 120)
@item_max = BlizzCFG::MAX_PARTY
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh
self.active, self.index, self.z = false, -1, 5000
end

def refresh
self.contents.clear
$game_party.actors.each_index {|i|
if $game_party.actors[i] != nil
draw_actor_graphic($game_party.actors[i], 4, i*120+4)
draw_actor_name($game_party.actors[i], 152, i*120-4)
draw_actor_level($game_party.actors[i], 88, i*120-4)
draw_actor_hp($game_party.actors[i], 88, i*120+24)
draw_actor_sp($game_party.actors[i], 88, i*120+52)
end}
end
def setactor(index_1, index_2)
$game_party.actors[index_2], $game_party.actors[index_1] =
$game_party.actors[index_1], $game_party.actors[index_2]
refresh
end
def getactor(index)
return $game_party.actors[index]
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120 - self.oy
self.cursor_rect.set(0, y, self.width - 32, 88)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120
src_rect = Rect.new(0, 0, self.width, 88)
bitmap = Bitmap.new(self.width-32, 88)
bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
self.contents.blt(0, y, bitmap, src_rect, 192)
end

def top_row
return self.oy / 116
end
def top_row=(row)
self.oy = (row % row_max) * 120
end
def page_row_max
return (self.height / 120)
end
end
#==============================================================================
# Window_Reserve
#==============================================================================
class Window_Reserve < Window_Selectable

attr_reader :actors

def initialize(scene)
super(0, 0, 368, 320)
setup
@column_max, rows = 3, @item_max / @column_max
self.contents = Bitmap.new(width - 32, (rows >= 3 ? rows * 96 : height - 32))
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.active, self.index, self.z = false, -1, 5000
refresh
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end

def setup
@actors = []
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i]) ||
$game_actors[i].disabled_for_party && !$all_available
@actors.push($game_actors[i])
end}
@item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
end

def refresh
self.contents.clear
@actors.each_index {|i| draw_actor_graphic(@actors[i], i%3*112+16, i/3*96+8)}
end

def getactor(index)
return @actors[index]
end

def get_number
return (@actors.find_all {|actor| actor != nil}).size if $all_available
return (@actors.find_all {|actor| actor != nil && !actor.not_available}).size
end

def setactor(index_1, index_2)
@actors[index_1], @actors[index_2] = @actors[index_2], @actors[index_1]
refresh
end
def setparty(index_1, index_2)
@actors[index_1], $game_party.actors[index_2] =
$game_party.actors[index_2], @actors[index_1]
refresh
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max-1) if row > top_row + (page_row_max-1)
x, y = (@index % @column_max)*112 + 8, (@index / @column_max)*96 - self.oy
self.cursor_rect.set(x, y, 96, 96)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
x, y = (@index % @column_max) * 112 + 8, (@index / @column_max) * 96
src_rect = Rect.new(0, 0, 96, 96)
bitmap = Bitmap.new(96, 96)
bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
self.contents.blt(x, y, bitmap, src_rect, 192)
end

def top_row
return self.oy / 96
end
def top_row=(row)
row = row % row_max
self.oy = row * 96
end
def page_row_max
return (self.height - 32) / 96
end
end
#==============================================================================
# Window_HelpStatus
#==============================================================================
class Window_HelpStatus < Window_Base
def initialize(gotactor, scene)
super(0, 0, 400 - 32, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh(gotactor)
self.active, self.z = false, 5000
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end

def refresh(actor)
self.contents.clear
if actor != nil
self.contents.font.color = normal_color
if actor.not_available && !$all_available
self.contents.draw_text(8, 0, 160, 32, 'not available', 0)
end
draw_actor_graphic(actor, 0, 40)
draw_actor_name(actor, 160, 32)
draw_actor_level(actor, 96, 32)
draw_actor_hp(actor, 96, 64)
draw_actor_sp(actor, 96, 96)
end
end
end
#==============================================================================
# Window_Warning
#==============================================================================
class Window_Warning < Window_Base
def initialize(mode, members)
super(0, 0, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.x, self.y, self.z = 320 - width/2, 240 - height/2, 9999
self.contents.font.color = normal_color
case mode
when 0
self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
num = [$game_party.forced_size, members + $game_party.actors.nitems].min
self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
when 1
self.contents.draw_text(0, 0, 288, 32, 'You cannot remove', 1)
self.contents.draw_text(0, 32, 288, 32, 'the last party member!', 1)
when 2
self.contents.draw_text(0, 0, 288, 32, 'At least one member', 1)
self.contents.draw_text(0, 32, 288, 32, 'has to be alive!', 1)
end
end
end
#==============================================================================
# Window_PartyCommand
#==============================================================================
class Window_PartyCommand

alias init_eps_later initialize
def initialize
if $game_system.battle_switch
if defined?(SDK) && self.is_a?(Window_HorizCommand)
s1 = SDK::Scene_Commands::Scene_Battle::Fight
s2 = SDK::Scene_Commands::Scene_Battle::Escape
s3 = BlizzCFG::SWITCH_COMMAND
super(640, [s1, s2, s3])
disable_item(1) unless $game_temp.battle_can_escape
else
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = ['Fight', 'Escape', BlizzCFG::SWITCH_COMMAND]
@item_max = @column_max = 3
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
draw_item(2, normal_color)
end
self.active, self.visible, self.index = false, false, 0
self.back_opacity = 160
else
init_eps_later
end
end

alias draw_item_eps_later draw_item
def draw_item(index, color)
if $game_system.battle_switch
self.contents.font.color = color
rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
else
draw_item_eps_later(index, color)
end
end

alias update_cursor_rect_eps_later update_cursor_rect
def update_cursor_rect
if $game_system.battle_switch
self.cursor_rect.set(80 + index * 160, 0, 128, 32)
else
update_cursor_rect_eps_later
end
end

def command(index = self.index)
return @commands[index]
end

end
#==============================================================================
# Scene_PartySwitcher
#==============================================================================
class Scene_PartySwitcher

def initialize(wipe_party = 0, reset = 0, store = 0)
@wipe_party, @store, @reset = store, reset, wipe_party
@current_window_temp = @reserve_window_temp = 0
@scene_flag, @temp_window = false, ''
@scene = $scene.class
end

def main
if @store != 0
swap_parties
$scene = Scene_Map.new
$game_player.refresh
return
end
case @wipe_party
when 1 then setup_forced_party
when 2 then wipe_party
when 3
$game_system.stored_party = $game_party.actors
wipe_party
when 10 then $all_available = true
end
if @reset == 1
(1...$data_actors.size).each {|i| $game_actors[i].not_available = false}
end
@current_window = Window_Current.new
@current_window.index, @current_window.active = 0, true
@reserve_window = Window_Reserve.new(@scene)
@reserve_window.x, @reserve_window.y = 272, 160
@help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)
@help_window.x = 240 + 32
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
[@current_window, @reserve_window, @help_window].each {|win| win.dispose}
$game_party.actors.compact!
$game_player.refresh
$all_available = nil
end

def update
check = @reserve_window.index
if @reserve_window.active
reserve_update
@reserve_window.update
end
if check != @reserve_window.index
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
end
current_update if @current_window.active
if Input.trigger?(Input::B)
if @scene_flag
$game_system.se_play($data_system.cancel_se)
@scene_flag, @temp_window = false, ''
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
[@current_window, @reserve_window].each {|win| win.refresh}
return
end
if $game_party.forced_size != nil &&
($game_party.forced_size < $game_party.actors.nitems ||
($game_party.forced_size > $game_party.actors.nitems &&
@reserve_window.get_number != 0))
$game_system.se_play($data_system.buzzer_se)
warning(1)
return
end
if $game_party.actors.all? {|actor| actor == nil ||
actor != nil && actor.dead?}
$game_system.se_play($data_system.buzzer_se)
warning(2)
return
end
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(3)
elsif Input.trigger?(Input::A)
if $game_party.any_forced_position
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
$game_party.actors.compact!
@current_window.refresh
end
end
end

def current_update
@current_window.update
if Input.trigger?(Input::C)
actor = @current_window.getactor(@current_window.index)
if actor != nil && actor.forced_position != nil
$game_system.se_play($data_system.buzzer_se)
else
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Current'
@temp_actor_index = @current_window.index
@current_window.clone_cursor
end
end
elsif Input.trigger?(Input::RIGHT)
if @scene == Scene_Map && $game_system.order_only ||
@scene == Scene_Battle && $game_system.battle_order_only
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.cursor_se)
@current_window.active = false
@reserve_window.active = true
@current_window_temp = @current_window.index
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.index = -1
@reserve_window.index = @reserve_window_temp
@help_window.refresh(actor) unless @scene_flag
end
end
end

def reserve_update
if Input.trigger?(Input::C)
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Reserve'
@temp_actor_index = @reserve_window.index
@reserve_window.clone_cursor
end
elsif @reserve_window.index % 3 == 0 && Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@reserve_window.active = false
@current_window.active = true
@reserve_window_temp = @reserve_window.index
@reserve_window.index = -1
@current_window.index = @current_window_temp
end
end

def switch_members
if @temp_window == 'Reserve' && @reserve_window.active
@reserve_window.setactor(@temp_actor_index, @reserve_window.index)
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
end
if @temp_window == 'Current' && @current_window.active
@current_window.setactor(@temp_actor_index, @current_window.index)
end
if @temp_window == 'Reserve' && @current_window.active
actor1 = @current_window.getactor(@current_window.index)
actor2 = @reserve_window.getactor(@temp_actor_index)
if call_warning?(@current_window.index, actor2)
if actor1 != nil && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@temp_actor_index, @current_window.index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window_temp)
@help_window.refresh(actor)
else
warning(0)
end
end
if @temp_window == 'Current' && @reserve_window.active
actor1 = @current_window.getactor(@temp_actor_index)
actor2 = @reserve_window.getactor(@reserve_window.index)
if call_warning?(@temp_actor_index, actor2)
if actor1 != nil && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@reserve_window.index, @temp_actor_index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
else
warning(0)
end
end
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = false, ''
end

def wipe_party
$game_party.actors.each {|actor| actor.not_available = true if actor != nil}
setup_forced_party(true)
if $game_party.actors == []
(1...$data_actors.size).each {|i|
unless $game_actors[i].not_available ||
$game_actors[i].disabled_for_party
$game_party.actors.push($game_actors[i])
return
end}
end
end

def setup_forced_party(flag = false)
$game_party.actors, party = [], []
(1...$data_actors.size).each {|i|
if $game_actors[i] != nil && $game_actors[i].must_be_in_party &&
(!$game_actors[i].disabled_for_party || flag) &&
!$game_actors[i].not_available
party.push($game_actors[i])
end}
party.clone.each {|actor|
if actor.forced_position != nil
$game_party.actors[actor.forced_position] = actor
party.delete(actor)
end}
$game_party.actors.each_index {|i|
$game_party.actors[i] = party.shift if $game_party.actors[i] == nil}
$game_party.actors += party.compact
end

def swap_parties
$game_party.actors.compact!
temp_actors = $game_party.actors
temp_actors.each {|actor| actor.not_available = true}
$game_system.stored_party.compact!
$game_system.stored_party.each {|actor| actor.not_available = false}
$game_party.actors = $game_system.stored_party
$game_system.stored_party = (@store == 1 ? temp_actors : nil)
end

def call_warning?(index, actor2)
return (BlizzCFG::ALLOW_EMPTY_PARTY || $game_party.actors[index] == nil ||
actor2 != nil || $game_party.actors.nitems > 1)
end

def warning(type)
$game_system.se_play($data_system.buzzer_se)
@warning_window = Window_Warning.new(type, @reserve_window.get_number)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se) if type > 0
[@current_window, @reserve_window].each {|win| win.refresh}
@warning_window.dispose
@warning_window = nil
break
end
end
end

end
#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle

alias update_phase2_eps_later update_phase2
def update_phase2
update_phase2_eps_later
if Input.trigger?(Input::C) && @party_command_window.index == 2
$game_system.se_play($data_system.decision_se)
@spriteset.dispose
$scene = Scene_PartySwitcher.new
$scene.main
$scene = self
@spriteset = Spriteset_Battle.new
15.times {@spriteset.update}
@status_window.refresh
Graphics.transition(0)
end
end

alias start_phase5_eps_later start_phase5
def start_phase5
start_phase5_eps_later
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i])
if $game_actors[i].not_available
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_NOT_AVAILABLE/100
elsif $game_actors[i].disabled_for_party
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_DISABLED_FOR_PARTY/100
else
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100
end
end}
end

end
[/spoiler] Edited by zahraa

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...