Save File gets corrupted after certain script

I may have it working for you. Sent you a message with the fix.
Fortunately a small change seems to work.
adding in a few lines before Game_Pet and changing one line in Game_Pet
Ruby:
# added in this class
class Sprite_PetBattler < Sprite_Battler
  attr_accessor :battler
end

class Game_Pet < Game_Actor
  def sprite
    @sprite = Sprite_PetBattler.new(nil) if @sprite.nil? # changed to use new class
    @sprite
  end
end
This unfortunately does not work for me. Not sure why it doesn't, though
It's very weird. I'm testing it again, this time I copied the knuckles joining event to the start map for testing.
It wasn't working then I tried a code change and tested again then it worked. then tried the old save game and it didn't work. I tried the new save game and it didn't work. It seems to be something that is not saved in the data or the issue is random or the data is changed and cannot be saved. Need to test more.
Actually it seems to be ok if you start a new game, but when you load a game it doesn't work anymore.
I tried starting a new game, and it still didn't work unfortunately.
Try this as an addon below summon script
Ruby:
class Game_Pet < Game_Actor
  def restore_actor
    return false unless @former_actor
    $game_party.restore_actor(self, former_actor)
    $game_party.remove_actor(self)
    return true
  end
end
Try this as an addon below summon script
Ruby:
class Game_Pet < Game_Actor
  def restore_actor
    return false unless @former_actor
    $game_party.restore_actor(self, former_actor)
    $game_party.remove_actor(self)
    return true
  end
end
This code works when I start a new game, but when I reload the game and try again, it still corrupts the save file.
If you decide that the script just isn't worth the hassle, here is a link to a tutorial on doing transformations without using scripts.
If you decide that the script just isn't worth the hassle, here is a link to a tutorial on doing transformations without using scripts.
I ended up finding an alternative method with a different script regardless, but thank you!!

Original thread: https://forums.rpgmakerweb.com/threads/save-file-gets-corrupted-after-certain-script.148364/