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

Discussion in 'RGSS3 Script Requests' started by C.W. Plainview, Oct 12, 2015.

  1. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    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:

    [​IMG]
    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.
     
    #1
  2. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    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
     
    #2
  3. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    Engr. Adiktuzmiko,

    Getting a couple of errors.

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

    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):

    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.
     
    Last edited by a moderator: Oct 12, 2015
    #3
  4. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    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.
     
    Last edited by a moderator: Oct 12, 2015
    #4
  5. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    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).
     
    #5
  6. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    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?
     
    Last edited by a moderator: Oct 12, 2015
    #6
  7. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    As soon as I select "New Game" from the title screen.
     
    #7
  8. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    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?
     
    #8
  9. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    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
     
    Last edited by a moderator: Oct 14, 2015
    #9
  10. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    Uhm, I said .nil? You fprgot the question mark
     
    #10
  11. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    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.
     
    #11
  12. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    Hmmm...

    Then delete refresh and just use these directly

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

    mp = [[mp,mmp].min,0].max
     
    #12
  13. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    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.
     
    #13
  14. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    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?
     
    #14
  15. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    Getting the exact same error :(
     
    #15
  16. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    Which error?

    Or you could try mhp.nil?
     
    Last edited by a moderator: Oct 16, 2015
    #16
  17. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    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.
     
    #17
  18. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    Nooooo... It should just be

    return if mhp.nil?

    hp = blah

    mp =blah

    What is that line in Game_Actor?
     
    #18
  19. C.W. Plainview

    C.W. Plainview Veteran Veteran

    Messages:
    143
    Likes Received:
    45
    First Language:
    English
    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]
     
    #19
  20. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    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
     
    #20

Share This Page