[VXAce]Bug with Adjust Limits

Hello, I found a bug with the script "Adjust limits" from Yanfly.

I tested in a new project with this script only. When I save my game and reload after, there are random items (often armours) in my inventory that I had not before. Can you help me to fix it, please ?

I made a demo, just save and load to see the problem : http://www.mediafire.com/download/qd1ydbngz2d17q7/Bug.exe

The script is here : https://yanflychannel.wordpress.com/rmvxa/core-scripts/adjust-limits/

In the comments, there is someone who explains the same problem :

Spoiler
This script as posted, is broken. I’ve disabled everything but it and the core script, and every time I save a game, when I load it the character has a crap load of weapons which they didn’t have prior to save — and some of those weapons are completely blank.. no name, no stats, no nothing. I suppose they’re taken from blank spots in my weapon database which I’ve saved for expansion use later.

I’d love to be able to change some of the limits on items, but as it stands, this script simply doesn’t work for me at all. It corrupts any save file that it’s used on.

Actually, I take that back. It corrupts any LOADING file. When I get rid of this script, everything loads fine. The items which magically appear when this is in the script list disappear. They’re not in the save, they appear when this is an active script in the LOAD GAME.
Can you please upload the demo project in zipped form, so we can open it in RM?

I did a small test run with a new project, only adding the script without anything else. I could save and load fine without gaining random items.
Try:

Spoiler
Code:
class Scene_Load < Scene_File  def perform_level_check    $game_party.members.each { |member| member.check_levels }  end  end
You can open the project with RM, the project is just compiled.

I did a small test run with a new project, only adding the script without anything else. I could save and load fine without gaining random items.
Strange. Try to change the max values in database. I know that random items change when I change these values.
DoubleX, should I replace this :

Spoiler
class Scene_Load < Scene_File

#--------------------------------------------------------------------------
# alias method: on_load_success
#--------------------------------------------------------------------------
alias on_load_success_al on_load_success
def on_load_success
on_load_success_al
perform_level_check
end

#--------------------------------------------------------------------------
# new method: perform_level_check
#--------------------------------------------------------------------------
def perform_level_check
for i in 1..$data_actors.size
next if $game_actors.nil?
$game_actors.check_levels
end
end

end # Scene_Load
 

by this :

 

Spoiler
class Scene_Load < Scene_File

def perform_level_check
$game_party.members.each { |member| member.check_levels }
end

end
Treat mine as a separate snippet, or just replace this:

Spoiler
#--------------------------------------------------------------------------# new method: perform_level_check#-------------------------------------------------------------------------- def perform_level_check for i in 1..$data_actors.size next if $game_actors.nil? $game_actors.check_levels end end
With mine 🙂
Yes, I replace with yours. It works well. Thanks for you help. I warn you if I have other problems with this script.
This might produce strange results with actors not currently in the party, though, as they won't get their check_levels method called when loading.

You could add this snippet instead:

class Game_Actors   def check_levels    @data.each{|actor| actor.check_levels if !actor.nil?}  end end
and replace the call with:

Code:
$game_actors.check_levels
Treat mine as a separate snippet, or just replace this:

Spoiler
#--------------------------------------------------------------------------# new method: perform_level_check#-------------------------------------------------------------------------- def perform_level_check for i in 1..$data_actors.size next if $game_actors.nil? $game_actors.check_levels end end
With mine 🙂
You have no idea how much this has helped me, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/vxace-bug-with-adjust-limits.39261/