RGSS3 - I can't find menu to map transition

Discussion in 'RGSSx Script Support' started by gudtavosky, Mar 3, 2018.

  1. gudtavosky

    gudtavosky Villager Member

    Messages:
    7
    Likes Received:
    0
    First Language:
    br portuguese
    when you open the menu, the screen blurs and the menu opens with an opacity animation, and when you close, it softly vanishes

    where can I find that transition from the menu to the map when you press cancel?

    I ask this because I'm making a custom menu where each character has its own status window, instead of a single status window for everyone, and in the Scene_Menu script, I changed the @status_window variable to an array of windows. It works great, until I close the menu, where all the status windows have no fade out animation before completely vanishing. If I set any of the windows to any variable with any name, it suddenly works again, but I can't figure out why. I think I need to change the transition script to fade out arrays too, but I can't find it anywhere in the whole game code
     

    Attached Files:

    #1
  2. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,453
    Likes Received:
    5,043
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    This is a common mistake to anyone who start to script custom scene and handle windows in array or any form that is not window object. You have to know that every windows (in RGSS3, former RGSS version didn't do this) disposed automatically when the scene changes.

    The method in question is on scene base line 101
    Code:
      def dispose_all_windows
        instance_variables.each do |varname|
          ivar = instance_variable_get(varname)
          ivar.dispose if ivar.is_a?(Window)
        end
      end
    
    This particular method checks every instance variable that is a window, then disposes it when the scene changes. If you handle your windows in an array, it will miss the check. To solve this problem you have to manually dispose your windows through the terminate methods

    For example, your window is stored in an array named @status_array
    Code:
      alias edited_menu terminate
      def terminate
        edited_menu
        @status_array.each {|window| window.dispose}
      end
    
    Also worth noting:
    Disposing windows and sprites is important, because once the object loses its pointer (e.g, change the scene), it won't be disposed automatically, leaves the game bloated with unused memory slot (idk the actual technical term), which later leads to "RGSS stopped working" error.
     
    #2
  3. gudtavosky

    gudtavosky Villager Member

    Messages:
    7
    Likes Received:
    0
    First Language:
    br portuguese
    Thank you so much! Thats exactly what I was looking for. And I do have other memory leaks in other projects, where I use scenes to show pictures (had the same problem with the non fading transition), but now Im going to fix all that!

    Thanks again for the great answer!
     
    #3

Share This Page