• 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 a new entry hazard (please help)

majorgames

Guest
  • 0
    Posts
    I am trying to add a new entry hazard move called hot coals in which switching in Pokemon get burned (a layer of coals cant be placed if there already toxic spikes set and you can only place 1 layer of hot coals (like with stealth rocks)), non grounded Pokemon are unaffected and fire types absorb it (much like poison types with toxic spikes)


    I coded it into the game and the move can be used (displaying the correct text when used) but when opposing pokemon switch in, those that should become burned don't. rapid spin still clears them though (as it should).


    here is all the code that I have added (with the name of the script its added to in bold above the code)

    PBEffects

    Code:
        HotCoals          = 102



    PokeBattle_ActiveSide

    Code:
              @effects[PBEffects::HotCoals] = false



    PokeBattle_Battle (note that there is an extra end at the end of this piece of code as there is more ifs above it relating to other entry hazards, before adding HotCoals ToxicSpikes was the last block of code and had that extra end if but no longer does)

    Code:
                   # HotCoals
    
        if pkmn.pbOwnSide.effects[PBEffects::HotCoals]=true
    
          if isConst?(pkmn.item,PBItems,:IRONBALL) ||
    
             pkmn.effects[PBEffects::Ingrain] ||
    
             pkmn.effects[PBEffects::SmackDown] ||
    
             pkmn.pbOwnSide.effects[PBEffects::Gravity]>0 ||
    
             pkmn.pbOpposingSide.effects[PBEffects::Gravity]>0 ||
    
             !(pkmn.pbHasType?(:FLYING) ||
    
               isConst?(pkmn.ability,PBAbilities,:LEVITATE) ||
    
               isConst?(pkmn.item,PBItems,:AIRBALLOON) ||
    
               pkmn.effects[PBEffects::MagnetRise]>0 ||
    
               pkmn.effects[PBEffects::Telekinesis]>0)
    
            if pkmn.pbHasType?(:FIRE)
    
              pkmn.pbOwnSide.effects[PBEffects::HotCoals]=false
    
              pbDisplayPaused(_INTL("{1} absorbed the Hot Coals!",pkmn.pbThis))
    
            elsif pkmn.pbCanBurnSpikes?
    
              if pkmn.pbOwnSide.effects[PBEffects::HotCoals]
    
                pkmn.pbBurn(pkmn,true)
    
                pbDisplayPaused(_INTL("{1} was Burned!",pkmn.pbThis))
    
              end
    
            end
    
          end
    
        end
    
      end


    PokeBattle_MoveEffects (This is relating to Defog)

    Code:
             class PokeBattle_Move_049 < PokeBattle_Move
    
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    
      return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
    
      pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    
      ret=opponent.pbReduceStat(PBStats::EVASION,1,false)
    
      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] = false
    
      opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
    
      opponent.pbOwnSide.effects[PBEffects::HotCoals] = false
    
      return 0
    
    end
    
    
    
    
    def pbAdditionalEffect(attacker,opponent)
    
      if opponent.pbCanReduceStatStage?(PBStats::EVASION,false)
    
        opponent.pbReduceStat(PBStats::EVASION,1,false)
    
      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] = false
    
      opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
    
      opponent.pbOwnSide.effects[PBEffects::HotCoals] = false
    
      return true
    
    end
    
    end


    PokeBattle_MoveEffects (This is relating to Rapid Spin)

    Code:
    class PokeBattle_Move_110 < PokeBattle_Move
    
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    
      ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    
      if attacker.hp>0 && opponent.damagestate.calcdamage>0
    
        if attacker.effects[PBEffects::MultiTurn]>0
    
          mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
    
          [email protected][attacker.effects[PBEffects::MultiTurnUser]]
    
          @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
    
          attacker.effects[PBEffects::MultiTurn]=0
    
          attacker.effects[PBEffects::MultiTurnAttack]=0
    
          attacker.effects[PBEffects::MultiTurnUser]=-1
    
        end
    
        if attacker.effects[PBEffects::LeechSeed]>=0
    
          attacker.effects[PBEffects::LeechSeed]=-1
    
          @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))   
    
        end
    
        if attacker.pbOwnSide.effects[PBEffects::StealthRock]
    
          attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
    
          @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))     
    
        end
    
        if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
    
          attacker.pbOwnSide.effects[PBEffects::Spikes]=0
    
          @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))     
    
        end
    
        if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
    
          attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
    
          @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))     
    
        end
    
        if attacker.pbOwnSide.effects[PBEffects::HotCoals]
    
          attacker.pbOwnSide.effects[PBEffects::HotCoals]=false
    
          @battle.pbDisplay(_INTL("{1} blew away Hot Coals!",attacker.pbThis))     
    
        end
    
      end
    
      return ret
    
    end
    
    end



    PokeBattle_MoveEffects (This is the code for using HotCoals)

    Code:
    class PokeBattle_Move_134 < PokeBattle_Move
    
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    
      if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=1
    
        @battle.pbDisplay(_INTL("But it failed!"))
    
        return -1
    
      elsif attacker.pbOpposingSide.effects[PBEffects::HotCoals]
    
        @battle.pbDisplay(_INTL("But it failed!"))
    
        return -1
    
      end
    
      pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    
      attacker.pbOpposingSide.effects[PBEffects::HotCoals]=true
    
      if [email protected]?(attacker.index)
    
        @battle.pbDisplay(_INTL("Hot coals were scattered all around the foe's team's feet!"))
    
      else
    
        @battle.pbDisplay(_INTL("Hot coals were scattered all around your team's feet!"))
    
      end
    
      return 0
    
    end
    
    end


    PokeBattle_Effects (This is the code definition of whether a pokemon can be burned by HotCoals or not)

    Code:
      def pbCanBurnSpikes?
    
      return false if @hp<=0
    
      return false if self.status!=0
    
      return false if pbHasType?(:FIRE)
    
      return false if isConst?(self.ability,PBAbilities,:WATERVEIL)
    
      return false if isConst?(self.ability,PBAbilities,:LEAFGUARD) && @battle.pbWeather==PBWeather::SUNNYDAY
    
      return false if pbOwnSide.effects[PBEffects::Safeguard]>0
    
      return true
    
    end


    Am I missing something here, toxic spikes words perfectly but hotcoals can't burn any pokemon even if it should, please help
     
  • 8
    Posts
    12
    Years
    • Seen Dec 28, 2016
    When defining the move in the PBS file did you set the function code to 134?

    PS: In PokemonBattle_Battle shouldn't it be:
    "pkmn.pbOwnSide.pbHasType?(:FIRE)" and "pkmn.pbOwnSide.pbCanBurnSpikes?", instead of:
    "pkmn.pbHasType?(:FIRE)" and "pkmn.pbCanBurnSpikes?" (add "pbOwnSide").
    Probably I'm wrong, but that is an idea...
     
    Last edited:

    majorgames

    Guest
  • 0
    Posts
    When defining the move in the PBS file did you set the function code to 134?

    Yes I did, infact I know the PBS file is ok because when I use it, the message displays "Hot Coals were scatter arround your opponent's feet" and when the opponent uses rapid spin the message says "the hot coals were blown away" the problem is the pokemon not burning when they should

    PS: In PokemonBattle_Battle shouldn't it be:
    "pkmn.pbOwnSide.pbHasType?(:FIRE)" and "pkmn.pbOwnSide.pbCanBurnSpikes?", instead of:
    "pkmn.pbHasType?(:FIRE)" and "pkmn.pbCanBurnSpikes?" (add "pbOwnSide").
    Probably I'm wrong, but that is an idea...

    I tried that but it made no difference (infact I know toxic spikes uses "pkmn.pbCanPoisonSpikes?" rather than pkmn.pbOwnSide.pbCanPoisonSpikes?")
     
    Last edited:
    Back
    Top