here is the sitiuation
Fist of RPG Maker VX Ace/RGSS3
(I honestly think there is a better way to do the refresh but I don't know what it is atm.)
Everything Was fine.
This is the script I added
So it would not refresh the Enemy Window numbers after attacks. I asked how and Cal told me to add the @target_window.refresh to the scene battle
Everything was fine until I had to add to the scene battle RTP Script to refresh the enemy display window then every time the battle finishes
The Scene Battle line added.
#--------------------------------------------------------------------------
# * Update Frame (Basic)
#--------------------------------------------------------------------------
def update_basic
super
$game_timer.update
$game_troop.update
@spriteset.update
update_info_viewport
update_message_open
@target_window.refresh #<<<<<< Added
end
It's working
but when all the enemies die I get an error (on battle exit)
Quote
Script 'YEA - Core Engine' line 693: NoMethodError occurred.
undefined method for 'hp' for nil:NilClass
This is line 693 btw
def hp_color(actor)
return knockout_color if actor.hp == 0 #Line 693<<<<--Here
return crisis_color if actor.hp < actor.mhp * YEA::CORE::HP_CRISIS
return normal_color
end
That's what I know and what I have done.
Why the heck would hp be NilClass error?
Without the scene battle line no errors happen but the enemy display window doesn't refresh when attacked or upon death.
(I pray I can get it fixed)
Edit- After two days of working on it and trying to fix it and getting a few ppl to look at it. I think it's gonna need to be re-wrote. Something is wrong with it, It won't refresh/update automatically and when a update method is added to the scene battle it crashes or errors out with hp nilclass or expected an integer or nilclass name.
So I took the script to a new project and it still goes haywire
saying window base (rtp script) error
nil for name error
and error for actor text color also
Basically it's a mess and I apologize.
I can get it to work but I can't get the battle to finish without some kind of error.
Hmm ... as a stop-gap measure, perhaps try the following :
EDIT - Oop, nevermind. That did not work. I'll take a look ...
The NilClass is probably coming from the fact that the 'actor' parameter you are passing to 'hp_color' is nil because the refresh is happening after the battle is over, and actor data has been erased. Probably. I really have not taken an in-depth look, so that is my guess.
EDIT II - Hmm, alright, I think I found the issue :
def show_target_hp
# Target becomes 'nil' after dying because you are using 'alive_members'.
# So, you need to protect against 'draw_actor*' being called at all.
@target = $game_troop.alive_members[@target_id]
draw_actor_name(@target,0,0,width = 100)
draw_actor_hp(@target,100,0,width=90)
draw_actor_mp(@target,200,0,width=90)
draw_actor_icons(@target,300,0, width = 96)
end
def refresh
contents.clear
# This is a patch job, and causes the problem to go away.
show_target_hp unless $game_troop.alive_members[@target_id].nil?
end
EDIT III - And don't use 'update_basic' to refresh the target window. Use 'refresh_status'. Also, remember to properly 'dispose' of and close your window after the battle is over.
#--------------------------------------------------------------------------
# * Update Status Window Information
#--------------------------------------------------------------------------
def refresh_status
@status_window.refresh
@target_window.refresh
end