Yanfly Battle Engine - Element Icon Popup

Hi,
So Yanfly Battle Engine and Elemental Popup add-on was amazing and i love it!
But i wanted when my actor attack the enemy, the elemental icon will popup beside the damage number

e.g:
Instead of this:
101080-5d012274c8d31ffdc20bd3aa84972b1f.jpg

it become like this:
101079-d6dcd729ca2c9a8e5edf82d344647271.jpg

Anyone could help?

Yanfly Scripts:

Thanks in advance.
Bump?
Here:
Code:
# Plug-in script for Yanfly Engine Ace - Battle Engine Add-On: Elemental Popups
# script by Yanfly.
# Shows an extra icon next to the damage popup.
# ---------------------
# By vFoggy

module YEA
  module ELEMENT_POPUPS
    # icon index to be displayed next to the elemental damage popup
    COLOURS ={
    # ElementID => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font, Icon Index]
              3 => [   2.0,   1.0, 36, true,  false, 240,  60,  60, DEFAULT, 17],
              4 => [   2.0,   1.0, 36, true,  false, 100, 200, 246, DEFAULT, 18],
              5 => [   2.0,   1.0, 36, true,  false, 255, 255, 160, DEFAULT, 19],
              6 => [   2.0,   1.0, 36, true,  false,   0, 115, 180, DEFAULT, 20],
              7 => [   2.0,   1.0, 36, true,  false, 240, 135,  80, DEFAULT, 21],
              8 => [   2.0,   1.0, 36, true,  false,  60, 180,  75, DEFAULT, 22],
              9 => [   2.0,   1.0, 36, true,  false, 175, 210, 255, DEFAULT, 23],
             10 => [   2.0,   1.0, 36, true,  false, 110,  80, 130, DEFAULT, 24],
    } # Do not remove this.
  end
end


class Sprite_Popup < Sprite_Base
  alias fog_cpb create_popup_bitmap
  def create_popup_bitmap
    fog_cpb
    if @rules.include?("ELEMENT")
      element_id = @rules.split("_")[1].to_i
      icon_index = YEA::ELEMENT_POPUPS::COLOURS[element_id][9]
      iconset = $game_temp.iconset
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      c_width = bitmap.text_size(@value).width
      dx = 0; dy = 0; dw = 0
      dx += 24 if @flags.include?("state")
      dw += 24 if @flags.include?("state")
      bw = Graphics.width
      bw += 48 if @flags.include?("state")
      bh = Font.default_size * 3
      bitmap.blt(dx+(bw-c_width)/2-24, (bh - 24)/2, iconset, rect, 255)
    end
  end
end

The script looks for the icon index at the end of the element's list in the COLOURS hash.
You will have to add the icon indexes to all the elements.
Here:
Code:
# Plug-in script for Yanfly Engine Ace - Battle Engine Add-On: Elemental Popups
# script by Yanfly.
# Shows an extra icon next to the damage popup.
# ---------------------
# By vFoggy

module YEA
  module ELEMENT_POPUPS
    # icon index to be displayed next to the elemental damage popup
    COLOURS ={
    # ElementID => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font, Icon Index]
              3 => [   2.0,   1.0, 36, true,  false, 240,  60,  60, DEFAULT, 17],
              4 => [   2.0,   1.0, 36, true,  false, 100, 200, 246, DEFAULT, 18],
              5 => [   2.0,   1.0, 36, true,  false, 255, 255, 160, DEFAULT, 19],
              6 => [   2.0,   1.0, 36, true,  false,   0, 115, 180, DEFAULT, 20],
              7 => [   2.0,   1.0, 36, true,  false, 240, 135,  80, DEFAULT, 21],
              8 => [   2.0,   1.0, 36, true,  false,  60, 180,  75, DEFAULT, 22],
              9 => [   2.0,   1.0, 36, true,  false, 175, 210, 255, DEFAULT, 23],
             10 => [   2.0,   1.0, 36, true,  false, 110,  80, 130, DEFAULT, 24],
    } # Do not remove this.
  end
end


class Sprite_Popup < Sprite_Base
  alias fog_cpb create_popup_bitmap
  def create_popup_bitmap
    fog_cpb
    if @rules.include?("ELEMENT")
      element_id = @rules.split("_")[1].to_i
      icon_index = YEA::ELEMENT_POPUPS::COLOURS[element_id][9]
      iconset = $game_temp.iconset
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      c_width = bitmap.text_size(@value).width
      dx = 0; dy = 0; dw = 0
      dx += 24 if @flags.include?("state")
      dw += 24 if @flags.include?("state")
      bw = Graphics.width
      bw += 48 if @flags.include?("state")
      bh = Font.default_size * 3
      bitmap.blt(dx+(bw-c_width)/2-24, (bh - 24)/2, iconset, rect, 255)
    end
  end
end

The script looks for the icon index at the end of the element's list in the COLOURS hash.
You will have to add the icon indexes to all the elements.

It works perfectly vFoggy! Thank you so much!

This thread can be closed now.
Report your first post and let the mods know your request has been filled. Then they'll close it.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-battle-engine-element-icon-popup.112503/