Jump to content
jammythebirb

Issue with Fhizban's Party HUD

Recommended Posts

I'm using Fhizban's party HUD script in my game to display the player's HP in the corner of the screen, and up until now it's been working perfectly. A couple of times in the game I've swapped which party member is active, but it's only now I've reached a section with two party members at once I'm getting problems. When I try to remove one of them, I get the following error:

Script 'FHIZBAN'S PARTY HUD' line 58: NoMethodError

occurred.

undefined method 'hp' for nil:NilClass

I feel pretty sure it has something to do with having more than one party member, but I'm no scripter, so I don't really know how to solve this. If I can't find a way to make it work and allow me to remove party members, the only way I'm going to be able to make this game is to not have party members, which will make the lategame much less interesting. 
 

Here's what seems to be the relevant part of the script, I would really appreciate any help with this!


 def fhiz_hud
    i = 0
    while i < @party_size
      @actor = $game_party.members
      @actor_hp = @actor.hp
      @actor_mp = @actor.mp
      i += 1
    end
    i = 0
    while i < @party_size
      @actor = $game_party.members
      @x = OFFSET_X + (WIN_WIDTH + OFFSET_X)*i + (PADDING*i)
      @y = OFFSET_Y
      if DRAW_FACE
        if @actor_hp > 0
          draw_actor_face(@actor, @x, @y, true)
        else
          draw_actor_face(@actor, @x, @y, true)
        end
      end
      if DRAW_NAME
          draw_actor_name(@actor, @x, @y)
      end
      if DRAW_STATES
        draw_actor_icons(@actor, @x, @y+(WIN_HEIGHT-line_height*4), WIN_WIDTH)
      end
      if DRAW_HP
        draw_actor_hp(@actor, @x, @y+(WIN_HEIGHT-line_height*3), WIN_WIDTH)
      end
      if DRAW_MP
        draw_actor_mp(@actor, @x, @y+(WIN_HEIGHT-line_height*2), WIN_WIDTH)
      end
      i += 1
    end
  end
  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×