The game crashes after a battle is over.

Discussion in 'RPG Maker VX Ace' started by CarlosDavilla, Sep 25, 2019.

Thread Status:
Not open for further replies.
  1. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    WHOAHELLOTHERE

    It's been a while guys.

    So, I have a new problem, sadly.

    I was testing one of the troops in my debug/test room (I don't use the Battle Test in the Database) and the fight went alright, but problem is, everytime when the game's is about to put me back on the test map, it CTD's to this error.

    [​IMG]
    It seems that there's something to do with the BGM or something, because it always crashes to the line 77 of the BattleManager, which says this:

    Code:
        @map_bgm.replay unless $BTEST
    I sincerely don't know what it could be. Can you guys help me out?
    Thanks in advance.
     
    #1
  2. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,504
    Likes Received:
    5,111
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    It shouldnt throw an error on its own. Do you have additional third party script?
     
    #2
  3. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Indeed I have, Theo. Way too much of them, actually.

    [​IMG]

    Come to think of it, I really need to organize this a little better.
    No wonder these things happen.
     
    #3
  4. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,504
    Likes Received:
    5,111
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    Ctrl + shift + f in script editor
    Type "def replay" see if anything comes up
     
    #4
  5. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Well, it did found something on Game_System.

    Code:
      #--------------------------------------------------------------------------
      # * Resume BGM
      #--------------------------------------------------------------------------
      def replay_bgm
        @saved_bgm.replay if @saved_bgm
      end
    end
    What should I do?
     
    Last edited: Sep 26, 2019
    #5
  6. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    12,417
    Likes Received:
    12,650
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    Another note: Victor and Yanfly scripts rarely work together, as they used completely different coding systems. You may want to try removing every Victor or every Yanfly script and seeing what happens.
     
    #6
  7. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,766
    Likes Received:
    385
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    For the scripts he has there, I don't see any problems with them being together. Normally it's the battle engines. But he is not using victor animated battlers. And the errors that I encountered was nothing like what he is getting. Should be something different.
    Not to worry, I have a lot more. But it's interesting because you seem to have scripts I never hear of before. I'd like to get those.
    Would you be willing to upload your scripts.rvdata2 file or send me a pm with the file? None of them are paid for before using. Although $D13 is paid for.
    What Theo was trying to suggest is that you would have found that entry in one of your addon scripts, not the default built in ones.
    But if that is not the case, then I would suggest using a script disabler or making a copy of your project and then gradually delete a few scripts at a time to find when the problem stops. (make a backup, delete some scripts, test play, repeat) Thus pointing you to the potential issue.
    You could also try searching for
    @map_bgm
     
    #7
  8. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Sure thing, pal. Since you helped me so much in these last few months (even giving me a script that I was looking for and couldn't find), I guess the least I can do to thank you is that. I will upload it and send you via PM.

    Well, I tried to find something that was out of the original scripts, but I didn't find anything.
    I just found those who already were in the BattleManager.

    [​IMG]

    I tried to play around with line 30 by turning the @map_bgm to true, but got no different results.

    Well, that's what I try to avoid bringing the issue here. It saves a lot of time.
    But if nothing can be done, that's just unfortunate. I really didn't want to come to this, since doing this takes some time, but I guess I'll have to. :/
     
    #8
  9. Shaz

    Shaz Veteran Veteran

    Messages:
    37,960
    Likes Received:
    11,615
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Do a search for the backtrace script. When the game crashes, it will provide you with the method hierarchy so you can see what's called what, and where it fell over. This will be of more use than just the one line in the one script.
     
    #9
  10. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    @CarlosDavilla Here is the backtrack script that I used in RPG Maker VX Ace :

    Code:
    #~ #==============================================================================
    #~ # ** Main
    #~ #------------------------------------------------------------------------------
    #~ #  This processing is executed after module and class definition is finished.
    #~ #==============================================================================
    
    begin
      rgss_main do
        begin
          SceneManager.run
        rescue RGSSReset
          rgss_stop
        end
      end
    rescue SystemExit
      exit
    rescue Exception => error
      scripts_name = load_data('Data/Scripts.rvdata2')
      scripts_name.collect! {|script|  script[1]  }
      backtrace = []
      error.backtrace.each_with_index {|line,i|
        if line =~ /{(.*)}(.*)/
          backtrace << (scripts_name[$1.to_i] + $2)
        elsif line.start_with?(':1:')
          break
        else
          backtrace << line
        end
      }
      error_line = backtrace.first
      backtrace[0] = ''
      print error_line, ": ", error.message, " (#{error.class})", backtrace.join("\n\tfrom "), "\n"
      raise  error.class, "Error ocurred, check the debug console for more information.", [error.backtrace.first]
    end
    
    Comment out 'rgss_main { SceneManager.run }' in 'Main Process' > 'Main', and create a new entry ('Main - Backtrace', or whatever you want). Be sure to enable the 'Game' > 'Show Console' option in the editor. Once that is enabled and the error occurs, you can simply highlight the text in the console and press right-click to copy.

    If you are unable to highlight or copy the text in the console, click in the icon in the upper left of the console window to open a menu and select 'Defaults'. Then check-mark 'Quick Edit Mode' and press 'Ok'.
     
    #10
  11. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Thanks for the help Ossra. I used your backtrack script and the results after testing it are those:

    Code:
    (eval):1:in `replay': wrong number of arguments (1 for 0) (ArgumentError)
            from BattleManager:77:in `replay_bgm_and_bgs'
            from Yanfly Engine Ace - Victory Aftermath :386:in `process_victory'
            from BattleManager:194:in `judge_win_loss'
            from Scene_Battle:520:in `process_event'
            from Scene_Battle:47:in `update'
            from Gump's LevelUP Messenger:410:in `update'
            from Scene_Base:14:in `main'
            from SceneManager:23:in `run'
            from Sixth's Global Setting Addon:446:in `run'
            from Main - Backtrace:10:in `block in <main>'
    Well, that's all weird to me, honestly.
    I didn't know that Sixth's Global Settings and Gump's LevelUP Messenger had something to do with any of this, since I'm using these scripts for some time now and they worked fine together before this error.
     
    Last edited: Sep 26, 2019
    #11
  12. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    @CarlosDavilla Well, "Sixth's Global Setting Addon" and "Gump's LevelUP Messenger" might not have anything to do with the problem. What is displayed in the console when an error occurs is the 'stack', the path that eventually led up to the error. Now that we have that path, we have a lot more information and can begin to poke around and find the cause of the error. Welcome to the fun of having a lot of add-on scripts.

    The message 'wrong number of arguments (1 for 0)' means that a function is being passed information that it does not require.

    Code:
    def self.dog
    end
    
    def self.cat(color)
    end
    The function 'dog' does not take any 'arguments' (the variable in parenthesis beside the name of the function) while the function 'cat' takes the 'argument' named 'color'. What is happening here is that somewhere there is a piece of code that is attempting to pass one 'argument' to 'dog', which requires zero. Hence, '1 for 0'.

    After skimming through 'Victory Aftermath', it does not appear that the script is doing anything awful. Nothing in the 'LevelUP Messenger' or 'Global Setting Addon' scripts seem to have anything to do with the issue either. Perhaps do a search through the scripts for 'replay_bgm_and_bgs' or more simply 'replay'. You can ignore results that are default, core code (unless you have edited the core code).
     
    #12
  13. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Thanks for the info, Ossra. It was really useful.

    I already tried out to search for these terms and found nothing out of the default scripts.
    Actually, the only one I found outside the default scripts with lines like these were the Victory Aftermath that you said it was ok.

    [​IMG]

    I tried to remove the script to test if it was the issue, but it still crashes after battle even so.
     
    #13
  14. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    @CarlosDavilla Hmm ... comment out line 77 and 78 in the BattleManager core code and do another test just to see if anything else explodes.
     
    #14
  15. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Well, it worked. The battles now end with no problems.
    Thing is, now the map's BGM doesn't play anymore after the battle ends. It's just silence.
    Not even making a event to play a BGM works.
     
    #15
  16. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    @CarlosDavilla Yeah, I wanted to see if there was any more code that might be causing errors. With those two lines commented out, the BGM and BGS will not replay after the battle.

    Hmm, could you show how you are initiating the battle? Is it basically a 'Battle Processing' command?

    Perhaps this is a configuration issue. Could you paste line 117 ('VICTORY_BGM = ') from the 'Victory Aftermath' script.
     
    #16
  17. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Yes, all the battles are made via the Battle Processing event command. I also use a 'Change Battle BGM' command before the battle event so I don't have to use just one default battle music. I also have switches to disable Khas' Message System so that way the messages appear in default configuration.

    [​IMG]

    I suppose this is a question? If it is, that's what is in it.

    Code:
    VICTORY_BGM  = RPG::BGM.new("Field1", 0, 0)    # Victory BGM
     
    #17
  18. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    @CarlosDavilla Ah, yeah, that was a question, sorry.

    Hmm, strange. Well, I guess let's go crazy and try this :

    Code:
    class RPG::BGM < RPG::AudioFile
      @@last = RPG::BGM.new
      def play(pos = 0)
        if @name.empty?
          Audio.bgm_stop
          @@last = RPG::BGM.new
        else
          Audio.bgm_play('Audio/BGM/' + @name, @volume, @pitch, pos)
          @@last = self.clone
        end
      end
      def replay(*args)
        print caller.inspect
        print "\n\n"
        print args.inspect
        print "\n\n"
        print "BGM -> name:" + @name + " volume:" + @volume.to_s + " pitch:" + @pitch.to_s + " pos:" + @pos.to_s
        play(@pos)
      end
      def self.stop
        Audio.bgm_stop
        @@last = RPG::BGM.new
      end
      def self.fade(time)
        Audio.bgm_fade(time)
        @@last = RPG::BGM.new
      end
      def self.last
        @@last.pos = Audio.bgm_pos
        @@last
      end
      attr_accessor :pos
    end
    
    Create a new Material entry below all other scripts except 'Main' and paste the above code inside. The code should hopefully nab and output whatever arguments are being passed (along with other information) to the console.



    EDIT: Ah, and un-comment line 77 and 78 if you have not already done so.
     
    #18
  19. CarlosDavilla

    CarlosDavilla The Insolent One Veteran

    Messages:
    55
    Likes Received:
    5
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    I'm sorry, but I don't think it worked.

    Here's what the backtrace detected:

    Code:
    BGM -> name: volume:100 pitch:100 pos:694596(eval):1:in `replay': wrong number of arguments (1 for 0) (ArgumentError)
            from BattleManager:78:in `replay_bgm_and_bgs'
            from Yanfly Engine Ace - Victory Aftermath:386:in `process_victory'
            from BattleManager:194:in `judge_win_loss'
            from Scene_Battle:520:in `process_event'
            from Scene_Battle:47:in `update'
            from Gump's LevelUP Messenger:410:in `update'
            from Scene_Base:14:in `main'
            from SceneManager:23:in `run'
            from Sixth's Global Setting Addon:446:in `run'
            from Main - Backtrace:10:in `block in <main>'
     
    #19
  20. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    @CarlosDavilla Oof. Hmm, try to comment out line 18 in the above BGM script and comment out line 78 in BattleManager.
     
    #20
Thread Status:
Not open for further replies.

Share This Page