• 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!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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] Question about "if" command

  • 85
    Posts
    7
    Years
    • Seen Nov 24, 2023
    I changed the properties of the ability Mega Launcher so that it boosts a move if it's either a bomb move or a pulse move. This is how the code for it looks like now:
    Code:
    if attacker.hasWorkingAbility(:MEGALAUNCHER) && (isPulseMove? || isBombMove?)
          damagemult=(damagemult*1.5).round
    end
    Something I'm not sure about is this: Will Mega Launcher boost a move twice if said move is both a bomb and a pulse move? Or will it only check for one of those 2 attributes and only buff it once?
     
    Last edited:
    Unless the code is being ran through a loop, each line is only read once. So as of now this code just says:
    "If the attacker has Mega Launcher, AND the move is a Pulse OR Bomb move, THEN damage is increased by 1.5"

    So you will only ever get 1.5 as your damage boost.
    Even if you did loop it, a second reading would just replace the first reading, resulting in 1.5 damage again. The only way this effect would cumulate is if you specifically CODED it to cumulate its damage with each possible scenario, and then return the cumulated damage boosts. Which would take a lot more work than this, so you're safe.
     
    Unless the code is being ran through a loop, each line is only read once. So as of now this code just says:
    "If the attacker has Mega Launcher, AND the move is a Pulse OR Bomb move, THEN damage is increased by 1.5"

    So you will only ever get 1.5 as your damage boost.
    Even if you did loop it, a second reading would just replace the first reading, resulting in 1.5 damage again. The only way this effect would cumulate is if you specifically CODED it to cumulate its damage with each possible scenario, and then return the cumulated damage boosts. Which would take a lot more work than this, so you're safe.

    Got it. Thanks!
     
    Back
    Top