• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Error] Wrong Number of Argument Error when Starting Battle

  • 10
    Posts
    4
    Years
    • Seen Feb 29, 2020
    Ok, so I was trying to code something like necrozma's ultra burst, but it has limited turns. Unfortunately, I got this error when starting a battle:

    Exception: ArgumentError
    Message: wrong number of arguments(4 for 5)
    PokeBattle_ActualScene:379:in `refresh'
    PokeBattle_ActualScene:379:in `initialize'
    PokeBattle_ActualScene:247:in `new'
    PokeBattle_ActualScene:247:in `initialize'
    PokeBattle_ActualScene:2614:in `new'
    PokeBattle_ActualScene:2614:in `pbStartBattle'
    PokeBattle_Battle:4482:in `pbStartBattleCore'
    PokeBattle_Battle:4455:in `pbStartBattle'
    PokemonField:1086:in `pbWildBattle'
    PokemonField:1085:in `pbSceneStandby'

    If anyone knows of a way to fix this/ track down the error, please tell me, and thanks in advance.
     
    Like megaButton, you need to add ultraButton. Try download Pokemóm Reborn (they use v15 ir 16) and check how they made for Ultra Burst.
     
    I made ultraButton already, in fact, I copied their ultra burst code, then tried to modify it to last only three turns, like dynamax. For some reason I got that error. Unfortunately I'm not really sure how to track down what causes the error, and I've made sure I've written ultraButton where there is megaButton.
     
    I mean, I can't help beyond pointing out the obvious: on line 379 of PokeBattle_ActualScene you call refresh with too few arguments. Maybe this is something like battle scene code meant for EBS or a newer Essentials being used with an old one (or vice-versa).
     
    Ok so I fixed it and found that the error originated from def initialize(index=0,move=nil,viewport=nil) in PokeBattle_Scene. Specifically in the last line refresh(index,moves,0,0,0). The initial code was refresh(index,moves,0,0); I overlooked that one and didn't add another 0 when I added new required argument ultraButton. Now it worked as I had expected, thank you for the pointers.
     
    Back
    Top