• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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 with chance to paralyze on switch-in

  • 37
    Posts
    8
    Years
    • Seen Jan 21, 2021
    I'm trying to update my old working scripts from v16 to v18 and ran into a syntax error in v18 with several variations on the following attempt:
    Code:
     BattleHandlers::AbilityOnSwitchIn.add(:VOLTAICGAZE,
      proc { |ability,battler,battle|
        battle.eachOtherSideBattler(battler.index) do |b|
          next if !b.near?(battler)
          next if !b.paralyzed? || battle.pbRandom(100)>=30
          battle.pbShowAbilitySplash(battler)
          if user.pbCanParalyze?(!b,PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
            msg = nil
            if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
              msg = _INTL("{1}'s {2} paralyzed {3}! It may be unable to move!",
                 battler.pbThis,!b.abilityName,battler.pbThis(true))
            end
            !b.pbParalyze(battler,msg)
          end
          battle.pbHideAbilitySplash(battler)
      }
    )

    I have a feeling it has something to do with the !b use, which I got from Bad Dreams, replacing the previous "target" language I copied from Static, as well as replacing "user" from Static with "Battler". Basically I tried combining the scripts for Intimidate and Static (using the battlehandler of the former in v18), which seemed to work in v16 here:
    Code:
     # Voltaic Gaze
        if self.hasWorkingAbility(:VOLTAICGAZE) && onactive && @battle.pbRandom(10)<3
          PBDebug.log("[Ability triggered] #{pbThis}'s Voltaic Gaze")
          for i in 0...4
            if pbIsOpposing?(i) && [email protected][i].isFainted?
              @battle.battlers[i].pbParalyze(self)
            end
          end
        end
    I then thought to base it off the battlerhandler for Synchronize, but that requires a status in the proc. Would I need to make a new battlerhandler (how?) or am I just messing up something in the syntax? Any help is much appreciated.
     
    Cool ability concept. I think this should work:

    Spoiler:


    Let me know if it doesn't work for you. I tested it only a little to check that it did what you intended and that it doesn't bypass type immunities.
     
    Cool ability concept. I think this should work:

    Spoiler:


    Let me know if it doesn't work for you. I tested it only a little to check that it did what you intended and that it doesn't bypass type immunities.

    That worked perfectly, thank you so much.

    So does the ! in the first "b" just set that as a new signifier for the "eachOtherSideBattler", and subsequent uses within the same def should drop it? And was the extra "end" for the "do" near the top rather than the "next if"s I'm guessing?
     
    That worked perfectly, thank you so much.

    So does the ! in the first "b" just set that as a new signifier for the "eachOtherSideBattler", and subsequent uses within the same def should drop it? And was the extra "end" for the "do" near the top rather than the "next if"s I'm guessing?

    In most computing languages, ! is a negation. So, in the ability code, !b.near?(battler) means "Is b NOT near battler?", whereas b.paralyzed? means "Is b paralyzed?". If you had !b.paralyzed?, this would mean "Is b NOT paralyzed?", which sounds weird, but I hope that makes sense.

    You can use ! anywhere you want to negate something: a != b (a not equal to b), !$game_switches[XXX] (particular switch is off), !isConst?(pkmn.type1,PBTypes,:BUG) (Pokémon's first type is not Bug), etc.
     
    Back
    Top