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

Adding type-changing abilities the RIGHT WAY

  • 13
    Posts
    10
    Years
    • Seen Jul 11, 2014
    I've spent the last hour or so desperately trying to implement an ability that changes the types of all moves a pokemon uses to a certain type (in the same vein as the Normalize ability). Here is my script (situated in PokeBattleMove):

    def pbType(type,attacker,opponent)
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:BUZZINESS)
    type=getConst(PBTypes,:BUG)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:PRAGMATIST)
    type=getConst(PBTypes,:DARK)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:DRACONIC)
    type=getConst(PBTypes,:DRAGON)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:FULLYCHARGED)
    type=getConst(PBTypes,:ELECTRIC)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:FAIRPLAY)
    type=getConst(PBTypes,:FIGHTING)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:INCANDESCENT)
    type=getConst(PBTypes,:FIRE)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:UPABOVE)
    type=getConst(PBTypes,:FLYING)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:IMMATERIAL)
    type=getConst(PBTypes,:GHOST)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:POLLENPOWER)
    type=getConst(PBTypes,:GRASS)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:ATTACKDUST)
    type=getConst(PBTypes,:GROUND)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:REFRIGERATE)
    type=getConst(PBTypes,:ICE)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:VILEMEMBRANE)
    type=getConst(PBTypes,:POISON)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:METAPHYSICAL)
    type=getConst(PBTypes,:PSYCHIC)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:GEMCOAT)
    type=getConst(PBTypes,:ROCK)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:MECHANIZE)
    type=getConst(PBTypes,:STEEL)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:AQUIFY)
    type=getConst(PBTypes,:WATER)
    end
    if type>=0 && if isConst?(attacker.ability,PBAbilities,:SPACETECH)
    type=getConst(PBTypes,:STELLAR)
    end
    if type>=0 && isConst?(attacker.ability,PBAbilities,:PIXILATE)
    type=getConst(PBTypes,:FAIRY)
    end
    if type>=0 && isConst?(attacker.ability,PBAbilities,:NORMALIZE)
    type=getConst(PBTypes,:NORMAL) || 0
    end
    return type
    end


    Now whenever I try to actually playtest the game in debug mode, the game tells me that there is a syntax error in the last line of PokeBattleMove.
    Does anybody know why that's the case?
    Help would be appreciated :)
     

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Of course there's a syntax error. You're doing something wrong.

    Let's take a look at one of the clauses you're using:

    Code:
        if type>=0 && [COLOR="Red"]if[/COLOR] isConst?(attacker.ability,PBAbilities,:PRAGMATIST)
          type=getConst(PBTypes,:DARK)
        end
    Is that second "if" in the Normalize code? No. What all these extra "if"s are doing is adding a whole load of new nested "if" clauses on top of the ones you actually want, which don't all end by the bottom of PokeBattle_Move, hence the syntax error.

    Use
    Code:
     tags in future to show off code. It looks nicer.
     
    Back
    Top