lukecovack
Member
HI I am trying to make my own hp/sp on screen bar outside of battle and using Yeyinde's Basic HUD Tutorial I (after putting in my own x, y cords get this error
Script 'Window_Base' line 230: NoMethodError occurred
Undefined method 'hp' for 0:fixnum
this is the line and the line after
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
and this is the script I am using to make the hud
please help me in learning how to make a HUD!!
khmp: Code in code tags please. You can delete this line when you see it.
Script 'Window_Base' line 230: NoMethodError occurred
Undefined method 'hp' for 0:fixnum
this is the line and the line after
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
and this is the script I am using to make the hud
Code:
class Window_YourHUD < Window_Base
def initialize
super(0, 0, 100 , 100)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
reset_variables
return if !@actor
draw_actor_hp(0, x, y)
draw_actor_sp(0, x, y)
end
def reset_variables
@actor = $game_party.actors[0]
@old_hp = @actor ? @actor.hp : 0
@old_maxhp = @actor ? @actor.maxhp : 0
@old_sp = @actor ? @actor.sp : 0
@old_maxsp = @actor ? @actor.maxsp : 0
end
def update
super
refresh if (@actor = $game_party.actors[0] or
@old_hp = @actor ? @actor.hp : 0 or
@old_maxhp = @actor ? @actor.maxhp : 0 or
@old_sp = @actor ? @actor.sp : 0 or
@old_maxsp = @actor ? @actor.maxsp : 0)
end
end
class Scene_Map
alias yourhud_main main
alias yourhud_update update
def main
@yourhud = Window_YourHUD.new
yourhud_main
@yourhud.dispose
end
def update
@yourhud.update
yourhud_update
end
end
please help me in learning how to make a HUD!!
khmp: Code in code tags please. You can delete this line when you see it.