[RESOLVED]Damage Pop help

Started by Spoofus, March 27, 2012, 07:53:46 am

Previous topic - Next topic

Spoofus

March 27, 2012, 07:53:46 am Last Edit: March 29, 2012, 05:04:07 am by Spoofus
I am wanting to edit where the damage shown pops up when hit by attack and spells,also the size of it.I have looked through all the default scripts and I can't seem to find it.I would personally like to have within the CBS script itself but if it would be easier to edit one of the default scripts that would be fine too

the default damage done shown is a little to big for my CBS that Ii have done(DBS with a huge face-lift).

if I can get this done then my battle system is pretty much complete, and i can share it with you all. :)

my cbs script:
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# CBS Layout by Nortos made for Spoofus
# Heavily Edited by Spoofus
# Version: 1.0b
# Date 3/1/08
#
# Compatibility:
#
# May not be compatible with SDK's not tested though.
# your old savegames. Can cause incompatibilty issues with following scripts
# and/or systems:
# - exotic CBS-es
# Features:
# Enemy and Ally Health bars
# CBS Facesets
# Nifty nice layout
#
# Instructions:
# For a charecters faceset you must write their faces in the picture folder
# but with _Face at the end of the actors name, remember to put the two health
# bar scripts in this into your project as well
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Credits and thanks:
# Credits go to Nortos for this main CBS script
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# ** class Window_Base
#------------------------------------------------------------------------------
#  Face functions, the charecters face is just their name than _face e.g Arshes_Face
#==============================================================================
class Window_Base < Window
 def face
   face = RPG::Cache.picture("")
 end  
 
 def draw_face(actor,x,y)
   face = RPG::Cache.picture(actor.character_name + "_face") rescue face
   fw = face.width
   fh = face.height
   src_rect = Rect.new(0, 0, fw, fh)
   self.contents.blt(x , y - fh, face, src_rect)    
 end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================

class Window_BattleStatus < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(450, 190, 190, 290)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.size = 14
   self.back_opacity = $game_system.window_opacity #**
   self.contents.font.bold = true
   self.contents.font.name = "Tahoma"
   @level_up_flags = [false, false, false, false]
   refresh
 end
 #--------------------------------------------------------------------------
 # * Dispose
 #--------------------------------------------------------------------------
 def dispose
   super
 end
 #--------------------------------------------------------------------------
 # * Set Level Up Flag
 #     actor_index : actor index
 #--------------------------------------------------------------------------
 def level_up(actor_index)
   @level_up_flags[actor_index] = true
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   @item_max = $game_party.actors.size
   for i in 0...$game_party.actors.size
     actor = $game_party.actors[i]
     actor_y = i * 82 + 0
     draw_actor_name(actor, 72, actor_y + 4)
     draw_actor_hp(actor, 45, actor_y + 20, 100)
     draw_actor_sp(actor, 61, actor_y + 45, 100)
     draw_face(actor, 40, actor_y + 33)
     if @level_up_flags[i]
       self.contents.font.color = normal_color
       self.contents.draw_text(0, actor_y + 50, 120, 32, "Lvl.Up!")
     else
       draw_actor_state(actor, 20, actor_y + 4)
     end
   end
 end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class determines the x and y coordinates of each of the battlers
#  to change them yourself should be easy enough
#==============================================================================
class Game_Actor
 def screen_x
   x_positions = [485, 485, 485, 485]
 if self.index != nil
     return x_positions[self.index]
   else
     return 0
   end
 end
#  #--------------------------------------------------------------------------
 def screen_y
   y_positions = [279, 362, 445, 445]
   if self.index != nil
     return y_positions[self.index]
   else
     return 0
   end
 end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class is all the kinks I had to change to the battle scene
#  I edited the windows mainly a bit
#==============================================================================

class Scene_Battle
 def main
   # Initialize each kind of temporary battle data
   $game_temp.in_battle = true
   $game_temp.battle_turn = 0
   $game_temp.battle_event_flags.clear
   $game_temp.battle_abort = false
   $game_temp.battle_main_phase = false
   $game_temp.battleback_name = $game_map.battleback_name
   $game_temp.forcing_battler = nil
   # Initialize battle event interpreter
   $game_system.battle_interpreter.setup(nil, 0)
   # Prepare troop
   @troop_id = $game_temp.battle_troop_id
   $game_troop.setup(@troop_id)
   # Make actor command window
   s1 = $data_system.words.attack
   s2 = $data_system.words.skill
   s3 = $data_system.words.guard
   s4 = $data_system.words.item
   @actor_command_window = Window_Command_New.new(140, [s1, s2, s3, s4])
   @actor_command_window.x = 310
   @actor_command_window.y = 320
   @actor_command_window.active = false
   @actor_command_window.visible = true
   @actor_command_window.index = -1
   # Make other windows
   @party_command_window = Window_PartyCommand.new
   @help_window = Window_Help.new
   @help_window.back_opacity = $game_system.window_opacity #**
   @party_command_window.back_opacity = $game_system.window_opacity #**
   @help_window.visible = false
   @status_window = Window_BattleStatus.new
   @message_window = Window_Message.new
   # Make sprite set
   @spriteset = Spriteset_Battle.new
   # Initialize wait count
   @wait_count = 0
   # Execute transition
   if $data_system.battle_transition == ""
     Graphics.transition(20)
   else
     Graphics.transition(40, "Graphics/Transitions/" +
       $data_system.battle_transition)
   end
   # Start pre-battle phase
   start_phase1
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Refresh map
   $game_map.refresh
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @actor_command_window.dispose
   @party_command_window.dispose
   @help_window.dispose
   @status_window.dispose
   @message_window.dispose
   if @skill_window != nil
     @skill_window.dispose
   end
   if @item_window != nil
     @item_window.dispose
   end
   if @result_window != nil
     @result_window.dispose
   end
   # Dispose of sprite set
   @spriteset.dispose
   # If switching to title screen
   if $scene.is_a?(Scene_Title)
     # Fade out screen
     Graphics.transition
     Graphics.freeze
   end
   # If switching from battle test to any screen other than game over screen
   if $BTEST and not $scene.is_a?(Scene_Gameover)
     $scene = nil
   end
 end
 
 #--------------------------------------------------------------------------
 # * Frame Update (actor command phase : skill selection)
 #--------------------------------------------------------------------------
 def update_phase3_skill_select
   # Make skill window visible
   @actor_command_window.index = 0
   @actor_command_window.visible = true
   @skill_window.visible = true
   @skill_window.z = 255
   # Update skill window
   @skill_window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # End skill selection
     end_skill_select
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Get currently selected data on the skill window
     @skill = @skill_window.skill
     # If it can't be used
     if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
       # Play buzzer SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # Play decision SE
     $game_system.se_play($data_system.decision_se)
     # Set action
     @active_battler.current_action.skill_id = @skill.id
     # Make skill window invisible
     @skill_window.visible = false
     # If effect scope is single enemy
     if @skill.scope == 1
       # Start enemy selection
       start_enemy_select
     # If effect scope is single ally
     elsif @skill.scope == 3 or @skill.scope == 5
       # Start actor selection
       start_actor_select
     # If effect scope is not single
     else
       # End skill selection
       end_skill_select
       # Go to command input for next actor
       phase3_next_actor
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (actor command phase : item selection)
 #--------------------------------------------------------------------------
 def update_phase3_item_select
   # Make item window visible
   @actor_command_window.index = 0
   @actor_command_window.visible = true
   @item_window.visible = true
   @item_window.z = 255
   # Update item window
   @item_window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # End item selection
     end_item_select
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Get currently selected data on the item window
     @item = @item_window.item
     # If it can't be used
     unless $game_party.item_can_use?(@item.id)
       # Play buzzer SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # Play decision SE
     $game_system.se_play($data_system.decision_se)
     # Set action
     @active_battler.current_action.item_id = @item.id
     # Make item window invisible
     @item_window.visible = false
     # If effect scope is single enemy
     if @item.scope == 1
       # Start enemy selection
       start_enemy_select
     # If effect scope is single ally
     elsif @item.scope == 3 or @item.scope == 5
       # Start actor selection
       start_actor_select
     # If effect scope is not single
     else
       # End item selection
       end_item_select
       # Go to command input for next actor
       phase3_next_actor
     end
     return
   end
 end
 
 def start_phase2
   # Shift to phase 2
   @phase = 2
   # Set actor to non-selecting
   @actor_index = -1
   @active_battler = nil
   # Enable party command window
   @party_command_window.active = true
   @party_command_window.visible = true
   @party_command_window.index = 0
   # Disable actor command window
   @actor_command_window.active = false
   @actor_command_window.visible = true
   @actor_command_window.index = -1
   # Clear main phase flag
   $game_temp.battle_main_phase = false
   # Clear all party member actions
   $game_party.clear_actions
   # If impossible to input command
   unless $game_party.inputable?
     # Start main phase
     start_phase4
   end
 end
 
 def update_phase3_basic_command
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     @actor_command_window.index = 0
     # Go to command input for previous actor
     phase3_prior_actor
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Branch by actor command window cursor position
     case @actor_command_window.index
     when 0  # attack
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Set action
       @active_battler.current_action.kind = 0
       @active_battler.current_action.basic = 0
       # Start enemy selection
       start_enemy_select
     when 1  # skill
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Set action
       @active_battler.current_action.kind = 1
       # Start skill selection
       start_skill_select
     when 2  # guard
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Set action
       @active_battler.current_action.kind = 0
       @active_battler.current_action.basic = 1
       # Go to command input for next actor
       phase3_next_actor
     when 3  # item
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Set action
       @active_battler.current_action.kind = 2
       # Start item selection
       start_item_select
     end
     return
   end
 end
 
   def phase3_setup_command_window
   # Disable party command window
   @party_command_window.active = false
   @party_command_window.visible = true
   #@party_command_window.opacity = 160
   @party_command_window.index = -2
   # Enable actor command window
   @actor_command_window.active = true
   @actor_command_window.visible = true
   # Set actor command window position
   # Set index to 0
   @actor_command_window.index = 0
 end
end

#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================

class Window_Command_New < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     width    : window width
 #     commands : command text string array
 #--------------------------------------------------------------------------
 def initialize(width, commands)
   # Compute window height from command quantity
   super(0, 0, width, commands.size * 32 + 32)
   @item_max = commands.size
   @commands = commands
   self.back_opacity = $game_system.window_opacity #**
   self.contents = Bitmap.new(width - 32, @item_max * 32)
   refresh
   self.index = 0
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   for i in 0...@item_max
     draw_item(i, normal_color)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #     color : text color
 #--------------------------------------------------------------------------
 def draw_item(index, color)
   self.contents.font.color = color
   rect = Rect.new(3, 32 * index, self.contents.width - 6, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[index])
 end
 #--------------------------------------------------------------------------
 # * Disable Item
 #     index : item number
 #--------------------------------------------------------------------------
 def disable_item(index)
   draw_item(index, disabled_color)
 end
end


My Blog site I am working on: http://spoofus.weebly.com/

G_G

module RPG
  class Sprite < ::Sprite
    def damage(value, critical)
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new(self.viewport)
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80
      @_damage_sprite.oy = 20
      @_damage_sprite.x = self.x
      @_damage_sprite.y = self.y - self.oy / 2
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
  end
end


Its not in the list of defaults scripts, but its in the Help file. Just edit this script and place it in a new one above main.

Spoofus

Awsome man, after editing it I got it perfect.

to show you.
Spoiler: ShowHide


My Blog site I am working on: http://spoofus.weebly.com/