{RESOLVED} Status Window & Parameter Mods

Started by blazinhandle, January 18, 2008, 07:27:58 pm

Previous topic - Next topic

blazinhandle

I'm trying to draw icons for parameters so I modified the Window_Base "draw_actor_parameter" method to this:

Spoiler: ShowHide
  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.

Fantasist

January 19, 2008, 10:58:21 am #1 Last Edit: January 19, 2008, 12:05:24 pm by Fantasist
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
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




blazinhandle

Thanks. I was able to fix it with your help.

Blizzard

January 20, 2008, 08:10:57 am #3 Last Edit: January 20, 2008, 08:12:18 am by Blizzard
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".
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Fantasist

Oh, *makes mental note about equipment IDs*
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




blazinhandle

Oh Blizz, you cast a shadow over the whole community. Thanks man.