• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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
    11
    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 :)
     
    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