• 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.
  • 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] Ice type move Freezing Foe and boosting SDef and Def

  • 1
    Posts
    6
    Years
    • Seen Mar 13, 2019
    Hello i need help with a script for an Ice Type Move.
    The move should Freeze the foe and Boost the users DEF and SDEF.
    I would be realy pleased to recive any help or thoughts.

    this is the code i combined off the function codes 00C and 02A

    ################################################################################
    # Freezes Target and Bossts 1Def and 1SpezDef
    ################################################################################
    class PokeBattle_Move_159 < PokeBattle_Move
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
    return -1 if !opponent.pbCanFreeze?(attacker,true,self)
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    opponent.pbFreeze
    return 0
    end

    def pbAdditionalEffect(attacker,opponent)
    if opponent.pbCanFreeze?(attacker,false,self)
    opponent.pbFreeze
    return true
    end
    return false
    end

    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
    !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
    @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
    return -1
    end
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    showanim=true
    if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
    attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
    showanim=false
    end
    if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
    attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
    showanim=false
    end
    return 0
    end
    end

    i dont know what is wrong.
    only thing that works is the Stat boost.
     
    Last edited:
    Look at similar moves. You can copy Cosmic Power for the def+sp. def boosts, and something like Ice Beam or Blizzard for freezing. You can work out how to change the %-chance to freeze by comparing with other moves that have different chances. e.g. Thunderbolt is 10% PRZ, whereas Discharge is 30%.
     
    Back
    Top