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

Making Fear status condition

58
Posts
8
Years
    • Seen Oct 6, 2019
    Hello all.

    For my fan-game, I figured that there needed to be a new status condition that functions like Burn, but with a Sp. Atk drop instead. I like the name "Fear".

    How would I code for this?

    I want to give Bug type the exclusive immunity to Fear status (Bug needs some love).

    Perhaps this thread could double as a "how to" tutorial for anyone else interested in coding new statuses?

    Thanks.
     
    824
    Posts
    8
    Years
  • (For this tutorial, I'm going to assume you have v16 or higher.)

    So you said you want this status to be akin to burning, except that it lowers SpAtk instead of Attack. Okay, so the logical thing to do would be to see how burning works.

    1.) Find the script section PBStatus. It should look like this. Add in the red lines:
    Code:
    #70925035
    begin
      module PBStatuses
        SLEEP     = 1
        POISON    = 2
        BURN      = 3
        PARALYSIS = 4
        FROZEN    = 5
    [COLOR="red"]    FEAR      = 6[/COLOR]
    
        def PBStatuses.getName(id)
        names=[
           _INTL("healthy"),
           _INTL("asleep"),
           _INTL("poisoned"),
           _INTL("burned"),
           _INTL("paralyzed"),
           _INTL("frozen")[COLOR="red"],
           _INTL("afraid")[/COLOR]
        ]
        return names[id]
        end
      end
    
    rescue Exception
      if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
        raise $!
      end
    end
    This adds the Fear status, but doesn't do anything yet.

    2.) find the script section PokeBattle_BattlerEffects, and add this to the bottom:
    Code:
    #===============================================================================
    # Fear
    #===============================================================================
      def pbCanFear?(attacker,showMessages,move=nil)
        return false if isFainted?
        if self.status==PBStatuses::FEAR
          @battle.pbDisplay(_INTL("{1} is already afraid.",pbThis)) if showMessages
          return false
        end
        if self.status!=0 ||
           (@effects[PBEffects::Substitute]>0 && (!move || !move.ignoresSubstitute?(attacker)))
          @battle.pbDisplay(_INTL("But it failed!")) if showMessages
          return false
        end
        if @battle.field.effects[PBEffects::MistyTerrain]>0 &&
           !self.isAirborne?(attacker && attacker.hasMoldBreaker)
          @battle.pbDisplay(_INTL("The Misty Terrain prevented {1} from being frightened!",pbThis(true))) if showMessages
          return false
        end
        if pbHasType?(:BUG) && !hasWorkingItem(:RINGTARGET)
          @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
          return false
        end
        if !attacker || !attacker.hasMoldBreaker
          if hasWorkingAbility(:FLOWERVEIL) ||
             (hasWorkingAbility(:LEAFGUARD) && (@battle.pbWeather==PBWeather::SUNNYDAY ||
                                                @battle.pbWeather==PBWeather::HARSHSUN))
            @battle.pbDisplay(_INTL("{1}'s {2} prevents fear!",pbThis,PBAbilities.getName(self.ability))) if showMessages
            return false
          end
          if pbPartner.hasWorkingAbility(:FLOWERVEIL)
            abilityname=PBAbilities.getName(pbPartner.ability)
            @battle.pbDisplay(_INTL("{1}'s partner's {2} prevents fear!",pbThis,abilityname)) if showMessages
            return false
          end
        end
        if pbOwnSide.effects[PBEffects::Safeguard]>0 &&
           (!attacker || !attacker.hasWorkingAbility(:INFILTRATOR))
          @battle.pbDisplay(_INTL("{1}'s team is protected by Safeguard!",pbThis)) if showMessages
          return false
        end
        return true
      end
    
      def pbCanFearSynchronize?(opponent)
        return false if isFainted?
        return false if self.status!=0
        if pbHasType?(:BUG) && !hasWorkingItem(:RINGTARGET)
           @battle.pbDisplay(_INTL("{1}'s {2} had no effect on {3}!",
              opponent.pbThis,PBAbilities.getName(opponent.ability),pbThis(true)))
           return false
        end
        if hasWorkingAbility(:FLOWERVEIL) ||
           (hasWorkingAbility(:LEAFGUARD) && (@battle.pbWeather==PBWeather::SUNNYDAY ||
                                              @battle.pbWeather==PBWeather::HARSHSUN))
          @battle.pbDisplay(_INTL("{1}'s {2} prevents {3}'s {4} from working!",
             pbThis,PBAbilities.getName(self.ability),
             opponent.pbThis(true),PBAbilities.getName(opponent.ability)))
          return false
        end
        if pbPartner.hasWorkingAbility(:FLOWERVEIL)
          @battle.pbDisplay(_INTL("{1}'s {2} prevents {3}'s {4} from working!",
             pbPartner.pbThis,PBAbilities.getName(pbPartner.ability),
             opponent.pbThis(true),PBAbilities.getName(opponent.ability)))
          return false
        end
        return true
      end
    
      def pbFear(attacker,msg=nil)
        self.status=PBStatuses::FEAR
        self.statusCount=0
        @battle.pbCommonAnimation("Fear",self,nil)
        if msg && msg!=""
          @battle.pbDisplay(msg)
        else
          @battle.pbDisplay(_INTL("{1} became afraid!",pbThis))
        end
        PBDebug.log("[Status change] #{pbThis} was burned")
        if attacker && self.index!=attacker.index &&
           self.hasWorkingAbility(:SYNCHRONIZE)
          if attacker.pbCanFearSynchronize?(self)
            PBDebug.log("[Ability triggered] #{self.pbThis}'s Synchronize")
            attacker.pbBurn(nil,_INTL("{1}'s {2} scared {3}!",self.pbThis,
               PBAbilities.getName(self.ability),attacker.pbThis(true)))
          end
        end
      end
    This controls what Pokemon can be hit by the Fear status.
    It also adds Fear to the statuses that can be Synchronized onto the opponent.

    3.) In PokeBattle_Move, around line 1045, you should find this:
    Code:
        # Burn
        if attacker.status==PBStatuses::BURN && pbIsPhysical?(type) &&
           !attacker.hasWorkingAbility(:GUTS) &&
           !(USENEWBATTLEMECHANICS && @function==0x7E) # Facade
          damage=(damage*0.5).round
        end
    Add this below it:
    Code:
        # Fear
        if attacker.status==PBStatuses::FEAR && pbIsSpecial?(type) &&
           !attacker.hasWorkingAbility(:GUTS) &&
           !(USENEWBATTLEMECHANICS && @function==0x7E) # Facade
          damage=(damage*0.5).round
        end
    This includes the lowering of SpAtk.

    4.) In PokeBattle_Battle (without the R), around line 3281, you should find this. Add the red lines:
    Code:
        for i in priority
          next if i.isFainted?
          # Shed Skin, Hydration
          if (i.hasWorkingAbility(:SHEDSKIN) && pbRandom(10)<3) ||
             (i.hasWorkingAbility(:HYDRATION) && (pbWeather==PBWeather::RAINDANCE ||
                                                  pbWeather==PBWeather::HEAVYRAIN))
            if i.status>0
              PBDebug.log("[Ability triggered] #{i.pbThis}'s #{PBAbilities.getName(i.ability)}")
              s=i.status
              i.pbCureStatus(false)
              case s
              when PBStatuses::SLEEP
                pbDisplay(_INTL("{1}'s {2} cured its sleep problem!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::POISON
                pbDisplay(_INTL("{1}'s {2} cured its poison problem!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::BURN
                pbDisplay(_INTL("{1}'s {2} healed its burn!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::PARALYSIS
                pbDisplay(_INTL("{1}'s {2} cured its paralysis!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::FROZEN
                pbDisplay(_INTL("{1}'s {2} thawed it out!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::FEAR
                pbDisplay(_INTL("{1}'s {2} removed its fear!",i.pbThis,PBAbilities.getName(i.ability)))
              end
            end
          end
          # Healer
          if i.hasWorkingAbility(:HEALER) && pbRandom(10)<3
            partner=i.pbPartner
            if partner && partner.status>0
              PBDebug.log("[Ability triggered] #{i.pbThis}'s #{PBAbilities.getName(i.ability)}")
              s=partner.status
              partner.pbCureStatus(false)
              case s
              when PBStatuses::SLEEP
                pbDisplay(_INTL("{1}'s {2} cured its partner's sleep problem!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::POISON
                pbDisplay(_INTL("{1}'s {2} cured its partner's poison problem!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::BURN
                pbDisplay(_INTL("{1}'s {2} healed its partner's burn!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::PARALYSIS
                pbDisplay(_INTL("{1}'s {2} cured its partner's paralysis!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::FROZEN
                pbDisplay(_INTL("{1}'s {2} thawed its partner out!",i.pbThis,PBAbilities.getName(i.ability)))
              when PBStatuses::FEAR
                pbDisplay(_INTL("{1}'s {2} removed its partner's fear!",i.pbThis,PBAbilities.getName(i.ability)))
              end
            end
          end
        end
    This allows the moves Healer and Hydration to work against Fear.

    5.) Still in PokeBattle_Battle, find this around line 3417:
    Code:
          # Burn
          if i.status==PBStatuses::BURN
            if !i.hasWorkingAbility(:MAGICGUARD)
              PBDebug.log("[Status damage] #{i.pbThis} took damage from burn")
              if i.hasWorkingAbility(:HEATPROOF)
                PBDebug.log("[Ability triggered] #{i.pbThis}'s Heatproof")
                i.pbReduceHP((i.totalhp/16).floor)
              else
                i.pbReduceHP((i.totalhp/8).floor)
              end
            end
            i.pbContinueStatus
          end
    Add this below it:
    Code:
          # Fear
          if i.status==PBStatuses::FEAR
            if !i.hasWorkingAbility(:MAGICGUARD)
              PBDebug.log("[Status damage] #{i.pbThis} took damage from fear")
              i.pbReduceHP((i.totalhp/8).floor)
              pbCommonAnimation("Fear",self,nil)
              pbDisplay(_INTL("{1} is afraid!",pbThis))
            end
            i.pbContinueStatus
          end
    This is the lowering of HP at the end of each turn.




    Things this tutorial doesn't do:
    - make any moves that cause Fear (akin to Will-O-Wisp or Scald).
    - make abilities that cause Fear (akin to Flame Body).
    - make an item that when Flung at the opponent causes Fear (the Flame Orb burns the opponent if Flung)
    - make a Berry that cures Fear (akin to the Rawst Berry)
    - make an item that cures Fear (akin to the Burn Heal)
    - make a graphic to appear when the Pokemon has the Fear status (if you're using the default battle GUI, it will likely appear as Pokerus at the moment)
    - make an ability that dulls Fear (Heatproof, in addition to its other effects, makes it so that burns deal 1/16 HP damage per turn, not 1/8 HP) - if you plan on making such an ability, might I suggest the name Courage?
     
    58
    Posts
    8
    Years
    • Seen Oct 6, 2019
    Thank you, sir.

    I've already figured out how to make the abilities for Fear, but I didn't feel comfortable trying to make the status itself.

    I like the name "Courage" and will use it. Credit will be duly given.

    You rock, dude.
     
    Back
    Top