Yanfly Battle Engine - Element Icon Popup

Status
Not open for further replies.

rad.noire

Veteran
Veteran
Joined
Mar 19, 2017
Messages
34
Reaction score
6
First Language
English
Primarily Uses
RMVXA
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:

it become like this:

Anyone could help?

Yanfly Scripts:

Thanks in advance.
 

Attachments

Last edited:

vFoggy

Veteran
Veteran
Joined
Nov 3, 2012
Messages
71
Reaction score
31
Primarily Uses
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.
 

rad.noire

Veteran
Veteran
Joined
Mar 19, 2017
Messages
34
Reaction score
6
First Language
English
Primarily Uses
RMVXA
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Report your first post and let the mods know your request has been filled. Then they'll close it.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,567
Latest member
sashalag
Top