• 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.
  • 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!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Ability procs twice?

  • 961
    Posts
    8
    Years
    • Age 22
    • Seen Nov 28, 2022
    I was working on some Gen VII abilities, Shields Down in specific. I'm building it from scratch, here is it so far (because of this error I don't have much):
    (Under Darmanitan's Zen Mode)
    Code:
        # Minior
        if self.hasWorkingAbility(:SHIELDSDOWN) && @hp<=((@totalhp/2).floor)
          if self.form=0
            self.form=1; transformed=true
          end
        end
    Once its HP is lower than half of its max HP, it transforms immediately after the move that caused it to get lower than half. At the end of the turn, it transforms twice. I only want it to transform after it's been hit, not at the end of the turn. Could someone explain what to do or edit this code to work as I described? I'll figure the rest of Shields Down out myself.
     
    try adding = to "if self.form==0"
     
    try adding = to "if self.form==0"

    .....
    And I thought I knew my Ruby well... It's fixed, thanks a bunch! While we're at it, can you clarify this real quickly for me? >=, for example, means "Greater than or equal to" (X or higher) and == means "equal to exactly", but what does = alone mean, when checking for a number, in an if-sentence?
     
    Last edited:
    Well ""=="" checks if the values are equal while ""="" replaces the left value with the right one.
     
    Back
    Top