I'm trying to draw icons for parameters so I modified the Window_Base "draw_actor_parameter" method to this:
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk # ATTACK
parameter_value = actor.atk
parameter_icon = $data_weapons[@actor.weapon_id].name
when 1
parameter_name = $data_system.words.pdef # VIGOR
parameter_value = actor.pdef
parameter_icon = $data_armors[@actor.armor3_id].name unless @actor.armor3_id != nil
when 2
parameter_name = $data_system.words.int # JUDGMENT
parameter_value = actor.int
parameter_icon = $data_armors[@actor.armor4_id].name unless @actor.armor4_id != nil
when 3
parameter_name = $data_system.words.mdef # SAVVY
parameter_value = actor.mdef
parameter_icon = $data_armors[@actor.armor1_id].name unless @actor.armor1_id != nil
when 4
parameter_name = $data_system.words.str # STRENGTH
parameter_value = actor.str
parameter_icon = $data_armors[@actor.armor4_id].name unless @actor.armor4_id != nil
when 5
parameter_name = $data_system.words.dex # EXECUTION
parameter_value = actor.dex
parameter_icon = $data_armors[@actor.armor2_id].name unless @actor.armor2_id != nil
when 6
parameter_name = $data_system.words.agi # PARRY
parameter_value = actor.agi
parameter_icon = $data_armors[@actor.armor4_id].name unless @actor.armor4_id != nil
end
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(parameter_icon) unless parameter_icon == nil
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) unless parameter_icon == nil
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
But the icon are not showing up.
I guess it's a typo on your part. You used "@actor" instead of just "actor".
Next, this:
$data_armors[actor.armor3_id].icon_name unless actor.armor3_id != nil
shoud be this:
$data_armors[actor.armor3_id].icon_name unless actor.armor3_id == nil
Nice idea btw, I'm thinking of adding this in my game :)
EDIT: Oh, forgot to mention the most important thing, it's not
$data_armors[actor.armor3_id].name
its
$data_armors[actor.armor3_id].icon_name
Thanks. I was able to fix it with your help.
Actually it should be "unless actor.armor3_id == 0", because an armor ID is never nil, but 0 if no armor is equipped and then the armor would be nil. So, either that one this here: "unless $data_armors[armor3_id] == nil".
You know "unless" = "if !" or "if not". Best you read my e-book, I gave a couple of examples in the chapter called "The trick with unless".
Oh, *makes mental note about equipment IDs*
Oh Blizz, you cast a shadow over the whole community. Thanks man.