Draw Icon on specific actor face

I created an actor with a skill that consumes variables.
I plan to display the number of variables with Icon.
Then I added this in the YEA - Battle Engine script
1811.JPG

113.JPG

But this makes the variable displayed on all faces of the actors.
I just want to show certain actors.
rein.JPG

Can someone help me?
You want to call draw_spells only if actor X is in the party, so you should do something like this:
Ruby:
draw_spells(actor, rect.x + 60, rect.y, rect.width - 8) if actor.id == 1 #or whatever ID it should be

You can shorten your draw_spells code by using a loop:
Ruby:
def draw_spells(actor, dx, dy, dw = 72)
  $game_variables[1].times do |i|
    draw_icon(113, dx + 24 * i, dy)
  end
end
This takes the value of variable 1 (referred to as 'i' in the code) and uses it to judge the spacing required.

If you're not actually using the width or actor arguments, you shouldn't use them. You can shorten your code like so:
Ruby:
draw_spells(rect.x + 60, rect.y) if actor.id == 1

def draw_spells(dx, dy)
  $game_variables[1].times { |i| draw_icon(113, dx + 24 * i, dy) }
  # this is just another way of writing a loop; it does exactly the same as the other one
  # with 'do' and 'end'
end
You want to call draw_spells only if actor X is in the party, so you should do something like this:
Ruby:
draw_spells(actor, rect.x + 60, rect.y, rect.width - 8) if actor.id == 1 #or whatever ID it should be

You can shorten your draw_spells code by using a loop:
Ruby:
def draw_spells(actor, dx, dy, dw = 72)
  $game_variables[1].times do |i|
    draw_icon(113, dx + 24 * i, dy)
  end
end
This takes the value of variable 1 (referred to as 'i' in the code) and uses it to judge the spacing required.

If you're not actually using the width or actor arguments, you shouldn't use them. You can shorten your code like so:
Ruby:
draw_spells(rect.x + 60, rect.y) if actor.id == 1

def draw_spells(dx, dy)
  $game_variables[1].times { |i| draw_icon(113, dx + 24 * i, dy) }
  # this is just another way of writing a loop; it does exactly the same as the other one
  # with 'do' and 'end'
end
Alright I get it now. Now I know how to use loops. thank you for teaching me. it is very useful!

Original thread: https://forums.rpgmakerweb.com/threads/draw-icon-on-specific-actor-face.119434/