Jump to content
Sign in to follow this  
buddysievers

Overkill = Double Exp

Recommended Posts

Hi again, i have found a snippet which can check if there was over-damage when a enemy gets killed like in FFX.

Look here:

 

 

# Overkill Snippet
# This will call a common event when player kills an enemy and check over-damage.
# Over-damage will be stored in OVER_DAMAGE_VARIABLE 
# Enemy ID will be stored in ENEMY_ID_VARIABLE 
# Free for all purposes.
# Credit: Archeia Nessiah for the idea and publishing allowance.
 
module Overkill
  OVER_DAMAGE_VARIABLE = 100
  ENEMY_ID_VARIABLE = 101 # ID in Database
  COMMON_EVENT = 1
end
 
class Game_Battler < Game_BattlerBase
  
  alias overkill_item_apply item_apply
  def item_apply(user, item)
    original_hp = @hp
    overkill_item_apply(user, item)
    #---
    return unless self.enemy?
    return unless user.actor?
    return unless @result.hp_damage > original_hp
    #---
    $game_variables[Overkill::OVER_DAMAGE_VARIABLE] = @result.hp_damage - original_hp
    $game_variables[Overkill::ENEMY_ID_VARIABLE] = self.enemy.id
    return unless $data_common_events[Overkill::COMMON_EVENT]
    $game_temp.reserve_common_event(Overkill::COMMON_EVENT)
  end
  
end # Game_Battler

 
What i want is that the enemy which gets killed with over-damage gives double exp after the battle.
Not overall exp just for the killed enemy if thats possible.
Also i want a popup like critical which says overkill, im using Yami's script.
Look here:

$imported = {} if $imported.nil?
$imported["YES-BattlePopup"] = true
 
#==============================================================================
# â–  BattleLuna
#==============================================================================
 
module BattleLuna
  module Addon
    
    BATTLE_POPUP = {
      # Basic Configuration.
      :basic_setting  =>  {
        :enable      =>  true,       # Set to false to disable popup.
        :state_popup =>  false,       # Set to false to disable state popup.
        :buff_popup  =>  false,       # Set to false to disable buff popup.
        :delay       =>  6,          # Delay between each popup.
        :no_delay    =>  [:critical, :drained, :weakpoint, :resistant, :absorbed],
      },
      
      # Configuration for words.
      :word_setting   =>  {
        :default    => "%s",      # SprintF for Default.
        :hp_dmg     => "%s",      # SprintF for HP damage.
        :hp_heal    => "%s",      # SprintF for HP healing.
        :mp_dmg     => "%s MP",    # SprintF for MP damage.
        :mp_heal    => "%s MP",    # SprintF for MP healing.
        :tp_dmg     => "",         # SprintF for MP damage.
        :tp_heal    => "",         # SprintF for MP healing.
        :drained    => "DRAIN",     # Text display for draining HP/MP.
        :critical   => "CRITICAL!", # Text display for critical hit.
        :missed     => "MISS",      # Text display for missed attack.
        :evaded     => "EVADE!",    # Text display for evaded attack.
        :nulled     => "NULL",      # Text display for nulled attack.
        :failed     => "FAILED",    # Text display for a failed attack.
        :add_state  => "+%s",       # SprintF for added states.
        :rem_state  => "-%s",       # SprintF for removed states.
        :dur_state  => "%s",        # SprintF for during states.
        :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
        :resistant  => "RESIST",    # Appears if foe is resistant to element.
        :immune     => "IMMUNE",    # Appears if foe is immune to element.
        :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
        :add_buff   => "%s",        # Appears when a positive buff is applied.
        :add_debuff => "%s",        # Appears when a negative buff is applied.
      },
      
      # Configuration for popup visual.
      :style_setting  =>  {
        # Type      => [Red, Green, Blue, Size, Bold, Italic, Font],
        :default    => [255,   255,  255,   16, false,  false, Font.default_name],
        :hp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :hp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :mp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :mp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :tp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :tp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :drained    => [255,   255,  255,   16, false,  false, Font.default_name],
        :critical   => [255,   255,  255,   16, false,  false, Font.default_name],
        :missed     => [255,   255,  255,   16, false,  false, Font.default_name],
        :evaded     => [255,   255,  255,   16, false,  false, Font.default_name],
        :nulled     => [255,   255,  255,   16, false,  false, Font.default_name],
        :failed     => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :rem_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :dur_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :weakpoint  => [255,   255,  255,   16, false,  false, Font.default_name],
        :resistant  => [255,   255,  255,   16, false,  false, Font.default_name],
        :immune     => [255,   255,  255,   16, false,  false, Font.default_name],
        :absorbed   => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_buff   => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_debuff => [255,   255,  255,   16, false,  false, Font.default_name],
        :lvup       => [255,   255,  255,   16, false,  false, Font.default_name],
      },
      
      # Configuration for popup effect.
      :effect_setting =>  {
        # Type      => [Effect sequence],
        :default    => [:up, :wait],
        :hp_dmg     => [:jump_1, :jump_2, :wait],
        :hp_heal    => [:jump_1, :jump_2, :wait],
        :mp_dmg     => [:jump_1, :jump_2, :wait],
        :mp_heal    => [:jump_1, :jump_2, :wait],
        :tp_dmg     => [:jump_1, :jump_2, :wait],
        :tp_heal    => [:jump_1, :jump_2, :wait],
        :drained    => [:affect, :up    , :wait],
        :critical   => [:affect, :up    , :wait],
        :missed     => [:up    , :wait],
        :evaded     => [:up    , :wait],
        :nulled     => [:up    , :wait],
        :failed     => [:up    , :wait],
        :add_state  => [:affect, :up    , :wait],
        :rem_state  => [:affect, :up    , :wait],
        :dur_state  => [:affect, :up    , :wait],
        :weakpoint  => [:affect, :up    , :wait],
        :resistant  => [:affect, :up    , :wait],
        :immune     => [:up    , :wait],
        :absorbed   => [:affect, :up    , :wait],
        :add_buff   => [:affect, :up    , :wait],
        :add_debuff => [:affect, :up    , :wait],
        :lvup       => [:up, :wait],
      },
      
      :effect_setup   =>  {
        #:type   => [ZoomX, ZoomY, StartX, StartY, MoveX, MoveY, Gravt, Opacity, Dur, Random],
        :up      => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -1.0 , 0.0  , 255    , 32 , false ],
        :jump_1  => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -6.4 , 0.4  , 255    , 33 , false ],
        :jump_2  => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -3.2 , 0.2  , 255    , 33 , false ],
        :wait    => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , 0.0  , 0.0  , 0      , 20 , false ],
        :affect  => [1.0  , 1.0  , 0.0   , -32.0 , 0.0  , 0.0  , 0.0  , 255    , 1  , false ],
      },
      
    } # End BATTLE_POPUP.
    
  end # Addon
end # BattleLuna
 
#==============================================================================
# â–  Game_BattlerBase
#==============================================================================
 
class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :popups
  
  #--------------------------------------------------------------------------
  # new method: create_popup
  #--------------------------------------------------------------------------
  def create_popup(data, rule = :default)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:enable]
    @popups ||= []
    @popups.push([data, rule])
  end
  
  #--------------------------------------------------------------------------
  # new method: make_damage_popups
  #--------------------------------------------------------------------------
  def make_damage_popups(user)
    if @result.hp_drain != 0
      rule = :drained
      user.create_popup(["", nil], rule)
      rule = :hp_dmg  if @result.hp_drain < 0
      rule = :hp_heal if @result.hp_drain > 0
      value = @result.hp_drain.abs
      user.create_popup(["#{value}", nil], rule)
    end
    if @result.mp_drain != 0
      rule = :drained
      user.create_popup(["", nil], rule)
      rule = :mp_dmg  if @result.mp_drain < 0
      rule = :mp_heal if @result.mp_drain > 0
      value = @result.mp_drain.abs
      user.create_popup(["#{value}", nil], rule)
    end
    #---
    rule = :critical
    create_popup(["", nil], rule) if @result.critical
    if @result.hp_damage != 0
      rule = :hp_dmg  if @result.hp_damage > 0
      rule = :hp_heal if @result.hp_damage < 0
      value = @result.hp_damage.abs
      create_popup(["#{value}", nil], rule)
    end
    if @result.mp_damage != 0
      rule = :mp_dmg  if @result.mp_damage > 0
      rule = :mp_heal if @result.mp_damage < 0
      value = @result.mp_damage.abs
      create_popup(["#{value}", nil], rule)
    end
    if @result.tp_damage != 0
      rule = :tp_dmg  if @result.tp_damage > 0
      rule = :tp_heal if @result.tp_damage < 0
      value = @result.tp_damage.abs
      create_popup(["#{value}", nil], rule)
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: erase_state
  #--------------------------------------------------------------------------
  alias battle_luna_dp_erase_state erase_state unless $imported["YEA-BattleEngine"]
  def erase_state(state_id)
    make_state_popup(state_id, :rem_state) if @states.include?(state_id)
    if $imported["YEA-BattleEngine"]
      game_battlerbase_erase_state_abe(state_id)
    else
      battle_luna_dp_erase_state(state_id)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: make_during_state_popup
  #--------------------------------------------------------------------------
  def make_during_state_popup
    state_id = most_important_state_id
    return if state_id == 0
    make_state_popup(state_id, :dur_state)
  end
  
  #--------------------------------------------------------------------------
  # new method: most_important_state_id
  #--------------------------------------------------------------------------
  def most_important_state_id
    states.each {|state| return state.id unless state.message3.empty? }
    return 0
  end
  
  #--------------------------------------------------------------------------
  # new method: make_state_popup
  #--------------------------------------------------------------------------
  def make_state_popup(state_id, type)
    return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:state_popup]
    state = $data_states[state_id]
    return if state.icon_index == 0
    create_popup(["#{state.name}", state.icon_index], type)
  end
  
  #--------------------------------------------------------------------------
  # new method: make_miss_popups
  #--------------------------------------------------------------------------
  def make_miss_popups(user, item)
    return if dead?
    if @result.missed
      rule = :missed
      create_popup(["", nil], rule)
    end
    if @result.evaded
      rule = :evaded
      create_popup(["", nil], rule)
    end
    if @result.hit? && !@result.success
      rule = :failed
      create_popup(["", nil], rule)
    end
    if @result.hit? && item.damage.to_hp?
      if @result.hp_damage == 0 && @result.mp_damage == 0
        rule = :nulled
        create_popup(["", nil], rule)
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: make_rate_popup
  #--------------------------------------------------------------------------
  def make_rate_popup(rate)
    return if rate == 1.0
    if rate > 1.0
      rule = :weakpoint
    elsif rate == 0.0
      rule = :immune
    elsif rate < 0.0
      rule = :absorbed
    else
      rule = :resistant
    end
    create_popup(["", nil], rule)
  end
  
  #--------------------------------------------------------------------------
  # new method: make_buff_popup
  #--------------------------------------------------------------------------
  def make_buff_popup(param_id, positive = true)
    return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:buff_popup]
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless alive?
    name = Vocab::param(param_id)
    if positive
      rule = :add_buff
      buff_level = 1
    else
      rule = :add_debuff
      buff_level = -1
    end
    icon = buff_icon_index(buff_level, param_id)
    create_popup(["#{name}", icon], rule)
  end
 
end # Game_BattlerBase
 
#==============================================================================
# â–  Game_Battler
#==============================================================================
 
class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: on_battle_end
  #--------------------------------------------------------------------------
  alias battle_luna_dp_on_battle_end on_battle_end
  def on_battle_end
    battle_luna_dp_on_battle_end
    @popups ||= []
    @popups.clear
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_apply
  #--------------------------------------------------------------------------
  alias battle_luna_dp_item_apply item_apply unless $imported["YEA-BattleEngine"]
  def item_apply(user, item)
    if $imported["YEA-BattleEngine"]
      game_battler_item_apply_abe(user, item)
    else
      battle_luna_dp_item_apply(user, item)
    end    
    @result.restore_damage
    make_miss_popups(user, item)
    make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: make_damage_value
  #--------------------------------------------------------------------------
  alias battle_luna_dp_make_damage_value make_damage_value unless $imported["YEA-BattleEngine"]
  def make_damage_value(user, item)
    if $imported["YEA-BattleEngine"]
      game_battler_make_damage_value_abe(user, item)
    else
      battle_luna_dp_make_damage_value(user, item)
    end    
    rate = item_element_rate(user, item)
    make_rate_popup(rate)
  end
  
  #--------------------------------------------------------------------------
  # alias method: execute_damage
  #--------------------------------------------------------------------------
  alias battle_luna_dp_execute_damage execute_damage unless $imported["YEA-BattleEngine"]
  def execute_damage(user)
    if $imported["YEA-BattleEngine"]
      game_battler_execute_damage_abe(user)
    else
      battle_luna_dp_execute_damage(user)
    end    
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_recover_hp
  #--------------------------------------------------------------------------
  alias battle_luna_dp_item_effect_recover_hp item_effect_recover_hp unless $imported["YEA-BattleEngine"]
  def item_effect_recover_hp(user, item, effect)
    if $imported["YEA-BattleEngine"]
      game_battler_item_effect_recover_hp_abe(user, item, effect)
    else
      battle_luna_dp_item_effect_recover_hp(user, item, effect)
    end    
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_recover_mp
  #--------------------------------------------------------------------------
  alias battle_luna_item_effect_recover_mp item_effect_recover_mp unless $imported["YEA-BattleEngine"]
  def item_effect_recover_mp(user, item, effect)
    if $imported["YEA-BattleEngine"]
      game_battler_item_effect_recover_mp_abe(user, item, effect)
    else
      battle_luna_item_effect_recover_mp(user, item, effect)
    end  
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_gain_tp
  #--------------------------------------------------------------------------
  alias battle_luna_item_effect_gain_tp item_effect_gain_tp unless $imported["YEA-BattleEngine"]
  def item_effect_gain_tp(user, item, effect)
    if $imported["YEA-BattleEngine"]
      game_battler_item_effect_gain_tp_abe(user, item, effect)
    else
      battle_luna_item_effect_gain_tp(user, item, effect)
    end  
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_new_state
  #--------------------------------------------------------------------------
  alias battle_luna_dp_add_new_state add_new_state unless $imported["YEA-BattleEngine"]
  def add_new_state(state_id)
    if $imported["YEA-BattleEngine"]
      game_battler_add_new_state_abe(state_id)
    else
      battle_luna_dp_add_new_state(state_id)
    end  
    make_state_popup(state_id, :add_state) if @states.include?(state_id)
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_buff
  #--------------------------------------------------------------------------
  alias battle_luna_dp_add_buff add_buff unless $imported["YEA-BattleEngine"]
  def add_buff(param_id, turns)
    make_buff_popup(param_id, true)
    if $imported["YEA-BattleEngine"]
      game_battler_add_buff_abe(param_id, turns)
    else
      battle_luna_dp_add_buff(param_id, turns)
    end  
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_debuff
  #--------------------------------------------------------------------------
  alias battle_luna_dp_add_debuff add_debuff unless $imported["YEA-BattleEngine"]
  def add_debuff(param_id, turns)
    make_buff_popup(param_id, false)
    if $imported["YEA-BattleEngine"]
      game_battler_add_debuff_abe(param_id, turns)
    else
      battle_luna_dp_add_debuff(param_id, turns)
    end  
  end
  
  #--------------------------------------------------------------------------
  # alias method: regenerate_all
  #--------------------------------------------------------------------------
  alias battle_luna_dp_regenerate_all regenerate_all unless $imported["YEA-BattleEngine"]
  def regenerate_all
    if $imported["YEA-BattleEngine"]
      game_battler_regenerate_all_abe
    else
      battle_luna_dp_regenerate_all
    end  
    return unless alive?
    make_damage_popups(self)
  end
    
end # Game_Battler
 
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
 
class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: screen_x
  #--------------------------------------------------------------------------
  unless Game_Actor.instance_methods.include?(:screen_x)
  def screen_x
    0
  end
  end
 
  #--------------------------------------------------------------------------
  # new method: screen_y
  #--------------------------------------------------------------------------
  unless Game_Actor.instance_methods.include?(:screen_y)
  def screen_y
    0
  end
  end
 
  #--------------------------------------------------------------------------
  # new method: screen_z
  #--------------------------------------------------------------------------
  unless Game_Actor.instance_methods.include?(:screen_z)
  def screen_y
    0
  end
  end
  
end # Game_Actor
 
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
 
class Sprite_Battler < Sprite_Base
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias battle_luna_dp_initialize initialize
  def initialize(viewport, battler = nil)
    battle_luna_dp_initialize(viewport, battler)
    @popups = []
    @popup_delay = 0
  end
  
  #--------------------------------------------------------------------------
  # alias method: setup_new_effect
  #--------------------------------------------------------------------------
  alias battle_luna_dp_setup_new_effect setup_new_effect
  def setup_new_effect
    battle_luna_dp_setup_new_effect
    setup_popups
  end
  
  #--------------------------------------------------------------------------
  # new method: setup_popups
  #--------------------------------------------------------------------------
  def setup_popups
    setting = BattleLuna::Addon::BATTLE_POPUP
    return unless @battler.use_sprite?
    @battler.popups ||= []
    @popup_delay -= 1
    return if @popup_delay > 0
    array = @battler.popups.shift
    return if array.nil?
    create_new_popup(array[0], array[1])
    return if @battler.popups.size == 0
    return if setting[:basic_setting][:no_delay].include?(array[1])
    @popup_delay = setting[:basic_setting][:delay]
  end
  
  #--------------------------------------------------------------------------
  # new method: create_new_popup
  #--------------------------------------------------------------------------
  def create_new_popup(data, rule)
    return unless @battler
    return unless SceneManager.scene.is_a?(Scene_Battle)
    viewport = self.viewport
    popup = Sprite_PopupLuna.new(viewport, @battler, data, rule)
    @popups.push(popup)
  end
  
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias battle_luna_dp_update update
  def update
    battle_luna_dp_update
    update_popups
  end
  
  #--------------------------------------------------------------------------
  # new method: update_popups
  #--------------------------------------------------------------------------
  def update_popups
    @popups.each { |popup| popup.update }
    @popups.each_with_index { |sprite, index|
      next unless sprite.disposed?
      @popups[index] = nil
    }
    @popups.compact!
  end
  
  #--------------------------------------------------------------------------
  # alias method: dispose
  #--------------------------------------------------------------------------
  alias battle_luna_dp_dispose dispose
  def dispose
    @popups.each { |popup| popup.dispose }
    @popups.clear
    battle_luna_dp_dispose
  end
  
end # Sprite_Battler
 
#==============================================================================
# â–  Sprite_PopupLuna
#==============================================================================
 
class Sprite_PopupLuna < Sprite
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(viewport, battler, data, rule)
    super(viewport)
    @data = data
    @rule = rule
    #---
    @style = rule
    @style = :default unless setting[:style_setting].has_key?(@style)
    @style = setting[:style_setting][@style]
    #---
    @effects = rule
    @effects = :default unless setting[:effect_setting].has_key?(@effects)
    @effects = setting[:effect_setting][@effects].dup
    #---
    @current_effect = nil
    @duration = 0
    @battler = battler
    #---
    start_popup
    start_effect
    update
  end
  
  #--------------------------------------------------------------------------
  # setting
  #--------------------------------------------------------------------------
  def setting
    BattleLuna::Addon::BATTLE_POPUP
  end
  
  #--------------------------------------------------------------------------
  # start_popup
  #--------------------------------------------------------------------------
  def start_popup
    self.bitmap = create_bitmap
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.ox = self.bitmap.width / 2
    self.oy = self.bitmap.height
    self.z = @battler.screen_z + 350
  end
  
  #--------------------------------------------------------------------------
  # create_bitmap
  #--------------------------------------------------------------------------
  def create_bitmap
    bw = Graphics.width
    bw = bw + 48 if @data[1]
    bh = @style[3] * 2
    bitmap = Bitmap.new(bw, bh)
    #---
    bitmap.font.color.set(@style[0], @style[1], @style[2])
    bitmap.font.size   = @style[3]
    bitmap.font.bold   = @style[4]
    bitmap.font.italic = @style[5]
    bitmap.font.name   = @style[6]
    
    
    
    
    bitmap.font.outline = true
    bitmap.font.out_color = Color.new(0, 0, 0, 256)
    
    
    
    
    #---
    dx = @data[1] ? 24 : 0; dy = 0
    text = setting[:word_setting][@rule]
    text = setting[:word_setting][:default] unless text
    text = sprintf(text, @data[0])
    bitmap.draw_text(dx, dy, bw - dx, bh, text, 1)
    #---
    text_width = bitmap.text_size(text).width
    if @data[1]
      icon_bitmap = Cache.system("Iconset")
      icon_index = @data[1].to_i
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      bitmap.blt((bw-text_width)/2-32, (bh - 24)/2, icon_bitmap, rect)
    end
    bitmap
  end
  
  #--------------------------------------------------------------------------
  # start_effect
  #--------------------------------------------------------------------------
  def start_effect
    @current_effect = @effects.shift
    return dispose if @current_effect.nil?
    effect = setting[:effect_setup][@current_effect]
    @duration = effect[8]
    #---
    @zoom_x_rate = (effect[0] - self.zoom_x) / @duration
    @zoom_y_rate = (effect[1] - self.zoom_y) / @duration
    #---
    @move_x = effect[4]
    @move_y = effect[5]
    if effect[9]
      @move_x = @move_x * rand(0)
      @move_x = rand(10) % 2 == 0 ? -@move_x : @move_x
    end
    #---
    @gravity = effect[6]
    #---
    @opacity_rate = (effect[7] - self.opacity) / @duration.to_f
    #---
    self.x += effect[2]
    self.y += effect[3]
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    update_zoom
    update_move
    update_opacity
    update_effect
  end
  
  #--------------------------------------------------------------------------
  # update_effect
  #--------------------------------------------------------------------------
  def update_effect
    @duration -= 1
    return if @duration > 0
    start_effect
  end
  
  #--------------------------------------------------------------------------
  # update_zoom
  #--------------------------------------------------------------------------
  def update_zoom
    self.zoom_x += @zoom_x_rate
    self.zoom_y += @zoom_y_rate
  end
  
  #--------------------------------------------------------------------------
  # update_move
  #--------------------------------------------------------------------------
  def update_move
    self.x += @move_x
    self.y += @move_y
    @move_y += @gravity
  end
  
  #--------------------------------------------------------------------------
  # update_opacity
  #--------------------------------------------------------------------------
  def update_opacity
    self.opacity += @opacity_rate
  end
  
  #--------------------------------------------------------------------------
  # dispose
  #--------------------------------------------------------------------------
  def dispose
    self.bitmap.dispose if self.bitmap
    super
  end
  
end # Sprite_PopupLuna
 
#==============================================================================
# â–  Window_BattleHelp
#==============================================================================
if $imported["YEA-BattleEngine"]
class Window_BattleHelp < Window_Help
  
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias battle_luna_yea_be_update update
  def update
    battle_luna_yea_be_update
    return unless $imported["YEA-BattleEngine"]
    return unless @actor_window && @enemy_window
    if !self.visible and @text != ""
      @text = ""
      return refresh
    end
    update_battler_name
  end
  
end # Window_BattleHelp
end
 
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
 
class Sprite_Battler < Sprite_Base
  
  #--------------------------------------------------------------------------
  # alias method: create_new_popup
  # Compatible with YEA - Battle Engine.
  #--------------------------------------------------------------------------
  if $imported["YEA-BattleEngine"] && !$imported["YES-BattlePopup"]
  alias battle_luna_yea_create_new_popup create_new_popup
  def create_new_popup(value, rules, flags)
    battle_luna_yea_create_new_popup(value, rules, flags)
    @popups.each { |popup| 
      popup.viewport = nil
      popup.z = @battler.screen_z + 1000
    }
  end
  end
  
end # Sprite_Battler
 
#==============================================================================
# â–  Game_ActionResult
#==============================================================================
 
class Game_ActionResult
  
  #--------------------------------------------------------------------------
  # alias method: clear_stored_damage
  #--------------------------------------------------------------------------
  alias battle_luna_yea_clear_stored_damage clear_stored_damage if $imported["YEA-BattleEngine"]
  def clear_stored_damage
    battle_luna_yea_clear_stored_damage unless $imported["YES-BattlePopup"]
  end
  
  #--------------------------------------------------------------------------
  # alias method: store_damage
  #--------------------------------------------------------------------------
  alias battle_luna_yea_store_damage store_damage if $imported["YEA-BattleEngine"]
  def store_damage
    battle_luna_yea_store_damage unless $imported["YES-BattlePopup"]
  end
  
  #--------------------------------------------------------------------------
  # alias method: restore_damage
  #--------------------------------------------------------------------------
  alias battle_luna_yea_restore_damage restore_damage if $imported["YEA-BattleEngine"]
  def restore_damage
    battle_luna_yea_restore_damage unless $imported["YES-BattlePopup"]
  end
  
end # Game_ActionResult

 

Anyone able to help me out?

Thx in advance!  :)

Share this post


Link to post
Share on other sites

Do you want your overkill xp only for the killer or forthe whole party?

  • Like 1

Share this post


Link to post
Share on other sites

I would like to have it for the whole party.

Also im using Hime's Shared EXP script i forget to mention that before. :huh:

Look here:

 

 

class Game_Troop < Game_Unit
  
  alias :th_shared_exp_exp_total :exp_total
  def exp_total
    total = th_shared_exp_exp_total
    return apply_exp_modifiers(total)
  end
  
  def apply_exp_modifiers(total)
    return total / $game_party.alive_members.size
  end
end

Edited by buddysievers

Share this post


Link to post
Share on other sites

Okay first let's go with the overkill popup

 

I started by adding an overkill in each configuration block

 

 

 

# Configuration for words.
      :word_setting   =>  {
        :default    => "%s",      # SprintF for Default.
        :hp_dmg     => "%s",      # SprintF for HP damage.
        :hp_heal    => "%s",      # SprintF for HP healing.
        :mp_dmg     => "%s MP",    # SprintF for MP damage.
        :mp_heal    => "%s MP",    # SprintF for MP healing.
        :tp_dmg     => "",         # SprintF for MP damage.
        :tp_heal    => "",         # SprintF for MP healing.
        :drained    => "DRAIN",     # Text display for draining HP/MP.
        :critical   => "CRITICAL!", # Text display for critical hit.
        :overkill   => "OVERKILL!", # Text display for overkill.
        :missed     => "MISS",      # Text display for missed attack.
        :evaded     => "EVADE!",    # Text display for evaded attack.
        :nulled     => "NULL",      # Text display for nulled attack.
        :failed     => "FAILED",    # Text display for a failed attack.
        :add_state  => "+%s",       # SprintF for added states.
        :rem_state  => "-%s",       # SprintF for removed states.
        :dur_state  => "%s",        # SprintF for during states.
        :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
        :resistant  => "RESIST",    # Appears if foe is resistant to element.
        :immune     => "IMMUNE",    # Appears if foe is immune to element.
        :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
        :add_buff   => "%s",        # Appears when a positive buff is applied.
        :add_debuff => "%s",        # Appears when a negative buff is applied.
      },
      
      # Configuration for popup visual.
      :style_setting  =>  {
        # Type      => [Red, Green, Blue, Size, Bold, Italic, Font],
        :default    => [255,   255,  255,   16, false,  false, Font.default_name],
        :hp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :hp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :mp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :mp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :tp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :tp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :drained    => [255,   255,  255,   16, false,  false, Font.default_name],
        :critical   => [255,   255,  255,   16, false,  false, Font.default_name],
        :overkill   => [255,   255,  255,   16, false,  false, Font.default_name],
        :missed     => [255,   255,  255,   16, false,  false, Font.default_name],
        :evaded     => [255,   255,  255,   16, false,  false, Font.default_name],
        :nulled     => [255,   255,  255,   16, false,  false, Font.default_name],
        :failed     => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :rem_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :dur_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :weakpoint  => [255,   255,  255,   16, false,  false, Font.default_name],
        :resistant  => [255,   255,  255,   16, false,  false, Font.default_name],
        :immune     => [255,   255,  255,   16, false,  false, Font.default_name],
        :absorbed   => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_buff   => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_debuff => [255,   255,  255,   16, false,  false, Font.default_name],
        :lvup       => [255,   255,  255,   16, false,  false, Font.default_name],
      },
      
      # Configuration for popup effect.
      :effect_setting =>  {
        # Type      => [Effect sequence],
        :default    => [:up, :wait],
        :hp_dmg     => [:jump_1, :jump_2, :wait],
        :hp_heal    => [:jump_1, :jump_2, :wait],
        :mp_dmg     => [:jump_1, :jump_2, :wait],
        :mp_heal    => [:jump_1, :jump_2, :wait],
        :tp_dmg     => [:jump_1, :jump_2, :wait],
        :tp_heal    => [:jump_1, :jump_2, :wait],
        :drained    => [:affect, :up    , :wait],
        :critical   => [:affect, :up    , :wait],
        :overkill   => [:affect, :up    , :wait],
        :missed     => [:up    , :wait],
        :evaded     => [:up    , :wait],
        :nulled     => [:up    , :wait],
        :failed     => [:up    , :wait],
        :add_state  => [:affect, :up    , :wait],
        :rem_state  => [:affect, :up    , :wait],
        :dur_state  => [:affect, :up    , :wait],
        :weakpoint  => [:affect, :up    , :wait],
        :resistant  => [:affect, :up    , :wait],
        :immune     => [:up    , :wait],
        :absorbed   => [:affect, :up    , :wait],
        :add_buff   => [:affect, :up    , :wait],
        :add_debuff => [:affect, :up    , :wait],
        :lvup       => [:up, :wait],
      }, 

 

 

 

then I added those lines

rule = :overkill
    create_popup(["", nil], rule) if $game_variables[Overkill::OVER_DAMAGE_VARIABLE] > MINIMUM_OVERKILL

at the end of the make_damge_popups method (around line 180) for me

 

also add this line 

 

clear_overkill_info

 

at the end of the alias method: item_apply around line 320 it should look like this :

alias battle_luna_dp_item_apply item_apply unless $imported["YEA-BattleEngine"]
  def item_apply(user, item)
    if $imported["YEA-BattleEngine"]
      game_battler_item_apply_abe(user, item)
    else
      battle_luna_dp_item_apply(user, item)
    end    
    @result.restore_damage
    make_miss_popups(user, item)
    make_damage_popups(user)
    clear_overkill_info
  end

Edit : i was writing this but had a question to ask you and didn't want to rewrite it do you ned the overkill common event or do you need the overkill only for te popup/ bonus XP ?

Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites

Thx alot so far i will check that code right now! :)

And no, the common event and switch are useless for me.

Share this post


Link to post
Share on other sites

The code won't work it's incomplete ,i needed  to ask the question when i was in the middle of it

 

Knowing the answer, I will write some stuff differently

 

Around line 320 change the alias item_apply method again to this:

alias battle_luna_dp_item_apply item_apply unless $imported["YEA-BattleEngine"]
  def item_apply(user, item)
    if $imported["YEA-BattleEngine"]
      game_battler_item_apply_abe(user, item)
    else
      battle_luna_dp_item_apply(user, item)
    end    
    @result.restore_damage
    make_miss_popups(user, item)
    make_damage_popups(user)
    $overkill_value = -1
  end

Then change the overkill script to this 

 

 

 

# Overkill Snippet
# This will call a common event when player kills an enemy and check over-damage.
# Over-damage will be stored in OVER_DAMAGE_VARIABLE 
# Enemy ID will be stored in ENEMY_ID_VARIABLE 
# Free for all purposes.
# Credit: Archeia Nessiah for the idea and publishing allowance.
 
module Overkill
  MINIMUM_OVERKILL=100 #(indicates the minimal damage for overkill)
  
end
 
class Game_Battler < Game_BattlerBase
  
  alias overkill_item_apply item_apply
  def item_apply(user, item)
    original_hp = @hp
    overkill_item_apply(user, item)
    #---
    return unless self.enemy?
    return unless user.actor?
    return unless @result.hp_damage > original_hp
    #---
    $overkill_damage = @result.hp_damage - original_hp
    
  end
  
end # Game_Battler

 

 

I need a bit more time to think  about xp.

Right now,overkill is defined by a flat value of over damage, do you want a percent of current hp or max hp instead?

 

Edit : and i forgot to mention make sure the overkill script is above the popup script

Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites

what do you mean with "and put this method before the end of the game battler class (around line 440)"?

 

Edit: oh ok, ill wait.  :) 

Edited by buddysievers

Share this post


Link to post
Share on other sites

Ok so modify the xp script to this:

class Game_Troop < Game_Unit
  
  alias :th_shared_exp_exp_total :exp_total
  def exp_total
    total = th_shared_exp_exp_total + $bonus_xp
    $bonus_xp=0
    return apply_exp_modifiers(total)
  end
  
  def apply_exp_modifiers(total)
    return total / $game_party.alive_members.size
  end
end

and add this line in the overkill script

if $bonus_xp then $bonus_xp+=self.xp else $bonus_xp=self.xp end

between $overkill_damage and end (third to last written line)

Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites

it would be nice if over damage is true when you do more damage then the enemy actually have.

like you do 5000 dmg and the enemy have 4700hp (not max hp)

Share this post


Link to post
Share on other sites

but how much over damage? it's rare you kill the enemy wit the exact amount of hp he has left. anyway you can configure it yourself, right now it's 100 over damage for an overkill

 

edit : Oops I realisd I forgot something

#---
    $overkill_damage = @result.hp_damage - original_hp
    if $overkill_damage > MINIMUM_OVERKILL
      if $bonus_xp
         $bonus_xp+=self.exp
      else
         $bonus_xp =self.exp
      end
    end
  end
  
end # Game_Battler

replace the end of the overkill script with this,( i forgot to check for overkill the script was giving double xp everytime ^-^ )

Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites

i dont know what do you think?
maybe 25% ?!

edit: like when you do 25% more damage then you actually need to kill

 

@-{ Second Post - posted 8 minutes later )
or the best would be, the more percent you do overdamage the more exp bonus you will get...
like if the over damage is 1% you get 1% exp bonus up to 100%.
is that possible?

Edited by Rikifive
Merged Double Post

Share this post


Link to post
Share on other sites

it should be possible and for the overkill popup what should be the threshold?

  • Like 1

Share this post


Link to post
Share on other sites

Ok i will try to look at it tomorrow . I'm too tired

  • Like 1

Share this post


Link to post
Share on other sites

@buddysievers I have merged your posts. Please avoid double posting unless it's absolutely necessary. Thank you. (=

Share this post


Link to post
Share on other sites
the popup just shows the damage you do like normal and the overkill! string nothing more.

 

 

I tested it and the overkill popup seems to work.what do you want exactly?

Edit:

Ok I get it, I think I forgot to tell you to change this line:

 

create_popup(["", nil], rule) if $game_variables[Overkill::OVER_DAMAGE_VARIABLE] > MINIMUM_OVERKILL  into this

 

create_popup(["", nil], rule) if $overkill_damage > MINIMUM_OVERKILL

 

There is lot of stuff going on,I get a bit confused

 

Edit 2 :for the proportionnal bonus xp

#---
    $overkill_damage = @result.hp_damage - original_hp
    overkill_ratio =  [$overkill_damage/original_hp,1].min
    if $overkill_damage > 0
      if $bonus_xp
         $bonus_xp+=floor(self.exp * overkill_ratio)
      else
         $bonus_xp =floor(self.exp * overkill_ratio)
      end
    end
  end
  
end # Game_Battler
Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites

Thx for helpin' me out Shiggy!  :)

I will try the code in a few and check if everything works.

So do you need any more information or is it finished so far?

Quick overview:

Popups show normal Damage + Overkill string

The exp bonus % is the overdamage % so 1% overdamage means 1% exp bonus, that up to max 100%

Overkill means you do at least 25% more damage then the enemy still have

Exp get added to total exp and then shared under all alive battle members

 

 

Edit: So actually its only an overkill when you do more then 25% damage then the enemy have left so

you will start with 25% exp bonus up to 100%

Edited by buddysievers
  • Like 1

Share this post


Link to post
Share on other sites

Ok I miss the 25% for overkill popup so 

create_popup(["", nil], rule) if $overkill_damage > MINIMUM_OVERKILL become 

create_popup(["", nil], rule) if $overkill_flag

 

 

and the end of the overkill script  changes too ( i also  noticed a mistake, good thing i had to check it again)

#---
    $overkill_flag = false
    overkill_damage = (@result.hp_damage - original_hp).to_f
    overkill_ratio =  [overkill_damage/original_hp,1].min
    $overkill_flag = true if overkill_ratio > 1.25
    if overkill_damage > 0
      if $bonus_xp
         $bonus_xp+=floor(self.exp * overkill_ratio)
      else
         $bonus_xp =floor(self.exp * overkill_ratio)
      end
    end
  end
  
end # Game_Battler

and everything should be fine

Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites

Cool i will try that now! :)

Edit:

Im getting an error, undefined method "floor" for <Game_Enemy> at this line

$bonus_xp =floor(self.exp * overkill_ratio)

when i attack an enemy.

Edited by buddysievers
  • Like 1

Share this post


Link to post
Share on other sites

replace "floor(self.exp * overkill_ratio)" with 
(self.exp * overkill_ratio).to_int 
on both lines

  • Like 1

Share this post


Link to post
Share on other sites

it wont crash anymore but there is no popup for overkill, just the normal damage display.

 

Edit: it also seems as there is no exp bonus.

Ive tried it with fighting 2 Slimes killed both with 1000+ dmg and no popup and no bonus exp.

 

I have here the modified scripts:

 

 

# Overkill Snippet
# This will call a common event when player kills an enemy and check over-damage.
# Over-damage will be stored in OVER_DAMAGE_VARIABLE 
# Enemy ID will be stored in ENEMY_ID_VARIABLE 
# Free for all purposes.
# Credit: Archeia Nessiah for the idea and publishing allowance.
 
class Game_Battler < Game_BattlerBase
  
  alias overkill_item_apply item_apply
  def item_apply(user, item)
    original_hp = @hp
    overkill_item_apply(user, item)
    #---
    return unless self.enemy?
    return unless user.actor?
    return unless @result.hp_damage > original_hp
    #---
    $overkill_flag = false
    overkill_damage = (@result.hp_damage - original_hp).to_f
    overkill_ratio =  [overkill_damage/original_hp,1].min
    $overkill_flag = true if overkill_ratio > 1.25
    if overkill_damage > 0
      if $bonus_xp
         $bonus_xp+=(self.exp * overkill_ratio).to_int
      else
         $bonus_xp =(self.exp * overkill_ratio).to_int
      end
    end
  end
end
 
class Game_Troop < Game_Unit
  
  alias :th_shared_exp_exp_total :exp_total
  def exp_total
    total = th_shared_exp_exp_total + $bonus_xp
    $bonus_xp=0
    return apply_exp_modifiers(total)
  end
  
  def apply_exp_modifiers(total)
    return total / $game_party.alive_members.size
  end
end

 

 

 

 

 

$imported = {} if $imported.nil?
$imported["YES-BattlePopup"] = true
 
#==============================================================================
# â–  BattleLuna
#==============================================================================
 
module BattleLuna
  module Addon
    
    BATTLE_POPUP = {
      # Basic Configuration.
      :basic_setting  =>  {
        :enable      =>  true,       # Set to false to disable popup.
        :state_popup =>  false,       # Set to false to disable state popup.
        :buff_popup  =>  false,       # Set to false to disable buff popup.
        :delay       =>  6,          # Delay between each popup.
        :no_delay    =>  [:critical, :drained, :weakpoint, :resistant, :absorbed],
      },
      
      # Configuration for words.
      :word_setting   =>  {
        :default    => "%s",      # SprintF for Default.
        :hp_dmg     => "%s",      # SprintF for HP damage.
        :hp_heal    => "%s",      # SprintF for HP healing.
        :mp_dmg     => "%s MP",    # SprintF for MP damage.
        :mp_heal    => "%s MP",    # SprintF for MP healing.
        :tp_dmg     => "",         # SprintF for MP damage.
        :tp_heal    => "",         # SprintF for MP healing.
        :drained    => "DRAIN",     # Text display for draining HP/MP.
        :critical   => "CRITICAL!", # Text display for critical hit.
        
        :overkill   => "OVERKILL!", # Text display for overkill.
        
        :missed     => "MISS",      # Text display for missed attack.
        :evaded     => "EVADE!",    # Text display for evaded attack.
        :nulled     => "NULL",      # Text display for nulled attack.
        :failed     => "FAILED",    # Text display for a failed attack.
        :add_state  => "+%s",       # SprintF for added states.
        :rem_state  => "-%s",       # SprintF for removed states.
        :dur_state  => "%s",        # SprintF for during states.
        :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
        :resistant  => "RESIST",    # Appears if foe is resistant to element.
        :immune     => "IMMUNE",    # Appears if foe is immune to element.
        :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
        :add_buff   => "%s",        # Appears when a positive buff is applied.
        :add_debuff => "%s",        # Appears when a negative buff is applied.
      },
      
      # Configuration for popup visual.
      :style_setting  =>  {
        # Type      => [Red, Green, Blue, Size, Bold, Italic, Font],
        :default    => [255,   255,  255,   16, false,  false, Font.default_name],
        :hp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :hp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :mp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :mp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :tp_dmg     => [255,   255,  255,   16, false,  false, Font.default_name],
        :tp_heal    => [255,   255,  255,   16, false,  false, Font.default_name],
        :drained    => [255,   255,  255,   16, false,  false, Font.default_name],
        :critical   => [255,   255,  255,   16, false,  false, Font.default_name],
        
        :overkill   => [255,   255,  255,   16, false,  false, Font.default_name],
        
        :missed     => [255,   255,  255,   16, false,  false, Font.default_name],
        :evaded     => [255,   255,  255,   16, false,  false, Font.default_name],
        :nulled     => [255,   255,  255,   16, false,  false, Font.default_name],
        :failed     => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :rem_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :dur_state  => [255,   255,  255,   16, false,  false, Font.default_name],
        :weakpoint  => [255,   255,  255,   16, false,  false, Font.default_name],
        :resistant  => [255,   255,  255,   16, false,  false, Font.default_name],
        :immune     => [255,   255,  255,   16, false,  false, Font.default_name],
        :absorbed   => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_buff   => [255,   255,  255,   16, false,  false, Font.default_name],
        :add_debuff => [255,   255,  255,   16, false,  false, Font.default_name],
        :lvup       => [255,   255,  255,   16, false,  false, Font.default_name],
      },
      
      # Configuration for popup effect.
      :effect_setting =>  {
        # Type      => [Effect sequence],
        :default    => [:up, :wait],
        :hp_dmg     => [:jump_1, :jump_2, :wait],
        :hp_heal    => [:jump_1, :jump_2, :wait],
        :mp_dmg     => [:jump_1, :jump_2, :wait],
        :mp_heal    => [:jump_1, :jump_2, :wait],
        :tp_dmg     => [:jump_1, :jump_2, :wait],
        :tp_heal    => [:jump_1, :jump_2, :wait],
        :drained    => [:affect, :up    , :wait],
        :critical   => [:affect, :up    , :wait],
        
        :overkill   => [:affect, :up    , :wait],
        
        :missed     => [:up    , :wait],
        :evaded     => [:up    , :wait],
        :nulled     => [:up    , :wait],
        :failed     => [:up    , :wait],
        :add_state  => [:affect, :up    , :wait],
        :rem_state  => [:affect, :up    , :wait],
        :dur_state  => [:affect, :up    , :wait],
        :weakpoint  => [:affect, :up    , :wait],
        :resistant  => [:affect, :up    , :wait],
        :immune     => [:up    , :wait],
        :absorbed   => [:affect, :up    , :wait],
        :add_buff   => [:affect, :up    , :wait],
        :add_debuff => [:affect, :up    , :wait],
        :lvup       => [:up, :wait],
      },
      
      :effect_setup   =>  {
        #:type   => [ZoomX, ZoomY, StartX, StartY, MoveX, MoveY, Gravt, Opacity, Dur, Random],
        :up      => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -1.0 , 0.0  , 255    , 32 , false ],
        :jump_1  => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -6.4 , 0.4  , 255    , 33 , false ],
        :jump_2  => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -3.2 , 0.2  , 255    , 33 , false ],
        :wait    => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , 0.0  , 0.0  , 0      , 20 , false ],
        :affect  => [1.0  , 1.0  , 0.0   , -32.0 , 0.0  , 0.0  , 0.0  , 255    , 1  , false ],
      },
      
    } # End BATTLE_POPUP.
    
  end # Addon
end # BattleLuna
 
#==============================================================================
# â–  Game_BattlerBase
#==============================================================================
 
class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :popups
  
  #--------------------------------------------------------------------------
  # new method: create_popup
  #--------------------------------------------------------------------------
  def create_popup(data, rule = :default)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:enable]
    @popups ||= []
    @popups.push([data, rule])
  end
  
  #--------------------------------------------------------------------------
  # new method: make_damage_popups
  #--------------------------------------------------------------------------
  def make_damage_popups(user)
    if @result.hp_drain != 0
      rule = :drained
      user.create_popup(["", nil], rule)
      rule = :hp_dmg  if @result.hp_drain < 0
      rule = :hp_heal if @result.hp_drain > 0
      value = @result.hp_drain.abs
      user.create_popup(["#{value}", nil], rule)
    end
    if @result.mp_drain != 0
      rule = :drained
      user.create_popup(["", nil], rule)
      rule = :mp_dmg  if @result.mp_drain < 0
      rule = :mp_heal if @result.mp_drain > 0
      value = @result.mp_drain.abs
      user.create_popup(["#{value}", nil], rule)
    end
    #---
    rule = :critical
    create_popup(["", nil], rule) if @result.critical
    if @result.hp_damage != 0
      rule = :hp_dmg  if @result.hp_damage > 0
      rule = :hp_heal if @result.hp_damage < 0
      value = @result.hp_damage.abs
      create_popup(["#{value}", nil], rule)
    end
    if @result.mp_damage != 0
      rule = :mp_dmg  if @result.mp_damage > 0
      rule = :mp_heal if @result.mp_damage < 0
      value = @result.mp_damage.abs
      create_popup(["#{value}", nil], rule)
    end
    if @result.tp_damage != 0
      rule = :tp_dmg  if @result.tp_damage > 0
      rule = :tp_heal if @result.tp_damage < 0
      value = @result.tp_damage.abs
      create_popup(["#{value}", nil], rule)
    end
    rule = :overkill
    create_popup(["", nil], rule) if $overkill_flag
  end
  
  #--------------------------------------------------------------------------
  # alias method: erase_state
  #--------------------------------------------------------------------------
  alias battle_luna_dp_erase_state erase_state unless $imported["YEA-BattleEngine"]
  def erase_state(state_id)
    make_state_popup(state_id, :rem_state) if @states.include?(state_id)
    if $imported["YEA-BattleEngine"]
      game_battlerbase_erase_state_abe(state_id)
    else
      battle_luna_dp_erase_state(state_id)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: make_during_state_popup
  #--------------------------------------------------------------------------
  def make_during_state_popup
    state_id = most_important_state_id
    return if state_id == 0
    make_state_popup(state_id, :dur_state)
  end
  
  #--------------------------------------------------------------------------
  # new method: most_important_state_id
  #--------------------------------------------------------------------------
  def most_important_state_id
    states.each {|state| return state.id unless state.message3.empty? }
    return 0
  end
  
  #--------------------------------------------------------------------------
  # new method: make_state_popup
  #--------------------------------------------------------------------------
  def make_state_popup(state_id, type)
    return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:state_popup]
    state = $data_states[state_id]
    return if state.icon_index == 0
    create_popup(["#{state.name}", state.icon_index], type)
  end
  
  #--------------------------------------------------------------------------
  # new method: make_miss_popups
  #--------------------------------------------------------------------------
  def make_miss_popups(user, item)
    return if dead?
    if @result.missed
      rule = :missed
      create_popup(["", nil], rule)
    end
    if @result.evaded
      rule = :evaded
      create_popup(["", nil], rule)
    end
    if @result.hit? && !@result.success
      rule = :failed
      create_popup(["", nil], rule)
    end
    if @result.hit? && item.damage.to_hp?
      if @result.hp_damage == 0 && @result.mp_damage == 0
        rule = :nulled
        create_popup(["", nil], rule)
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: make_rate_popup
  #--------------------------------------------------------------------------
  def make_rate_popup(rate)
    return if rate == 1.0
    if rate > 1.0
      rule = :weakpoint
    elsif rate == 0.0
      rule = :immune
    elsif rate < 0.0
      rule = :absorbed
    else
      rule = :resistant
    end
    create_popup(["", nil], rule)
  end
  
  #--------------------------------------------------------------------------
  # new method: make_buff_popup
  #--------------------------------------------------------------------------
  def make_buff_popup(param_id, positive = true)
    return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:buff_popup]
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless alive?
    name = Vocab::param(param_id)
    if positive
      rule = :add_buff
      buff_level = 1
    else
      rule = :add_debuff
      buff_level = -1
    end
    icon = buff_icon_index(buff_level, param_id)
    create_popup(["#{name}", icon], rule)
  end
 
end # Game_BattlerBase
 
#==============================================================================
# â–  Game_Battler
#==============================================================================
 
class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: on_battle_end
  #--------------------------------------------------------------------------
  alias battle_luna_dp_on_battle_end on_battle_end
  def on_battle_end
    battle_luna_dp_on_battle_end
    @popups ||= []
    @popups.clear
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_apply
  #--------------------------------------------------------------------------
  alias battle_luna_dp_item_apply item_apply unless $imported["YEA-BattleEngine"]
  def item_apply(user, item)
    if $imported["YEA-BattleEngine"]
      game_battler_item_apply_abe(user, item)
    else
      battle_luna_dp_item_apply(user, item)
    end    
    @result.restore_damage
    make_miss_popups(user, item)
    make_damage_popups(user)
    $overkill_value = -1
  end
  
  #--------------------------------------------------------------------------
  # alias method: make_damage_value
  #--------------------------------------------------------------------------
  alias battle_luna_dp_make_damage_value make_damage_value unless $imported["YEA-BattleEngine"]
  def make_damage_value(user, item)
    if $imported["YEA-BattleEngine"]
      game_battler_make_damage_value_abe(user, item)
    else
      battle_luna_dp_make_damage_value(user, item)
    end    
    rate = item_element_rate(user, item)
    make_rate_popup(rate)
  end
  
  #--------------------------------------------------------------------------
  # alias method: execute_damage
  #--------------------------------------------------------------------------
  alias battle_luna_dp_execute_damage execute_damage unless $imported["YEA-BattleEngine"]
  def execute_damage(user)
    if $imported["YEA-BattleEngine"]
      game_battler_execute_damage_abe(user)
    else
      battle_luna_dp_execute_damage(user)
    end    
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_recover_hp
  #--------------------------------------------------------------------------
  alias battle_luna_dp_item_effect_recover_hp item_effect_recover_hp unless $imported["YEA-BattleEngine"]
  def item_effect_recover_hp(user, item, effect)
    if $imported["YEA-BattleEngine"]
      game_battler_item_effect_recover_hp_abe(user, item, effect)
    else
      battle_luna_dp_item_effect_recover_hp(user, item, effect)
    end    
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_recover_mp
  #--------------------------------------------------------------------------
  alias battle_luna_item_effect_recover_mp item_effect_recover_mp unless $imported["YEA-BattleEngine"]
  def item_effect_recover_mp(user, item, effect)
    if $imported["YEA-BattleEngine"]
      game_battler_item_effect_recover_mp_abe(user, item, effect)
    else
      battle_luna_item_effect_recover_mp(user, item, effect)
    end  
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_gain_tp
  #--------------------------------------------------------------------------
  alias battle_luna_item_effect_gain_tp item_effect_gain_tp unless $imported["YEA-BattleEngine"]
  def item_effect_gain_tp(user, item, effect)
    if $imported["YEA-BattleEngine"]
      game_battler_item_effect_gain_tp_abe(user, item, effect)
    else
      battle_luna_item_effect_gain_tp(user, item, effect)
    end  
    #make_damage_popups(user)
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_new_state
  #--------------------------------------------------------------------------
  alias battle_luna_dp_add_new_state add_new_state unless $imported["YEA-BattleEngine"]
  def add_new_state(state_id)
    if $imported["YEA-BattleEngine"]
      game_battler_add_new_state_abe(state_id)
    else
      battle_luna_dp_add_new_state(state_id)
    end  
    make_state_popup(state_id, :add_state) if @states.include?(state_id)
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_buff
  #--------------------------------------------------------------------------
  alias battle_luna_dp_add_buff add_buff unless $imported["YEA-BattleEngine"]
  def add_buff(param_id, turns)
    make_buff_popup(param_id, true)
    if $imported["YEA-BattleEngine"]
      game_battler_add_buff_abe(param_id, turns)
    else
      battle_luna_dp_add_buff(param_id, turns)
    end  
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_debuff
  #--------------------------------------------------------------------------
  alias battle_luna_dp_add_debuff add_debuff unless $imported["YEA-BattleEngine"]
  def add_debuff(param_id, turns)
    make_buff_popup(param_id, false)
    if $imported["YEA-BattleEngine"]
      game_battler_add_debuff_abe(param_id, turns)
    else
      battle_luna_dp_add_debuff(param_id, turns)
    end  
  end
  
  #--------------------------------------------------------------------------
  # alias method: regenerate_all
  #--------------------------------------------------------------------------
  alias battle_luna_dp_regenerate_all regenerate_all unless $imported["YEA-BattleEngine"]
  def regenerate_all
    if $imported["YEA-BattleEngine"]
      game_battler_regenerate_all_abe
    else
      battle_luna_dp_regenerate_all
    end  
    return unless alive?
    make_damage_popups(self)
  end
    
end # Game_Battler
 
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
 
class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: screen_x
  #--------------------------------------------------------------------------
  unless Game_Actor.instance_methods.include?(:screen_x)
  def screen_x
    0
  end
  end
 
  #--------------------------------------------------------------------------
  # new method: screen_y
  #--------------------------------------------------------------------------
  unless Game_Actor.instance_methods.include?(:screen_y)
  def screen_y
    0
  end
  end
 
  #--------------------------------------------------------------------------
  # new method: screen_z
  #--------------------------------------------------------------------------
  unless Game_Actor.instance_methods.include?(:screen_z)
  def screen_y
    0
  end
  end
  
end # Game_Actor
 
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
 
class Sprite_Battler < Sprite_Base
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias battle_luna_dp_initialize initialize
  def initialize(viewport, battler = nil)
    battle_luna_dp_initialize(viewport, battler)
    @popups = []
    @popup_delay = 0
  end
  
  #--------------------------------------------------------------------------
  # alias method: setup_new_effect
  #--------------------------------------------------------------------------
  alias battle_luna_dp_setup_new_effect setup_new_effect
  def setup_new_effect
    battle_luna_dp_setup_new_effect
    setup_popups
  end
  
  #--------------------------------------------------------------------------
  # new method: setup_popups
  #--------------------------------------------------------------------------
  def setup_popups
    setting = BattleLuna::Addon::BATTLE_POPUP
    return unless @battler.use_sprite?
    @battler.popups ||= []
    @popup_delay -= 1
    return if @popup_delay > 0
    array = @battler.popups.shift
    return if array.nil?
    create_new_popup(array[0], array[1])
    return if @battler.popups.size == 0
    return if setting[:basic_setting][:no_delay].include?(array[1])
    @popup_delay = setting[:basic_setting][:delay]
  end
  
  #--------------------------------------------------------------------------
  # new method: create_new_popup
  #--------------------------------------------------------------------------
  def create_new_popup(data, rule)
    return unless @battler
    return unless SceneManager.scene.is_a?(Scene_Battle)
    viewport = self.viewport
    popup = Sprite_PopupLuna.new(viewport, @battler, data, rule)
    @popups.push(popup)
  end
  
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias battle_luna_dp_update update
  def update
    battle_luna_dp_update
    update_popups
  end
  
  #--------------------------------------------------------------------------
  # new method: update_popups
  #--------------------------------------------------------------------------
  def update_popups
    @popups.each { |popup| popup.update }
    @popups.each_with_index { |sprite, index|
      next unless sprite.disposed?
      @popups[index] = nil
    }
    @popups.compact!
  end
  
  #--------------------------------------------------------------------------
  # alias method: dispose
  #--------------------------------------------------------------------------
  alias battle_luna_dp_dispose dispose
  def dispose
    @popups.each { |popup| popup.dispose }
    @popups.clear
    battle_luna_dp_dispose
  end
  
end # Sprite_Battler
 
#==============================================================================
# â–  Sprite_PopupLuna
#==============================================================================
 
class Sprite_PopupLuna < Sprite
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(viewport, battler, data, rule)
    super(viewport)
    @data = data
    @rule = rule
    #---
    @style = rule
    @style = :default unless setting[:style_setting].has_key?(@style)
    @style = setting[:style_setting][@style]
    #---
    @effects = rule
    @effects = :default unless setting[:effect_setting].has_key?(@effects)
    @effects = setting[:effect_setting][@effects].dup
    #---
    @current_effect = nil
    @duration = 0
    @battler = battler
    #---
    start_popup
    start_effect
    update
  end
  
  #--------------------------------------------------------------------------
  # setting
  #--------------------------------------------------------------------------
  def setting
    BattleLuna::Addon::BATTLE_POPUP
  end
  
  #--------------------------------------------------------------------------
  # start_popup
  #--------------------------------------------------------------------------
  def start_popup
    self.bitmap = create_bitmap
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.ox = self.bitmap.width / 2
    self.oy = self.bitmap.height
    self.z = @battler.screen_z + 350
  end
  
  #--------------------------------------------------------------------------
  # create_bitmap
  #--------------------------------------------------------------------------
  def create_bitmap
    bw = Graphics.width
    bw = bw + 48 if @data[1]
    bh = @style[3] * 2
    bitmap = Bitmap.new(bw, bh)
    #---
    bitmap.font.color.set(@style[0], @style[1], @style[2])
    bitmap.font.size   = @style[3]
    bitmap.font.bold   = @style[4]
    bitmap.font.italic = @style[5]
    bitmap.font.name   = @style[6]
    
    
    
    
    bitmap.font.outline = true
    bitmap.font.out_color = Color.new(0, 0, 0, 256)
    
    
    
    
    #---
    dx = @data[1] ? 24 : 0; dy = 0
    text = setting[:word_setting][@rule]
    text = setting[:word_setting][:default] unless text
    text = sprintf(text, @data[0])
    bitmap.draw_text(dx, dy, bw - dx, bh, text, 1)
    #---
    text_width = bitmap.text_size(text).width
    if @data[1]
      icon_bitmap = Cache.system("Iconset")
      icon_index = @data[1].to_i
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      bitmap.blt((bw-text_width)/2-32, (bh - 24)/2, icon_bitmap, rect)
    end
    bitmap
  end
  
  #--------------------------------------------------------------------------
  # start_effect
  #--------------------------------------------------------------------------
  def start_effect
    @current_effect = @effects.shift
    return dispose if @current_effect.nil?
    effect = setting[:effect_setup][@current_effect]
    @duration = effect[8]
    #---
    @zoom_x_rate = (effect[0] - self.zoom_x) / @duration
    @zoom_y_rate = (effect[1] - self.zoom_y) / @duration
    #---
    @move_x = effect[4]
    @move_y = effect[5]
    if effect[9]
      @move_x = @move_x * rand(0)
      @move_x = rand(10) % 2 == 0 ? -@move_x : @move_x
    end
    #---
    @gravity = effect[6]
    #---
    @opacity_rate = (effect[7] - self.opacity) / @duration.to_f
    #---
    self.x += effect[2]
    self.y += effect[3]
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    update_zoom
    update_move
    update_opacity
    update_effect
  end
  
  #--------------------------------------------------------------------------
  # update_effect
  #--------------------------------------------------------------------------
  def update_effect
    @duration -= 1
    return if @duration > 0
    start_effect
  end
  
  #--------------------------------------------------------------------------
  # update_zoom
  #--------------------------------------------------------------------------
  def update_zoom
    self.zoom_x += @zoom_x_rate
    self.zoom_y += @zoom_y_rate
  end
  
  #--------------------------------------------------------------------------
  # update_move
  #--------------------------------------------------------------------------
  def update_move
    self.x += @move_x
    self.y += @move_y
    @move_y += @gravity
  end
  
  #--------------------------------------------------------------------------
  # update_opacity
  #--------------------------------------------------------------------------
  def update_opacity
    self.opacity += @opacity_rate
  end
  
  #--------------------------------------------------------------------------
  # dispose
  #--------------------------------------------------------------------------
  def dispose
    self.bitmap.dispose if self.bitmap
    super
  end
  
end # Sprite_PopupLuna
 
#==============================================================================
# â–  Window_BattleHelp
#==============================================================================
if $imported["YEA-BattleEngine"]
class Window_BattleHelp < Window_Help
  
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias battle_luna_yea_be_update update
  def update
    battle_luna_yea_be_update
    return unless $imported["YEA-BattleEngine"]
    return unless @actor_window && @enemy_window
    if !self.visible and @text != ""
      @text = ""
      return refresh
    end
    update_battler_name
  end
  
end # Window_BattleHelp
end
 
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
 
class Sprite_Battler < Sprite_Base
  
  #--------------------------------------------------------------------------
  # alias method: create_new_popup
  # Compatible with YEA - Battle Engine.
  #--------------------------------------------------------------------------
  if $imported["YEA-BattleEngine"] && !$imported["YES-BattlePopup"]
  alias battle_luna_yea_create_new_popup create_new_popup
  def create_new_popup(value, rules, flags)
    battle_luna_yea_create_new_popup(value, rules, flags)
    @popups.each { |popup| 
      popup.viewport = nil
      popup.z = @battler.screen_z + 1000
    }
  end
  end
  
end # Sprite_Battler
 
#==============================================================================
# â–  Game_ActionResult
#==============================================================================
 
class Game_ActionResult
  
  #--------------------------------------------------------------------------
  # alias method: clear_stored_damage
  #--------------------------------------------------------------------------
  alias battle_luna_yea_clear_stored_damage clear_stored_damage if $imported["YEA-BattleEngine"]
  def clear_stored_damage
    battle_luna_yea_clear_stored_damage unless $imported["YES-BattlePopup"]
  end
  
  #--------------------------------------------------------------------------
  # alias method: store_damage
  #--------------------------------------------------------------------------
  alias battle_luna_yea_store_damage store_damage if $imported["YEA-BattleEngine"]
  def store_damage
    battle_luna_yea_store_damage unless $imported["YES-BattlePopup"]
  end
  
  #--------------------------------------------------------------------------
  # alias method: restore_damage
  #--------------------------------------------------------------------------
  alias battle_luna_yea_restore_damage restore_damage if $imported["YEA-BattleEngine"]
  def restore_damage
    battle_luna_yea_restore_damage unless $imported["YES-BattlePopup"]
  end
  
end # Game_ActionResult
 

 

 

Edited by buddysievers
  • Like 1

Share this post


Link to post
Share on other sites

Ok i know what is wrong , in this line in the overkill script " overkill_ratio = [overkill_damage/original_hp,1].min "

 

change the 1 into a 2 so 

 

overkill_ratio = [overkill_damage/original_hp,2].min

  • Like 1

Share this post


Link to post
Share on other sites

So awsome! :D

Works like a charm now, was it intended to show the popup not only on the enemy and on the actor battler graphic too?

If not its not a problem i like that.

Thx soooooo much for your help! :)

 

Edit:

sgdsgydfm9ujl.png

I mean that second popup...

 

Edit2: You have definitely a place in my credits thats for sure!

Edited by buddysievers
  • Like 1

Share this post


Link to post
Share on other sites

It was an oversight but it might indicate some larger issues (nothing game-breaking tho) . I will look for a fix

 

Edit: use Ctrl+F to look for $overkill_value and change the whole line to
 

$overkill_flag=false
 

This should prevent some rare instances of overkill popup when not needed (not only ennemies).

But monsters will still be able to overkill ,if you don't want them to overkill add && self.actor to the linecreate_popup(["", nil], rule) if $overkill_flag

should be like this

create_popup(["", nil], rule) if $overkill_flag && self.actor

Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted