[VX ACE] [YANFLY] ENEMY ANIMATIONS

Posts

Pages: 1
I'm using glorious Yanfly's Battle Engine script because I love the way it has party portraits set up along the bottom of the battle screen and how the enemy attacks are animated on those portraits. I do have a problem however, in that the animated enemy attacks appear behind the portraits themselves, making them kind of difficult to see, and that I can't figure out how to get the portrait sprite itself to Flash as though it were a Target for the purposes of the animation used. I would enormously appreciate it if someone who knows jack squat about Ruby had some kind of modification in mind to accomplish this.
Alright, to be a little more specific, here's where the game defines the actor's location for the battle animation to play

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # overwrite method: perform_damage_effect
  #--------------------------------------------------------------------------
  def perform_damage_effect
    $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
    @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
    Sound.play_actor_damage
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: use_sprite?
  #--------------------------------------------------------------------------
  def use_sprite?; return true; end
    
  #--------------------------------------------------------------------------
  # new method: screen_x
  #--------------------------------------------------------------------------
  def screen_x
    return 0 unless SceneManager.scene_is?(Scene_Battle)
    status_window = SceneManager.scene.status_window
    return 0 if status_window.nil?
    item_rect_width = (status_window.width-24) / $game_party.max_battle_members
    ext = SceneManager.scene.info_viewport.ox
    rect = SceneManager.scene.status_window.item_rect(self.index)
    constant = 128 + 12
    return constant + rect.x + item_rect_width / 2 - ext
  end
  
  #--------------------------------------------------------------------------
  # new method: screen_y
  #--------------------------------------------------------------------------
  def screen_y
    return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
    return Graphics.height - 120 if SceneManager.scene.status_window.nil?
    return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  end
  
  #--------------------------------------------------------------------------
  # new method: screen_z
  #--------------------------------------------------------------------------
  def screen_z; return 100; end
  
  #--------------------------------------------------------------------------
  # new method: sprite
  #--------------------------------------------------------------------------
  def sprite
    index = $game_party.battle_members.index(self)
    return SceneManager.scene.spriteset.actor_sprites[index]
  end
  
  #--------------------------------------------------------------------------
  # new method: draw_mp?
  #--------------------------------------------------------------------------
  def draw_mp?
    return true unless draw_tp?
    for skill in skills
      next unless added_skill_types.include?(skill.stype_id)
      return true if skill.mp_cost > 0
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # new method: draw_tp?
  #--------------------------------------------------------------------------
  def draw_tp?
    return false unless $data_system.opt_display_tp
    for skill in skills
      next unless added_skill_types.include?(skill.stype_id)
      return true if skill.tp_cost > 0
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # alias method: input
  #--------------------------------------------------------------------------
  alias game_actor_input_abe input
  def input
    if @actions.nil?
      make_actions
      @action_input_index = 0
    end
    if @actions[@action_input_index].nil?
      @actions[@action_input_index] = Game_Action.new(self)
    end
    return game_actor_input_abe
  end
  
end # Game_Actor

#==============================================================================
# ■ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
  
  #--------------------------------------------------------------------------
  # overwrite method: perform_damage_effect
  #--------------------------------------------------------------------------
  def perform_damage_effect
    @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
    Sound.play_enemy_damage
  end
  
  #--------------------------------------------------------------------------
  # new methods: attack_animation_id
  #--------------------------------------------------------------------------
  def atk_animation_id1; return enemy.atk_animation_id1; end
  def atk_animation_id2; return enemy.atk_animation_id2; end
  
  #--------------------------------------------------------------------------
  # new method: sprite
  #--------------------------------------------------------------------------
  def sprite
    return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  end
  
end # Game_Enemy


But changing the z value doesn't seem to do anything, and I can't for the life of me find any numericals to go with the enemy animation flags.
I don't see it in here but this is probably a case of viewports. Sprites can belong to a viewport which gives the sprites the Z-value of said viewport. The sprite's Z value is only in relation to sprites that belong to the same viewport. So for example...

Picture A has Z of 1 in viewport 1
Picture B has Z of 2 in viewport 1
Picture C has Z of 3 in viewport 1
Picture D has Z of 1 in viewport 2
Picture E has Z of 5 in viewport 2

Viewport 1 has Z of 2
Viewport 2 has Z of 5

D & E will always appear on top of A, B, & C since viewport 2's Z is higher than 1's even if D's Z is lower than B & C. In relation to each other, C will appear on top of B which appears on top of A. E will appear on top of D.


In this case I'd bet that animations and faces are drawn to different viewports and the faces's viewport's Z is higher than the animations. If you can see what viewports they have and play with their Z's this might resolve the issue.
These are all the instances of viewport mentions that weren't listed under either popup or info windows, which aren't a problem. Can anything in here be fiddled with or am I going to have to plunge into game_battler?

#--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias sprite_battler_initialize_abe initialize
  def initialize(viewport, battler = nil)
    sprite_battler_initialize_abe(viewport, battler)
    @popups = []
    @popup_flags = []
  end

  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(viewport, battler, value, rules, flags)
    super(viewport)
    @value = value
    @rules = rules
    @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
    @fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
    @full = YEA::BATTLE::POPUP_SETTINGS[:full]
    @flags = flags
    @battler = battler
    create_popup_bitmap
  end
#--------------------------------------------------------------------------
  # create_popup_bitmap
  #--------------------------------------------------------------------------
  def create_popup_bitmap
    rules_array = YEA::BATTLE::POPUP_RULES[@rules]
    bw = Graphics.width
    bw += 48 if @flags.include?("state")
    bh = Font.default_size * 3
    bitmap = Bitmap.new(bw, bh)
    bitmap.font.name = rules_array[8]
    size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
    bitmap.font.size = size
    bitmap.font.bold = rules_array[3]
    bitmap.font.italic = rules_array[4]
    if flags.include?("critical")
      crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
      bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
    else
      bitmap.font.out_color.set(0, 0, 0, 255)
    end
    dx = 0; dy = 0; dw = 0
    dx += 24 if @flags.include?("state")
    dw += 24 if @flags.include?("state")
    if @flags.include?("state") || @flags.include?("buff")
      c_width = bitmap.text_size(@value).width
      icon_bitmap = $game_temp.iconset
      icon_index = flag_state_icon
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
    end
    bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
    bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
    self.bitmap = bitmap
    self.x = @battler.screen_x
    self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
    self.x -= SceneManager.scene.spriteset.viewport1.ox
    self.y = @battler.screen_y - @battler.sprite.oy/2
    self.y -= @battler.sprite.oy/2 if @battler.actor?
    self.y -= SceneManager.scene.spriteset.viewport1.oy
    self.ox = bw/2; self.oy = bh/2
    self.zoom_x = self.zoom_y = rules_array[0]
    if @flags.include?("no zoom")
      self.zoom_x = self.zoom_y = rules_array[1]
    end
    @target_zoom = rules_array[1]
    @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
    self.z = 500
  end


  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :actor_sprites
  attr_accessor :enemy_sprites
  attr_accessor :viewport1
  attr_accessor :viewportPopups
  
  #--------------------------------------------------------------------------
  # alias method: create_viewports
  #--------------------------------------------------------------------------
  alias spriteset_battle_create_viewports_abe create_viewports
  def create_viewports
    spriteset_battle_create_viewports_abe
    @viewportPopups = Viewport.new
    @viewportPopups.z = 200
  end
  
  #--------------------------------------------------------------------------
  # alias method: dispose_viewports
  #--------------------------------------------------------------------------
  alias spriteset_battle_dispose_viewports_abe dispose_viewports
  def dispose_viewports
    spriteset_battle_dispose_viewports_abe
    @viewportPopups.dispose
  end
  
  #--------------------------------------------------------------------------
  # alias method: update_viewports
  #--------------------------------------------------------------------------
  alias spriteset_battle_update_viewports_abe update_viewports
  def update_viewports
    spriteset_battle_update_viewports_abe
    @viewportPopups.update
  end
  
end # Spriteset_Battle

 #--------------------------------------------------------------------------
  # overwrite method: perform_damage_effect
  #--------------------------------------------------------------------------
  def perform_damage_effect
    $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
    @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
    Sound.play_actor_damage
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: use_sprite?
  #--------------------------------------------------------------------------
  def use_sprite?; return true; end
    
  #--------------------------------------------------------------------------
  # new method: screen_x
  #--------------------------------------------------------------------------
  def screen_x
    return 0 unless SceneManager.scene_is?(Scene_Battle)
    status_window = SceneManager.scene.status_window
    return 0 if status_window.nil?
    item_rect_width = (status_window.width-24) / $game_party.max_battle_members
    ext = SceneManager.scene.info_viewport.ox
    rect = SceneManager.scene.status_window.item_rect(self.index)
    constant = 128 + 12
    return constant + rect.x + item_rect_width / 2 - ext
  end
There's
@viewportPopups.z = 200

Which seems like a value to play with. Also next time can you include what class each method belongs to? It's hard/impossible to tell what some of these are really doing without that context.
Pages: 1