"Wrong number of arguments" error

Hi,

I'm getting an error that says "wrong number of arguments (1 for 3)" and the error occurs at Game_Player line 235 whenever I get into a random encounter with an enemy. I've never encountered this error before. Is it a script conflict? I've installed a few new scripts since I last tested the game for random encounters ...

I am using VXACE.
1) show the exact error message


2) gives us a list + links to all scripts that ur using


Without those, we will need to predict out of the blue what's the problem... 🙂


PS: the problem means that something sent only 1 argument to a method that required 3...
That's the error message. It says nothing else. I went about disabling the newest scripts I installed (about 5 of them) and now it works. Now I have to find which one is causing the error -___-

EDIT: Ah, I found it. It seems to be Regendo's gameover scene script: http://www.rpgmakervxace.net/topic/357-gameover-with-choices/

Did it conflict with one of my other scripts that I used? I have a LOT of other ones ...
Game_Player line 235 is this (note - only 1 argument):

BattleManager.setup(troop_id)BattleManager.setup is defined with the following parameters:
Code:
def self.setup(troop_id, can_escape = true, can_lose = false)
Note, 3 arguments, but the last 2 have defaults, so are optional.
What has probably happened is that one of your added scripts modifies the battle system and overwrites or aliases BattleManager's setup method. BUT it hasn't made those last 2 arguments optional (ie - it hasn't provided default values).


Do a global search (control + shift + f) through your scripts for this:

def self.setup(troop_idMake sure Match Case and Whole Word are both unchecked.
You will probably find one that looks something like this, in one of the new scripts you've added:

def self.setup(troop_id, can_escape, can_lose)If you do, it's a simple matter of changing it to look like the original, so can_escape and can_lose have default values.
----------------------------------


Edit (after you posted): just looked at that script, and it seems to have the arguments correct. Search as I said above and see if another script overwrites/aliases that method.


The easy fix, if you can't find any issues, is to change line 235 in Game_Player to this:

BattleManager.setup(troop_id, true, false)to force it to pass those parameters.
You may also find you get an error or crash when you attempt a test battle. If you do, and you don't find the culprit with the above instructions, you can also change THAT call to force the parameters to be passed. That's in the DataManager script, line 112, which you can change to this:

Code:
BattleManager.setup($data_system.test_troop_id, true, false)
Can you post what line 235 of Game_Player shows?


EDIT: just follow Shaz' post
Hi, thanks for the reply Shaz! Only two scripts have 

def self.setup(troop_id, can_escape, can_lose) in it ... which are BattleManager and the game over choices script I mentioned.

I did as you said. It seems to work well now, thanks! Also, I tried without doing it your way but placed the GameOver script below all my added scripts and works just as well. YAY!

Thanks adiktuzmiko and Shaz  😀
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/wrong-number-of-arguments-error.22031/