• 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] Abilities similar to plus and minus?

56
Posts
10
Years
    • Seen Jul 8, 2023
    I've been trying to add new abilities similar to plus and minus. The ability true sword is supposed to increase the attack stats if their partner has the ability true shield. This ability is working as intended. However, the other ability, true shield, which is supposed to increase defenses if their partner has the ability true sword, is not working and just causes an error to pop up.

    Code:
    if attacker.hasWorkingAbility(:TRUESWORD) #True Sword
    partner=attacker.pbPartner
    if partner.hasWorkingAbility(:TRUESHIELD)
    atkmult=(atkmult*1.5).round
    end
    end
    if opponent.hasWorkingAbility(:TRUESHIELD) #True Shield
    if opponent.pbPartner.hasWorkingAbility(:TRUESWORD)
    defense=(defense*1.5).round
    end
    end

    Any help would be appreciated, thanks!
     
    Last edited:
    180
    Posts
    6
    Years
    • Seen Apr 15, 2024
    it should be like this
    if attacker.hasWorkingAbility(:TRUESHIELD) #True Shield
    partner=attacker.pbPartner
    if partner.hasWorkingAbility(:TRUESWORD)
    atkmult=(defmult*1.5).round
    end
    end
     
    56
    Posts
    10
    Years
    • Seen Jul 8, 2023
    That's what I had originally. I've tried a few different things, but the pokemon still takes normal damage. Thanks for the response though!
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Maybe the second part could be something like
    Code:
    if opponent.hasWorkingAbility(:TRUESHIELD) #True Shield
      if opponent.pbPartner.hasWorkingAbility(:TRUESWORD)
        atkmult=(atkmult*2.0/3.0).round
      end
    end

    I'm reducing the attack multiplier by ⅔, which should be the same as multiplying the defense by 1.5.

    There's probably some way to do it through defense, but because you didn't post the error message I have no idea what's wrong.
     
    56
    Posts
    10
    Years
    • Seen Jul 8, 2023
    Maybe the second part could be something like
    Code:
    if opponent.hasWorkingAbility(:TRUESHIELD) #True Shield
      if opponent.pbPartner.hasWorkingAbility(:TRUESWORD)
        atkmult=(atkmult*2.0/3.0).round
      end
    end

    I'm reducing the attack multiplier by ⅔, which should be the same as multiplying the defense by 1.5.

    There's probably some way to do it through defense, but because you didn't post the error message I have no idea what's wrong.

    Hey, this worked, thanks!
     
    Back
    Top