I've never seen or even heard of "allocator" undefined, so I have no idea what this is. anyway, I added MA's Advanced Text script to my project the other day, and it seems to be having a problem with my "skills can crit" script. I'll link the two now. The error only occurs when a skill hits for critical damage, so I'm pretty sure the issue is within the critical skill script.
The text one is insanely large and likely won't all fit, so I'll just link the area that is having a problem, and if it's all needed, I'll attach it in a response as a .text document.
[spoiler] def draw_line(index)
return if !@text.nil?
rect = Rect.new(0, 0, 0, 0)
rect.x += 4
rect.y += index * @wlh
rect.width = contents.width - 8
rect.height = @wlh
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
@wlh = $game_message.battle_wlh
@text = @lines[index].dup
convert_special_characters
@contents_x = rect.x
@contents_y = rect.y
loop do
c = @text.slice!(/./m) # Get next text character
# Stop when text finished
break if c.nil?
draw_message_character (c)
end
@text = nil
end
end
#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - create_game_objects
#==============================================================================
class Scene_Title
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create Game Objects
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_ats3_gm_obj_create create_game_objects
def create_game_objects (*args)
# Create the object which holds default values for message
$game_ats = $ats_default = Game_ATS.new
# Run original method
modalg_ats3_gm_obj_create (*args)
end
end
#==============================================================================
# ** Scene_File
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - write_save_data; read_save_data
#==============================================================================
class Scene_File
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Write Save Data
# file : the file being written to
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_ats3_write_save write_save_data
def write_save_data (file, *args)
# Run Original Method
modalg_ats3_write_save (file, *args)
Marshal.dump($game_ats, file)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Read Save Data
# file : the file being read from
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_ats3_read_save_data read_save_data
def read_save_data (file, *args)
# Run Original Method
modalg_ats3_read_save_data (file, *args)
begin
$game_ats = $ats_default = Marshal.load (file)
rescue # Initialize if old save
$game_ats = $ats_default = Game_ATS.new
$game_message.clear
end
end
end
[/spoiler]
And here's the critical one
[spoiler]#<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
#- Mithran's Critical Skills v 1.4
#- Last update April 16, 2009
#-
#- This script will allow skills to inflict critical damage
#-
#- Usage: Insert the following tags in the note section of skills to modify
#- Critical rate and ability to critical. By default, all skills will
#- with the box "Physical Attack" checked be able to critical.
#-
#- <CANCRIT> Specify to allow this skill to be able to crit
#- <CANNOTCRIT> Specify to disallow this skill to be able to crit
#- These options superceed all of the following. If neither is specified, the
#- default in the cusomization section is used.
#-
#- <Setcrit #> Sets a number chance for the specified skill to crit
#- If the number is not specificed, the chance for this skill to crit will be
#- zero. Examples:
#- <setcrit 50> - 50% chance for the skill to crit
#- <setcrit> - 0% chance for the skill to crit
#-
#- <Pluscrit #> or <Minuscrit #>
#- Sets a number chance to be added to the battler's normal crit
#- chance before determining the skill's chance to crit.
#- Examples:
#- (Actor crit value default is 4)
#- <pluscrit 4> - 8% chance for the skill to crit
#- <minuscrit 2> - 2% chance for the skill to crit
#-
#- <Autocrit> - This skill, if able to crit, will have 100% chance to deal
#- a critical hit. Autocrit will ignore prevent critical option on armors.
#- If you want a skill to automatically critical but not ignore critical
#- protection, simply <setcrit 100>
#-
#- <display critical type #>
#- Sets the vocab to be displayed when the attack is critical
#- 0 - Use Ambiguous
#- 1 - Use Physical
#- 2 - Use Magical
#- 5 - Custom 1
#- 6 - Custom 2
#- 7 - Custom 3
#- Defaults are automatically determined by my phsical/magical ambiguity
#- script, if installed
#- If an invalid index is set, defaults to the text used by Physical attacks
#-
#- <show zero dmg crit>
#- <hide zero dmg crit>
#- Sets whether to allow the critical to register if the attack deals zero
#- damage (combined of mp and hp damage). If you hide a critical, it will
#- not register for other scripts, such as Advacned State Probability
#- This option overrides the default set in the module.
#-
#- KGC Rate Damage support - Skills tagged to use rate damage will never
#- critical, no matter what other settings are set here.
#-
#- Skill Functions support - Skills tagged as exact damage damage will never
#- critical, no matter what other settings are set here.
#-
#- Install: Insert above Main. If you use my Skill Functions script
#- place it below that.
#<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
#==============================================================================#
# * Customization * #
#==============================================================================#
$imported = {} if $imported == nil
$imported["MithranCriticalSkills"] = true
module Vocab
CritToEnemyBase = "Critical Strike!!"
# If a physical attack critical
CritToActorBase = "A painful blow!!"
# If a physical attack critical
CritToEnemyAmbig = "An excellent hit!!"
# If an ambiguous critical (most skills are ambigous, so recommend leaving this)
CritToActorAmbig = "A painful blow!!"
# If If an ambiguous critical (most skills are ambigous, so recommend leaving this)
CritToEnemyMagic = "Critical Hit!!"
# If magical critical
CritToActorMagic =
# If magical critical
# Custom critical text spots
# three are available. Use the <display critical type n> tag to choose one
CritToEnemyCustom1 = "Booom!!"
# n = 5
CritToActorCustom1 = "Booom!!"
# n = 5
CritToEnemyCustom2 = "Whaaam!!"
# n = 6
CritToActorCustom2 = "Whaaam!!"
# n = 6
CritToEnemyCustom3 = "Smaaash!!"
# n = 7
CritToActorCustom3 = "Smaaash!!"
# n = 7
CritToEnemyZero =
# If zero damage is dealt and critical is still on (superceeds other options)
CritToActorZero =
# If zero damage is dealt and critical is still on (superceeds other options)
CritToEnemyHeal = "an exceptional heal!"
# If a heal is critical (superceeds other options)
CritToActorHeal = "An exceptional heal!"
# If a heal is critical (superceeds other options)
end
module Mithran
module CriticalSkills
SKILLS_CAN_CRIT = true
# If true, skill can crit by default.
# If false, only skills specified with the <CANCRIT> tag will be able to
# deal critical damage
NONPHYSICAL_CAN_CRIT = true
# If false, disallows skills that do not have the box "Physical Attack"
# checked in the database to deal critical damage by default.
# If true, these skills are allowed to crit.
# This setting is overridden by adding the <CANCRIT> tag.
MAGIC_CAN_CRIT = true
# Uses phyiscal/magical ambiguity fix if installed.
# When false, disallows skills defined as magic to deal critical damage
# by default. (By default, these are skills with spi_f > 0)
# If true, these skills are allowed to crit.
# This setting is overridden by adding the <CANCRIT> tag.
ALLOW_ZERO_DMG_CRIT = false
# If this value is false, critical will be turned off automatically when
# an attack scores zero total damage.
# This is mainly for display, but also if you use another script that increases
# other parameters due on a critical (such as Advanced State Probability)
# Recommend leaving this on false and turning the option on indiviudally for
# heavy state inflicting attacks, if you use probability
ALLOW_HEALS = true
# If this option is false, heals will never crit. This overrides even the CANCRIT tag.
# If it is true, heals (base damage in the database must be 0 or lower)
# will be able to critical
# 'Absorbed attacks' due to element reversal, however, will never critical
#==============================================================================#
# * End Customization * #
#==============================================================================#
# AutoCrit String Tag
AUTOCRIT = /<(?:AUTOCRIT|auto_critical)>/i
# Chance of this specific to critical - String Tag
SKILL_CRIT_CHANCE = /<(?:SETCRIT|skill_crit_chance)(\s+\d+)?>/i
# Added chance of this skill to critical - String Tag
PLUS_CRIT_CHANCE = /<(?:PLUSCRIT|add_crit_chance)(\s+\d+)?>/i
MINUS_CRIT_CHANCE = /<(?:MINUSCRIT|subtract_crit_chance)(\s+\d+)?>/i
CAN_CRIT = /<(?:CANCRIT|allow_critical)>/i
CANNOT_CRIT = /<(?:CANNOTCRIT|disallow_critical)>/i
DISPLAY_CRIT = /<display[\s_]?(?:critical|cri|crit)[\s_]?type[\s_]?(\d+)>/i
SHOW_ZERO_DMG = /<(hide|show)[\s_]?(?:zero|0)[\s_]?(?:dmg|damage)[\s_]?(?:critical|cri|crit)>/i
end
end
class StrProc < Proc
unless $@
alias to_ss to_s
def to_s
return self.call
end
end
def +(str)
return self.call + str
end
def -(str)
return self.call + str
end
end
module Vocab
CriticalToEnemy = StrProc.new {
case $crilasthit
when 0
CritToEnemyAmbig
when 1
CritToEnemyBase
when 2
CritToEnemyMagic
when 5
CritToEnemyCustom1
when 6
CritToEnemyCustom2
when 7
CritToEnemyCustom3
when 10
CritToEnemyZero
when 20
CritToEnemyHeal
else
CritToEnemyBase
end
}
CriticalToActor = StrProc.new {
case $crilasthit
when 0
CritToActorAmbig
when 1
CritToActorBase
when 2
CritToActorMagic
when 5
CritToActorCustom1
when 6
CritToActorCustom2
when 7
CritToActorCustom3
when 10
CritToActorZero
when 20
CritToActorHeal
else
CritToActorBase
end
}
end
class RPG::UsableItem
#============================================================================
# Allows the skill critical parameters to be seen outside the instance
#============================================================================
attr_accessor :autocrit # autocrit - ignores prevent critical
attr_accessor :skill_crit_chance # skill critical chance
attr_accessor :plus_crit_chance # plus critical chance
attr_accessor :crit_override # use skill critical modifier
attr_accessor :display_crit_mode # which critical message to display
attr_accessor :show_zero_damage # crit is turned off if zero damage
# By default, no useable skill or item will be allowed to crit
# Redefined by subclass RPG::Skill to allow some skills to crit
def critical_allowed
return false
end
unless method_defined?(:magical?)
def magical?
return spi_f > 0
end
end
unless method_defined?(:ambiguous?)
def ambiguous?
return !(physical_attack || magical?)
end
end
def display_crit_mode
create_critical_skill_cache if @display_crit_mode == nil
return @display_crit_mode
end
def create_critical_skill_cache
@autocrit = false
@skill_crit_chance = nil
@crit_override = false
@plus_crit_chance = 0
if ambiguous?
@display_crit_mode = 0
elsif physical_attack
@display_crit_mode = 1
elsif magical?
@display_crit_mode = 2
else
@display_crit_mode = 1
end
@allow_crit = false
@show_zero_damage = Mithran::CriticalSkills::ALLOW_ZERO_DMG_CRIT
end
def critical_allowed
create_critical_skill_cache if @allow_crit == nil
return @allow_crit
end
end
class RPG::Skill < RPG::UsableItem
#============================================================================
# This method does the actual creating of the skill critical
# attributes through parsing the note file and checking for the specific tags
#============================================================================
def create_critical_skill_cache
@autocrit = false
@skill_crit_chance = nil
@crit_override = false
@plus_crit_chance = 0
@allow_crit = Mithran::CriticalSkills::SKILLS_CAN_CRIT
# if the attack is not physical and skills are allowed to crit by default
if ambiguous?
@display_crit_mode = 0
elsif physical_attack
@display_crit_mode = 1
elsif magical?
@display_crit_mode = 2
else
@display_crit_mode = 1
end
@show_zero_damage = Mithran::CriticalSkills::ALLOW_ZERO_DMG_CRIT
if physical_attack == false && @allow_crit == true
# skill will be allowed to crit if nonphysical can crit
@allow_crit = Mithran::CriticalSkills::NONPHYSICAL_CAN_CRIT
end
# if the attack contains spirt_f value and is allowed to crit by default
if magical? && @allow_crit == true
# skill will be allowed to crit if magical skills can crit
@allow_crit = Mithran::CriticalSkills::MAGIC_CAN_CRIT
end
self.note.split(/[\r\n]+/).each { |line|
case line
when Mithran::CriticalSkills::AUTOCRIT
# if AutoCrit string tag is found
@autocrit = true
when Mithran::CriticalSkills::SKILL_CRIT_CHANCE
# if skill crit chance tag is found, set the skill crit chance
@skill_crit_chance = $1.to_i
when Mithran::CriticalSkills::PLUS_CRIT_CHANCE
# if plus crit chance tag is found, set the plus crit of this skill
@plus_crit_chance += $1.to_i
when Mithran::CriticalSkills::MINUS_CRIT_CHANCE
# if plus crit chance tag is found, set the plus crit of this skill
@plus_crit_chance -= $1.to_i
when Mithran::CriticalSkills::CAN_CRIT
# allow this skill to critical, overriding the default
@allow_crit = true
when Mithran::CriticalSkills::CANNOT_CRIT
# disallow this skill to critical, overriding the default
@allow_crit = false
when Mithran::CriticalSkills::DISPLAY_CRIT
n = $1.to_i
if n >= 0 && n <= 7
@display_crit_mode = n
end
when Mithran::CriticalSkills::SHOW_ZERO_DMG
@show_zero_damage = ($1.downcase == "show")
end
}
if $imported["RateDamage"] #KGC Rate Damage Support
@allow_crit = false if rate_damage_max? || rate_damage?
# rate damage skills will never critical
end
if defined?(Mithran::SkillFunctions)
@allow_crit = false if @exact_damage
end
# if a skill critical chance is specified, override normal crit chance
@crit_override = true unless @skill_crit_chance == nil
end
end
class Game_Battler
alias make_obj_damage_value_skillcrit_mithran make_obj_damage_value
def make_obj_damage_value(user, obj)
make_obj_damage_value_skillcrit_mithran(user, obj)
make_obj_critical_damage_value(user, obj) if obj.critical_allowed
end
def make_obj_critical_damage_value(user, obj)
if $imported["DamageLimit"]
return if @pre_critical && !@critical
end
@critical = determine_obj_critical(user, obj) unless @pre_critical != nil
@critical = true if @pre_critical
if @hp_damage < 0 && obj.base_damage >= 0
@critical = false
elsif @hp_damage <= 0 && @mp_damage < 0 && obj.base_damage >= 0
@critical = false
elsif @hp_damage <= 0 && obj.base_damage <= 0
@critical = false if !Mithran::CriticalSkills::ALLOW_HEALS
elsif @hp_damage <= 0 && @mp_damage < 0 && obj.base_damage <= 0
@critical = false if !Mithran::CriticalSkills::ALLOW_HEALS
end
@mp_damage *= 2 if @critical
@hp_damage *= 2 if @critical
if @hp_damage == 0 && @mp_damage == 0
@critical = false if !obj.show_zero_damage
end
end
def obj_critical_probability(user, obj)
critchance = user.cri # set base critical chance
critchance += obj.plus_crit_chance # critical chance increased by skill
critchance = obj.skill_crit_chance if obj.crit_override
# critical chance is set to the skill specific value if specified
return critchance
end
def determine_obj_critical(user, obj)
result = (rand(100) < obj_critical_probability(user, obj)) # roll to determine critical hit
result = false if prevent_critical # criticals prevented?
result = true if obj.autocrit # autocrits if skill is autocrit
return result
end
end
class Scene_Battle
alias display_critical_skillcrit display_critical
def display_critical(target, obj = nil)
$crilasthit = 1
if obj != nil
$crilasthit = obj.display_crit_mode
end
if target.hp_damage == 0 && target.mp_damage == 0
$crilasthit = 10
elsif (target.hp_damage <= 0 || target.mp_damage <= 0) && !obj.nil? && obj.base_damage <= 0
$crilasthit = 20
end
display_critical_skillcrit(target, obj)
end
end
[/spoiler]
Within the Text Script, this is the exact line the error pointed me to: @text = @lines[index].dup
And the full error code is NoMethodError occured. allocator undefined for StrProc
(After doing a control+shift+F of StrProc, I found that it appears 1 time in MA's damage pop up script, and 3 times in skills can crit, so I'll enclose the damage popup script also)
[spoiler]#==============================================================================
# Damage Popup
# Version: 1.0b
# Author: modern algebra (rmrk.net)
# Date: September 8, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows damage to popup on top of the battler, rather than
# being shown in the message box.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script above Main and below other custom scripts. Please see
# the editable region beginning at line 35 for configuration options.
#
# To change the text shown when a critical hit is landed, or the target is
# missed or the target evades, you will need to go up to the Vocab module
# (the very first script in the editor) and change the values of the
# following constants:
#
# CriticalToActor
# CriticalToEnemy
# ActorNoHit
# ActorEvasion
# EnemyNoHit
# EnemyEvasion
#==============================================================================
#================================================================================
# *** Module ModernAlgebra
#================================================================================
module ModernAlgebra
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# EDITABLE REGION
#````````````````````````````````````````````````````````````````````````````
# Please read the comments above each constant to learn what it controls.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# DP_VANISH_SPEED controls the number of frames a damage pop sprite remains
# visible. There are 60 frames in a second.
DP_VANISH_SPEED = 90
# DP_PLUS_X and DP_PLUS_Y control the position of the damage pop sprites,
# with reference to the center bottom of the damaged battler. Keep in mind
# that the damage pop is centred on a 200 pixel bitmap, so a DP_PLUS_X of
# -100 would have the text centred on the battler.
DP_PLUS_X = -100
DP_PLUS_Y = -50
# DP_FONT is the font used for displaying the damage popup. When it is an
# array, that is the priority in which fonts are checked. So, for instance:
# ["Verdana", "Arial", "Courier New"] would mean that the font would be
# Verdana by default. If the player doesn't have Verdana installed, it would
# be Arial, and if the player doesn't have Arial installed, it would be
# Courier New.
DP_FONT = ["Verdana", "Arial", "Courier New"]
# DP_SIZE is the size of the damage popup text.
DP_SIZE = 24
# The _COLOR constants below control the color of the damage popup in their
# respective situations and are arrays holding the [red, green, blue] values
# of the color.
# HPDAMAGE is the color for when the target's HP is decreased
DP_HPDAMAGE_COLOR = [255, 255, -255]
# MPDAMAGE is the color for when the target's MP is decreased
DP_MPDAMAGE_COLOR = [255, 20, 180]
# HPHEAL is the color for when the target's HP is increased
DP_HPHEAL_COLOR = [0, 255, 0]
# MPHEAL is the color for when the target's MP is increased
DP_MPHEAL_COLOR = [0, 0, 255]
# CRIT is the color for when the target receives a critical hit
DP_CRIT_COLOR = [255, 0, 0]
# MISS is the color for when the target evades or is otherwise missed
DP_MISS_COLOR = [255, 255, 255]
# If you still want damage to show up in the message box as well, change
# this value to true. false means the damage won't show up in the message
# box and only show up as a popup.
DP_SHOW_DAMAGE_IN_MESSAGE = true
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# END EDITABLE REGION
#////////////////////////////////////////////////////////////////////////////
end
#==============================================================================
# ** Game Battler
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new instance variables - dp_hp_damage_pop, dp_mp_damage_pop, dp_crit_pop,
# dp_miss_pop
# aliased method - execute_damage
#==============================================================================
class Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :dp_hp_damage_pop
attr_accessor :dp_mp_damage_pop
attr_accessor :dp_crit_pop
attr_accessor :dp_miss_pop
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Damage Reflection
# user : User of skill or item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnal_joy_exctdmge_dmgpop_1sd3 execute_damage
def execute_damage (user, *args)
@dp_crit_pop = actor? ? Vocab::CriticalToActor : Vocab::CriticalToEnemy if @critical
@dp_hp_damage_pop = @hp_damage if @hp_damage != 0
@dp_mp_damage_pop = @mp_damage if @mp_damage != 0
if @absorbed
user.dp_hp_damage_pop = (-1*@hp_damage) if @hp_damage != 0
user.dp_mp_damage_pop = (-1*@mp_damage) if @mp_damage != 0
end
mdrnal_joy_exctdmge_dmgpop_1sd3 (user, *args)
end
end
#==============================================================================
# ** Sprite Battler
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - initialize, update
# new methods - dp_start_damage_pop, dp_update_damage_pop
#==============================================================================
class Sprite_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_joy_init_dmgpop_7df5 initialize
def initialize (*args)
@damage_pop_sprites = []
@damage_pop_frames = []
modalg_joy_init_dmgpop_7df5 (*args) # Run Original Method
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnalg_jy_lufiaii_dmgpop_upd_1bd3 update
def update (*args)
mdrnalg_jy_lufiaii_dmgpop_upd_1bd3 (*args) # Run Original Method
dp_update_damage_pop unless @battler.nil?
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start Damage Pop
# type : Whether HP, MP Damage
# damage : The amount to display
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def dp_start_damage_pop (damage, type = 0)
# Create Damage Sprite
sprite = Sprite_Base.new
size = damage.is_a?(StrProc) ? 70 : ModernAlgebra::DP_SIZE
sprite.bitmap = Bitmap.new (200, size)
# Get color of damage
sprite.bitmap.font = Font.new (ModernAlgebra::DP_FONT, size)
sprite.bitmap.font.size -= 4 if type > 1
sprite.bitmap.font.color = case type
when 0 then damage > 0 ? Color.new (*ModernAlgebra::DP_HPDAMAGE_COLOR) : Color.new (*ModernAlgebra::DP_HPHEAL_COLOR)
when 1 then damage > 0 ? Color.new (*ModernAlgebra::DP_MPDAMAGE_COLOR) : Color.new (*ModernAlgebra::DP_MPHEAL_COLOR)
when 2 then Color.new (*ModernAlgebra::DP_MISS_COLOR)
when 3 then Color.new (*ModernAlgebra::DP_CRIT_COLOR)
end
damage_string = damage.is_a?(Fixnum) ? damage.abs.to_s : damage.to_s
sprite.bitmap.draw_text (0, 0, 200, size, damage_string, 1)
sprite.x = self.x + ModernAlgebra::DP_PLUS_X
sprite.y = @damage_pop_sprites.empty? ? self.y + ModernAlgebra::DP_PLUS_Y : @damage_pop_sprites[-1].y + 24
sprite.z = self.z + 20
@damage_pop_sprites.push (sprite)
@damage_pop_frames.push (0)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Damage Pop
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def dp_update_damage_pop
# Start New Damage Pops
dp_start_damage_pop (@battler.dp_miss_pop, 2) if @battler.dp_miss_pop != nil
dp_start_damage_pop (@battler.dp_crit_pop, 3) if @battler.dp_crit_pop != nil
dp_start_damage_pop (@battler.dp_hp_damage_pop) if @battler.dp_hp_damage_pop != nil
dp_start_damage_pop (@battler.dp_mp_damage_pop, 1) if @battler.dp_mp_damage_pop != nil
@battler.dp_hp_damage_pop = nil
@battler.dp_mp_damage_pop = nil
@battler.dp_miss_pop = nil
@battler.dp_crit_pop = nil
# Store sprites to dispose
dispose_indices = []
opac_minus = 255 / ModernAlgebra::DP_VANISH_SPEED
@damage_pop_sprites.each_index { |i|
if @damage_pop_frames[i] == ModernAlgebra::DP_VANISH_SPEED
dispose_indices.push (i)
next
end
sprite = @damage_pop_sprites[i]
sprite.update
sprite.y -= 1 if @damage_pop_frames[i] % 2 == 0
sprite.opacity -= opac_minus
@damage_pop_frames[i] += 1
}
# Dispose finished damage sprites
dispose_indices.reverse.each { |i|
@damage_pop_sprites[i].dispose
@damage_pop_sprites.delete_at (i)
@damage_pop_frames.delete_at (i)
}
end
end
#==============================================================================
# ** Window Battle Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - initialize, add_instant_text
#==============================================================================
class Window_BattleMessage
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :dp_ignore_instant_text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias algbra_popdamge_joy_initz_2fb5 initialize
def initialize (*args)
@dp_ignore_instant_text = false
# Run Original Method
algbra_popdamge_joy_initz_2fb5 (*args)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add Text
# text : Text to be added
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnalg_damagepopper_oyj_adintxt_4jk2 add_instant_text
def add_instant_text (*args)
return if @dp_ignore_instant_text
# Run Original Method
mdrnalg_damagepopper_oyj_adintxt_4jk2 (*args)
end
end
#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - display_action_effects, display_state_changes
#==============================================================================
class Scene_Battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Display Action Effects
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdnalbra_jy_dispactefct_dmgpop_9jv2 display_action_effects
def display_action_effects (target, *args)
if target.missed
target.dp_miss_pop = target.actor? ? sprintf(Vocab::ActorNoHit, target.name) : sprintf(Vocab::EnemyNoHit, target.name)
elsif target.evaded
target.dp_miss_pop = target.actor? ? sprintf(Vocab::ActorEvasion, target.name) : sprintf(Vocab::EnemyEvasion, target.name)
end
@message_window.dp_ignore_instant_text = true unless ModernAlgebra::DP_SHOW_DAMAGE_IN_MESSAGE || target.actor?
mdnalbra_jy_dispactefct_dmgpop_9jv2 (target, *args) # Run Original Method
@message_window.dp_ignore_instant_text = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Display State Changes
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnag_joy_dspsttchng_dmpp_8jh3 display_state_changes
def display_state_changes (*args)
# Save value of ignore text
old_ignore_val = @message_window.dp_ignore_instant_text
@message_window.dp_ignore_instant_text = false
mdrnag_joy_dspsttchng_dmpp_8jh3 (*args) # RUn Original Method
@message_window.dp_ignore_instant_text = old_ignore_val
end
end
[/spoiler]
And it's on this line, line 150: size = damage.is_a?(StrProc) ? 70 : ModernAlgebra::DP_SIZE