• 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] Defog error

  • 13
    Posts
    7
    Years
    • Seen Dec 25, 2019
    I'm using essentials v16 and I have a problem with the move defog because it doesn't work like in the games, you know... removing hazards for both sides

    class PokeBattle_Move_049 < PokeBattle_Move
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
    opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
    opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
    opponent.pbOwnSide.effects[PBEffects::Mist] = 0
    opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
    opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
    opponent.pbOwnSide.effects[PBEffects::StealthRock] = -1
    opponent.pbOwnSide.effects[PBEffects::StickyWeb] = -1
    opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
    if USENEWBATTLEMECHANICS
    opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
    opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
    opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
    opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
    opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
    opponent.pbOpposingSide.effects[PBEffects::StealthRock] = -1
    opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = -1
    opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
    end
    return 0
    end

    def pbAdditionalEffect(attacker,opponent)
    if !opponent.damagestate.substitute
    if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
    opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
    end
    end
    opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
    opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
    opponent.pbOwnSide.effects[PBEffects::Mist] = 0
    opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
    opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
    opponent.pbOwnSide.effects[PBEffects::StealthRock] = -1
    opponent.pbOwnSide.effects[PBEffects::StickyWeb] = -1
    opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
    if USENEWBATTLEMECHANICS
    opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
    opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
    opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
    opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
    opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
    opponent.pbOpposingSide.effects[PBEffects::StealthRock] = -1
    opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = -1
    opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
    end
    end
    end

    I need help please :(
     
    Back
    Top