Request for small (hopefully) fix for Skill Equip add-on script

I am using Yami's Skill Equip (http://forums.rpgmakerweb.com/index.php?/topic/6727-skill-equip/) and Engr. Adiktuzmiko's Passive States Add-on (http://forums.rpgmakerweb.com/index.php?/topic/25936-yes-skill-equip-add-on-passive-states/).

Both scripts work fantastic! However, I have come across a small problem with, I think, the Passive States add-on script:

Spoiler
5R2PwTq.png
This happens when unequipping a passive skill that increases the character's max HP by 150%. It eventually goes away and reverts back to 200 HP, when it refreshes after twenty steps. However, in that time, it is possible to enter battle like this!

I have tested both scripts in a clean project and the issue still occurs.

All I'm looking for is, hopefully, a small fix that makes it so that when passive skills like this are unequipped, the effects of those skills are removed immediately.

If you need anymore information, just let me know.
You could maybe try this snippet

Code:
class Game_Actor    alias refresh_passive_states_adik_fix refresh_passive_states_adik  def refresh_passive_states_adik    refresh_passive_states_adik_fix    refresh  endend
Engr. Adiktuzmiko,

Getting a couple of errors.

The first (done in the clean project with only your script plus the original script):

Spoiler
Script 'Game_Actor' line 171: NoMethod Error occured.

undefined method `collect' for nil:NilClass
The second issue, in my other project, seems to be causing a compatibility issue with Fomar's Dual Wield Free Hands script (http://pastebin.com/raw.php?i=sewHVQZ7):

Spoiler
Script 'Fomar0153_Dual_Wield_Free_Hands' line 43: NoMethodError occured.

undefined method `each_with_index' for nil:NilClass
Thoughts? I hate to throw compatibility issues into the mix. Hope it isn't too much of a problem.
Those aren't from my script, mine doesn't have any collect method, nor does it use it...


PS: Make sure the snippet was below the add-on script btw.
The snippet was below the add-on script.

Just tested in another clean project. Using only the original Skill Equip script and Add-on script, making no configurations whatsoever to them. Testing those two alone works fine. Once I add the snippet below the add-on, I get that same error (the first one I listed).
Hmmm. weird... the line in question has something to with the equip variable of Game_Actor... It somehow takes the equips variable as nil or something.


When are you actually having the error?
As soon as I select "New Game" from the title screen.
Ah yes... It makes sense now, seems like I'm causing it to refresh before equips are even set up...

Try to change refresh to refresh unless @equips.nil?
Like this?

class Game_Actor alias refresh_passive_states_adik_fix refresh_passive_states_adik def refresh_passive_states_adik refresh_passive_states_adik_fix refresh unless @equips.nil endendI think I might be doing something wrong, because this returns this error (again, as soon as I hit "New Game"):

Script 'Refresh' line 6: NoMethodError occured.

undefined method `nil' for nil:NilClass
Uhm, I said .nil? You fprgot the question mark
Oops. Thought that was just part of the sentence.

Adding a question mark causes a SystemStack Error. stack level too deep. Again, right when I select New Game.
Hmmm...

Then delete refresh and just use these directly

hp = [[hp,mhp].min,0].max

mp = [[mp,mmp].min,0].max
Apologies for my continued ignorance (I really having no coding knowledge whatsoever), but what do you mean by use directly?

Like this?

class Game_Actor alias refresh_passive_states_adik_fix refresh_passive_states_adik def refresh_passive_states_adik refresh_passive_states_adik_fix hp = [[hp,mhp].min,0].max mp = [[mp,mmp].min,0].max endendUsing this snippet causes this error upon selecting New Game:

Script 'Game_Actor' line 336: TypeError occured.

no implicit conversion from nil to integer

Thanks for bearing with me, by the way.
Hmmmm... So its running even while actor isnt yet initialized fully... Hmmm...

Try to add this before the hp and mp lines

return if hp.nil?
Getting the exact same error 🙁
Which error?

Or you could try mhp.nil?
Which error?
Script 'Game_Actor' line 336: TypeError occured.

no implicit conversion from nil to integer

Here is the snippet I used, just to make sure I'm configuring it correctly:

class Game_Actor alias refresh_passive_states_adik_fix refresh_passive_states_adik def refresh_passive_states_adik refresh_passive_states_adik_fix return if hp.nil? hp = [[hp,mhp].min,0].max return if mp.nil? mp = [[mp,mmp].min,0].max endendUsing mhp.nil? yields that same error.
Nooooo... It should just be

return if mhp.nil?

hp = blah

mp =blah

What is that line in Game_Actor?
Nooooo... It should just be

return if mhp.nil?

hp = blah

mp =blah
Ah, I see. So like this, then:

class Game_Actor alias refresh_passive_states_adik_fix refresh_passive_states_adik def refresh_passive_states_adik refresh_passive_states_adik_fix return if mhp.nil? hp = [[hp,mhp].min,0].max mp = [[mp,mmp].min,0].max endendStill returns the same error.

This is line 336 in Game_Actor:

$data_classes[@class_id]
Then just do this, for quick fix, not really recommended but oh well

Code:
class Game_Actor    alias refresh_passive_states_adik_fix refresh_passive_states_adik  def refresh_passive_states_adik    refresh_passive_states_adik_fix    begin      hp = [[hp,mhp].min,0].max      mp = [[mp,mmp].min,0].max    rescue      p "Debug: it would error so we stopped it so the game can continue"    end   endend

Original thread: https://forums.rpgmakerweb.com/threads/request-for-small-hopefully-fix-for-skill-equip-add-on-script.45787/