Issues with Napoleon's Minimap script - Disposed bitmat crash

Hey, I'm having trouble with Napoleon's Minimap script, notably from the 2nd part of it. It keeps giving me a disposed sprite/bitmap error either when I enter a new map, or reset the game (F12) and try to start again from the title screen.

Does anyone know how to fix this?

Oa0zkKr.png


The script itself is here:


This has been giving me a lot of trouble and its really frustrating. I know it's not just a script interaction either because when I try to reset on Napolean's original demo it happens there aswell.
F12 was never meant to work for scripts, so you need to not use it. See if the demo has the original issue with changing maps though.
F12 was never meant to work for scripts, so you need to not use it. See if the demo has the original issue with changing maps though.

Isn't it kind vital that a script doesn't break rpgmaker functions? I couldn't imagine a script working by crashing the interaction keys or whatnot.

Also I haven't witnessed stepping into other maps in the original demo. In my project, when you try to exit the initial location on a large map, an error pops up:

script nap 2/3 minimap line 540: RGSSError occurred. Disposed bitmap

After which the game closes.
Actually, no. F12 is a debug option and scripts do not have to support it for that reason. Plus F12 never worked right in the first place in ACE either, there's many issues with it in normal ACE with no scripts that has not ever been fixed officially.
Actually, no. F12 is a debug option and scripts do not have to support it for that reason. Plus F12 never worked right in the first place in ACE either, there's many issues with it in normal ACE with no scripts that has not ever been fixed officially.

Well as a debug goes, my players use F12 and experience this error, that's all just semantics.

More importantly, this error happens far more often outside of F12 during regular gameplay so is there any real solution to it? Anything in the script that could be adjusted to prevent this crash? How do Dispose Bitmap errors usually get resolved?
No clue. I've never worked with that. Start by making sure you start a new game and not load an old save game, and if that is done you may need to wait until someone else who has used the script comes by.

Though, posting a link to the demo would also help.
The error is saying that the bitmap the game is trying to change or update is disposed, so it can't do what it wants to do.
There are scripts to prevent using F12.
It keeps giving me a disposed sprite/bitmap error either when I enter a new map
This first error happens with line 211:
@player_sprite.x = @location.x + @location.width / 2 + 16 * @map_zoom_x

The message reading that the sprite is disposed means that there is no @player_sprite in existence. Now while the minimap was initialized when the game started, and that it ran a method called 'create_cursor', I am thinking that once you exit a map, the sprites for the minimap are being disposed and not recreated for the next map.

Now, the 'post_transfer' method at the very bottom of the script calls upon this: $minimap.refresh. That is, it executes the minimap's own 'refresh' method when the map is reloaded. Might one add $minimap.create_cursor just above it to create the player's cursor first???

This is me spitballing as I do not have RPGMaker VXAce. But the logic should be sound.

And in difference to my colleague, F12 is not a debug feature. If it was, the F12 key would not work outside test-play. It is a reset key. What some do not understand is that it resets the game and the scripts within the scripts.rxdata/rvdata/rvdata2 files and aliasing methods from 'parent' classes or modules is where the issue lay.

If I was to alias content within the BITMAP class itself, I would normally get a stacking error if I hit F12. If I was using RPGMaker XP and try to alias a method within the hidden sprite class, one referenced in Game_Battler, I would get an error if I hit F12. The hidden classes do not get erased from memory and you can cause a stack error. The trick is to make sure that you can only alias these methods... Once!

Now the chances are, you have issues with this section of code beginning on line 798:
Code:
module DataManager
  class << self
    alias nap_minimap_make_save_contents    make_save_contents
    alias nap_minimap_extract_save_contents extract_save_contents
  end

What you would do is to encapsulate the alias methods themselves with an if...end block, the value being tested only being created at the initial game.exe engine start.
Code:
module DataManager
  class << self
    if @f12_stack_fix_nap_minimap_datamanager.nil?
      alias nap_minimap_make_save_contents    make_save_contents
      alias nap_minimap_extract_save_contents extract_save_contents
      @f12_stack_fix_nap_minimap_datamanager = true
    end
  end

When the 'if' is first encountered, the value doesn't exist. So it runs the block and creates the value. THIS value stays in memory. Hit the F12 key, and it then sees that the value DOES exist and skips alias-ing the methods. Stack error prevented.

Original thread: https://forums.rpgmakerweb.com/threads/issues-with-napoleons-minimap-script-disposed-bitmat-crash.108811/