RPG OTAKU
¡Hola! te invitamos a que te unas a RPG-OTAKU,
foro de desarrollo de videojuego con RPG MAKER y ademas de que tenemos del infaltable ocio.

Si deseas disfrutar del foro al 100%,
registrate, en poco minutos, sin confirmación de e-mail y totalmente gratis, si ya estas registrado, solamente conectate, y si lo que quieres es observar el foro como invitado, solo ignora este mensaje.
¡Eres libre de escoger lo que tu quieras!

Damage Popup

Ver el tema anterior Ver el tema siguiente Ir abajo

Damage Popup

Mensaje por Neozero el Sáb Sep 10, 2011 2:01 pm

Este es un script que añade a la batalla pore defecto del vx unos numeros que dicen el daño

Screens:



Script:
Código:

#==============================================================================
#    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 = 60
  #  DP_PLUS_X and DP_PLUS_Y control the position of the damage pop sprites,
  # with reference to the centre 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 = 28
  #  The _COLOR constants below control the colour of the damage popup in their
  # respective situations and are arrays holding the [red, green, blue] values
  # of the colour.
  # HPDAMAGE is the colour for when the target's HP is decreased
  DP_HPDAMAGE_COLOR = [255, 0, 0]
  # MPDAMAGE is the colour for when the target's MP is decreased
  DP_MPDAMAGE_COLOR = [255, 20, 180]
  # HPHEAL is the colour for when the target's HP is increased
  DP_HPHEAL_COLOR = [0, 255, 0]
  # MPHEAL is the colour for when the target's MP is increased
  DP_MPHEAL_COLOR = [0, 0, 255]
  # CRIT is the colour for when the target receives a critical hit
  DP_CRIT_COLOR = [255, 0, 0]
  #  MISS is the colour 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 = false
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  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
    sprite.bitmap = Bitmap.new (200, ModernAlgebra::DP_SIZE)
    # Get color of damage
    sprite.bitmap.font = Font.new (ModernAlgebra::DP_FONT, ModernAlgebra::DP_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? (String) ? damage : damage.abs.to_s
    sprite.bitmap.draw_text (0, 0, 200, ModernAlgebra::DP_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

Creditos:
Modern algebra

Post original:
[Tienes que estar registrado y conectado para ver este vínculo]


[Tienes que estar registrado y conectado para ver este vínculo]
avatar
Neozero
Moderador
Moderador

Mensajes : 366
Fecha de inscripción : 07/09/2011
Creditos : 644

Ver perfil de usuario

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.