The game crashes after a battle is over.

Status
Not open for further replies.

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
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.


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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
It shouldnt throw an error on its own. Do you have additional third party script?
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
It shouldnt throw an error on its own. Do you have additional third party script?
Indeed I have, Theo. Way too much of them, actually.



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

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
Ctrl + shift + f in script editor
Type "def replay" see if anything comes up
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
Ctrl + shift + f in script editor
Type "def replay" see if anything comes up
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:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,528
Reaction score
14,261
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.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,674
Reaction score
566
First Language
English
Primarily Uses
RMVXA
Victor and Yanfly scripts rarely work together,
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.
Way too much of them
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.
Game_System
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
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
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.
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.

You could also try searching for
@map_bgm
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.



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

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.
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. :/
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
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.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
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'.
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
Here is the backtrack script that I used in RPG Maker VX Ace
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:

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
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).
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
Thanks for the info, Ossra. It was really useful.

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).
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.



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

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
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.
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
@CarlosDavilla Hmm ... comment out line 77 and 78 in the BattleManager core code and do another test just to see if anything else explodes.
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.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
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.
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
Hmm, could you show how you are initiating the battle? Is it basically a 'Battle Processing' command?
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.



Perhaps this is a configuration issue. Could you paste line 117 ('VICTORY_BGM = ') from the 'Victory Aftermath' script.
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
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
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.
 

CarlosDavilla

The Insolent One
Veteran
Joined
Jul 31, 2018
Messages
61
Reaction score
4
First Language
Portuguese
Primarily Uses
RM2k
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>'
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top