FANDOM


  • I want to script an ability that functions exactly the same as Water Absorb, but for both Ghost and Dark moves. I found the script for Water Absorb: 


    (opponent.hasWorkingAbility(:WATERABSORB) && isConst?(type,PBTypes,:WATER)) ||


    how would I format the second type? would it be something like: (opponent.hasWorkingAbility(:SHADOWSHIELD) && isConst?(type,PBTypes,:GHOST,DARK)) 


    or 


    (opponent.hasWorkingAbility(:SHADOWSHIELD) && isConst?(type,PBTypes,:GHOST) && isConst?(type,PBTypes,:DARK)) 


    or would it be something else entirely?

      Loading editor
    • It should be something along the lines of (opponent.hasWorkingAbility(:SHADOWSHIELD) &&( (isConst?(type,PBTypes,:GHOST) || isConst?(type,PBTypes,:DARK))), in your version Shadow Shield will only activate if the move is both ghost and dark type, you want it to activate when the move is ghost or dark type.

        Loading editor
    • Sacemd wrote:
      It should be something along the lines of (opponent.hasWorkingAbility(:SHADOWSHIELD) &&( (isConst?(type,PBTypes,:GHOST) || isConst?(type,PBTypes,:DARK))), in your version Shadow Shield will only activate if the move is both ghost and dark type, you want it to activate when the move is ghost or dark type.

      Thanks for the reply :D but I get a syntax error when using that code. Did I put it in wrong?
        if (opponent.hasWorkingAbility(:DRYSKIN) && isConst?(type,PBTypes,:WATER)) ||
           (opponent.hasWorkingAbility(:VOLTABSORB) && isConst?(type,PBTypes,:ELECTRIC)) ||
           (opponent.hasWorkingAbility(:WATERABSORB) && isConst?(type,PBTypes,:WATER)) ||
           (opponent.hasWorkingAbility(:SHADOWSHIELD) &&( (isConst?(type,PBTypes,:GHOST) || isConst?(type,PBTypes,:DARK)))
          PBDebug.log("[Ability triggered] #{opponent.pbThis}'s #{PBAbilities.getName(opponent.ability)} (made #{@name} ineffective)")
          healed=false
          if opponent.effects[PBEffects::HealBlock]==0
            if opponent.pbRecoverHP((opponent.totalhp/4).floor,true)>0
              @battle.pbDisplay(_INTL("{1}'s {2} restored its HP!",
                 opponent.pbThis,PBAbilities.getName(opponent.ability)))
            end
          end
          if !healed
            @battle.pbDisplay(_INTL("{1}'s {2} made {3} useless!",
               opponent.pbThis,PBAbilities.getName(opponent.ability),@name))
          end
          return true
        end

        Loading editor
    • Ah I see, I wrote an opening bracket too many. It should be:

      (opponent.hasWorkingAbility(:SHADOWSHIELD) && ( isConst?(type,PBTypes,:GHOST) || isConst?(type,PBTypes,:DARK)))

        Loading editor
    • Yay! Thanks again!

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message