• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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.

[Scripting Question] Need help creating a function code for a status ailment I added

  • 1
    Posts
    6
    Years
    • Seen Feb 4, 2022
    I'm new to this whole thing but I've been trying to create a new function code to allow me to make that give a status ailment I added. I followed other steps to implement the ailment itself but the function I made for It keeps saying its the wrong number of arguments. 1 for 2 specifically.

    This is what I got so far,

    ################################################################################
    # Gives the target tetanus.
    ################################################################################
    class PokeBattle_Move_66A < PokeBattle_Move
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
    return -1 if !opponent.pbCanTetanus?(true)
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    opponent.pbPoison(attacker,true)
    @battle.pbDisplay(_INTL("{1} was infected with tetanus!",opponent.pbThis))
    return 0
    end

    def pbAdditionalEffect(attacker,opponent)
    return false if !opponent.pbCanTetanus?(false)
    opponent.pbPoison(attacker,true)
    @battle.pbDisplay(_INTL("{1} was infected with tetanus!",opponent.pbThis))
    return true
    end
    end

    This is the error I get.
    ---------------------------
    Exception: ArgumentError

    Message: wrong number of arguments(1 for 2)

    PokeBattle_MoveEffects:227:in `pbCanTetanus?'

    PokeBattle_MoveEffects:227:in `pbAdditionalEffect'

    PokeBattle_Battler:4647:in `pbProcessMoveAgainstTarget'

    PokeBattle_Battler:4519:in `each'

    PokeBattle_Battler:4519:in `pbProcessMoveAgainstTarget'

    PokeBattle_Battler:5284:in `pbUseMove'

    PokeBattle_Battler:5234:in `loop'

    PokeBattle_Battler:5287:in `pbUseMove'

    PokeBattle_Battler:6057:in `pbProcessTurn'

    PokeBattle_Battler:6056:in `logonerr'
    -----------
     
    Like the error says, pbCanTetanus? takes a different number of arguments. Specifically that means you've got something like:
    Code:
    def pbCanTetanus?(parameter1, parameter2)
    Which means you need to call it like:
    Code:
    opponent.pbCanTetanus?(argument1, argument2)
    (where parameter1/parameter2/argument1/argument2 won't be called exactly that, but I can't guess what they should be without reading the definitions)
     
    Back
    Top