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

[Scripting Question] Ice type move Freezing Foe and boosting SDef and Def

1
Posts
5
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:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    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