- Joined
- Jun 23, 2014
- Messages
- 11
- Reaction score
- 0
- First Language
- English
- Primarily Uses
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
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


