[SOLVED] Making a full enemy display window, Thank you ALL!

please refer to

-post 4 has all the details now.

Edit this is solved Now

Code:
#============================================================================#Took a week for this to be figured out#thanks to Ventwig#Version 1.E-OMFG! - Sept 05 2013#For RPGMaker VX Ace#Additional coding by ShinGamix#Refresh Battle Scene code addition by Calintz (then YF-Core Bugged!)#Debugging help by Shaz, Archeia Nessia, ShinGamix, Fomar123, and adiktuzmiko#Additional thanks to Tsukihime for always helping me!!#My mind is melting on this one. Shaz kept me going! Even when I wanted to give up!#Special thanks to Exhydra!!! You solved the stumper! You are awesome!#=====================================================================
It would help us to see the script that you're writing to find out where your problem is.


At first glance I would check if the value you display is MHP or HP and MMP or MP - mixing those up can cause such a behaviour.


Other than that it might be that the command for your graphical display doesn't work, and to check that we need to see what you're doing...
CHANGING the values should happen automatically. If you want to DISPLAY them as a gauge, I'd grab the Window_Base methods to draw the actor's HP and MP, copy them, and adjust them to refer to an enemy instead (it should just require changing any mention of actor to enemy, and passing in the enemy object instead of the actor object).
here is the sitiuation
 
(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 
Spoiler
code removed
So it would not refresh the Enemy Window numbers after attacks. I asked how and C told me to add the traget_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.
Code:
#--------------------------------------------------------------------------   # * 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)
 

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 wont refresh/update automaticlyand when a update method is added to the scene battle it crashes or errors out with hp nilclass or expected an interger or nilclass name.
wanted to bump

its been four days now and still broken
So if you comment out your changes, does the error still happen? Trying to figure out if it's something wrong with YEA, or something wrong with your script, or just the two of them together.


You could try putting your script mods before the YEA script (or after, if they're already before).
Well I took the YEA battle and core scripts

and then i decided to test it out right to put it into a new project and it still errors and it continues through the rtp scripts. 

Script 'Window_Base' line 442:NoMethodError Occured.

undefined method 'name' for nil:class

Why is it not having actor color or name???

edit- Thank you Shaz very much for trying to help me.
Are you saying the script YOU'RE working on is now in a project all on its own, or the YEA ones are? And apart from those, NO other script mods?


Do you want to load your whole project up somewhere so I can take a look? Would probably be faster for me to do that, than to get you to do heaps of tests.
Yes I took the Enemy window hud to a new project and added the script all by itself and it still messes up.

with no other modifications or add ons at all.
Did you read my response on RMRK, Shin? If not :

The problem is that the '$game_troop.alive_members' array is set to nil following the death of the last enemy. So, when the script tries refresh, nil is passed to 'draw_actor_*' and everything explodes.

def show_target_hp # The target(s) becomes 'nil' after the last one dies, 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
Code:
  def refresh    contents.clear      # This is a quick and lazy patch job, but the problem does go away.    show_target_hp unless $game_troop.alive_members[@target_id].nil?  end
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.

Code:
  #--------------------------------------------------------------------------  # * Update Status Window Information  #--------------------------------------------------------------------------  def refresh_status    @status_window.refresh    @target_window.refresh  end
The problem is that the '$game_troop.alive_members' array is set to nil following the death of the last enemy.
alive_members is not a property; when the last enemy dies it returns an empty array.
Ah, yes, sorry. I rushed through my explanation. The item passed to the 'draw_actor_*' methods is nil.
OH can't wait to try the fix!!

Do I add the update status window Information to the script I am working in or a RTP script like scene battle? or ???

-Found it. But that alone still didn't work had to add

removed for testing purposesto get the window to work. and it's finally refreshing the numbers!!! 

Got to do some testing to make sure everything is working okay but let's keep our finger's crossed!
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-making-a-full-enemy-display-window-thank-you-all.17896/