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

Hmm... So is that snippet supposed to fix the refresh problem?

Unfortunately, it doesn't seem to be working. Unequipping the passive skill still leaves me with 300/200 HP until the character refreshes after 20 steps.
Then it means it errors... Because what it does is skip the hp setting if it errors... Hmmm...

Try to change all hp and mp to self.hp and self.mp and see if it works. Seems to be just hp and mp doesnt work...
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 begin self.hp = [[self.hp,mhp].min,0].max self.mp = [[self.mp,mmp].min,0].max rescue p "Debug: it would error so we stopped it so the game can continue" end endendWould I change mhp and mmp as well? Either way, this produces a SystemStack Error (stack level too deep) when I select New Game.
have you been using that class definition since the start of the debugging?

tha severe the link of actor from battler.

that's why your mmp, mhp, hp, mp isn't working.

try change that to

class Game_Actor < Game_Battler
It actually doesn't make a difference Meow, the inheritance needs to be defined only once.


@CW - it's most likely due to having duplicates of that method or it's producing an infinite loop... Hmmm...
@Engr.:  Np, just curious since this tread keeps going on. Don't really mean to snatch it away from you.

But it doesn't seems to be a problem on your script but Yami's.

@C.W.: Put this below Yami's script, then put Engr.'s script below the fix.

class Scene_Skill < Scene_ItemBase  alias meow_on_skill_equip_fix on_skill_equip_ok  def on_skill_equip_ok    meow_on_skill_equip_fix    @actor.refresh    @status_window.refresh  endend

I might as well add that to Yami's tread too.
@MeowFace, thanks so much! It works beautifully.

@Engr. Adiktuzmiki, sorry for wasting your time, I had no idea it was a problem with Yami's script. My sincerest apologies.
You're welcome!
I didn't realize it too as its been ages since I actually read that script. XD
Sorry for reviving this topic, but I've encountered a couple of new problems with the two original scripts in question (irrelevant of the fix provided by MeowFace). Would be a waste I think to start an entire new topic, especially when we already have this one dedicated to these scripts.

Both problems are related to actors collapsing in battle, and they have been tested in clean projects with only Yami's Skill Equip script and Engr. Adiktuzmiko's add-on. So, the errors can be pinned down to either of these two scripts. I don't know which one for sure, and given the mistake I made last time, I'm going to personally avoid jumping to conclusions again.

The first problem: regardless of whether or not a passive skill is equipped, the collapse SE is muted upon an actor falling in battle.

The second (more serious) problem: when a passive skill is equipped on an actor, and that same actor collapses in battle, the game crashes to a SystemStackError (stack level too deep).

Given my lack of scripting knowledge, it is impossible for me to determine why this error is occuring and how to fix it. Hopefully you guys can help again! If you need any more info, please ask.
That's a known issue in Engr's script. It's written in the script intro itself.

Edit:

Did a test with both script and yes, it's confirmed to be an error from Engr's script. Or rather, a bad loop in between Engr and the Game's default main script.

Reason for the crash is, every time an actor die, the main engine script runs the clear state method. And if the actor is dead, and you try to add a state, it will run the clear states again.

So in Engr's script, whenever it runs a clear state method, it tries to add state back to the dead actor. But in the mean time, the main script run the clear state method again during state adding. This caused an infinite loop that result in Stack overflow.

Edit again:

Here's the hot fix for the script. It disables states clearing on death to avoid the infinite loop. Any existing states will stay upon death, but they won't update until the actor is revived. Means if you have a state with 5 turns, it will stay on 5 until the actor is alive again.

I'll leave the full fix for Engr when he/she notices this post. You might want to post in that script's tread to remind him of the bug too.

Replace everything below

#==============================================================================

# ¥ Editting anything past this point may potentially result in causing

# computer damage, incontinence, explosion of user's head, coma, death, and/or

# halitosis so edit at your own risk.

#==============================================================================

 

with this:

Code:
class Game_Actor < Game_Battler  attr_accessor :passive_states_adik  alias equip_skill_states_adik equip_skill  def equip_skill(index,id)    equip_skill_states_adik(index,id)    refresh_passive_states_adik  end  def refresh_passive_states_adik    return if @equip_skills.nil?    @passive_states_adik = [] if @passive_states_adik.nil?    @passive_states_adik.each do |id|      self.erase_state(id)      @passive_states_adik.delete(id)    end    @result.clear    @equip_skills.each do |sk|      next if sk == 0      if ADIK::EQUIP_SKILL_STATES::LIST.keys.include?(sk)        id=ADIK::EQUIP_SKILL_STATES::LIST[sk]        self.add_state(id)        @passive_states_adik.push(id)      end    end  end  def clear_states    super    refresh_passive_states_adik  end  def die    @hp = 0  endend
MeowFace, thanks for the help once again.

Well, that edit seemed to do the trick. However, I have encountered another issue. I do not know if this related to the fix or not.

Spoiler
jmvU2IO.png
As you can see, after collapsing and reviving, the death state lingers. Even though Eric is revived to full health, he is still treated as dead. It eventually goes away after a number of steps, so I am thinking this is similar to refresh problem I was having before? I have the original snippet you provided installed, but it makes no difference. Not sure.

EDIT: Okay, so I was using a Recover All event to revive Eric. In addition to that, I decided to include a Change State event that removes death and that seems to fix the issue. If this would cause no other problems, then this fix works for me. Thoughts?
As you can see, after collapsing and reviving, the death state lingers. Even though Eric is revived to full health, he is still treated as dead. It eventually goes away after a number of steps, so I am thinking this is similar to refresh problem I was having before? I have the original snippet you provided installed, but it makes no difference. Not sure.

EDIT: Okay, so I was using a Recover All event to revive Eric. In addition to that, I decided to include a Change State event that removes death and that seems to fix the issue. If this would cause no other problems, then this fix works for me. Thoughts?
You are welcome.

And yes, the fix only works for removing the death state. Actors are automatically revived when we remove the death state (to 1 hp), so a skill that remove death state + recover hp is needed.

And oh, recover all will not work on dead actors i think. That's why it's not working, will need to remove the death state manually then use recover all.

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