RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[solved] how to fix this script.

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 71
Super Maker
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
Spoiler for:
Code: [Select]
#~
code removed
end
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.
Code: [Select]
#--------------------------------------------------------------------------
 
  # * 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
Code: [Select]
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.
« Last Edit: September 22, 2013, 03:25:11 PM by ShinGamix »
The Maker of Battle Dungeons!!


Spoiler for Big ass signature, bro:
AbsoluteIce I finally say your Sig.

Get by 20 attack Dogs...seriously. I got 20 attack Dogs.

*Your signature was raped changed for taking up too much room.
~Sincerely, a staff member. That is all you need to know. That, and I am no one to be trifled with.

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
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 :
 
Code: [Select]
  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

Code: [Select]
  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.

Code: [Select]
  #--------------------------------------------------------------------------
  # * Update Status Window Information
  #--------------------------------------------------------------------------
  def refresh_status
    @status_window.refresh
    @target_window.refresh
  end
« Last Edit: September 13, 2013, 06:36:53 AM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

**
Rep:
Level 71
Super Maker
wound up having to add a refesh to the window basic still but It worked!!!
The Maker of Battle Dungeons!!


Spoiler for Big ass signature, bro:
AbsoluteIce I finally say your Sig.

Get by 20 attack Dogs...seriously. I got 20 attack Dogs.

*Your signature was raped changed for taking up too much room.
~Sincerely, a staff member. That is all you need to know. That, and I am no one to be trifled with.