• 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] How to make Forewarn reveal all 4 of the foe's moves, not just the strongest one?

  • 428
    Posts
    5
    Years
    This is Forewarn's usual code:

    BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN,
    proc { |ability,battler,battle|
    next if !battler.pbOwnedByPlayer?
    highestPower = 0
    forewarnMoves = []
    battle.eachOtherSideBattler(battler.index) do |b|
    b.eachMove do |m|
    power = m.baseDamage
    power = 160 if ["070"].include?(m.function) # OHKO
    power = 150 if ["08B"].include?(m.function) # Eruption
    # Counter, Mirror Coat, Metal Burst
    power = 120 if ["071","072","073"].include?(m.function)
    # Sonic Boom, Dragon Rage, Night Shade, Endeavor, Psywave,
    # Return, Frustration, Crush Grip, Gyro Ball, Hidden Power,
    # Natural Gift, Trump Card, Flail, Grass Knot
    power = 80 if ["06A","06B","06D","06E","06F",
    "089","08A","08C","08D","090",
    "096","097","098","09A"].include?(m.function)
    next if power<highestPower
    forewarnMoves = [] if power>highestPower
    forewarnMoves.push(m.name)
    highestPower = power
    end
    end
    if forewarnMoves.length>0
    battle.pbShowAbilitySplash(battler)
    forewarnMoveName = forewarnMoves[battle.pbRandom(forewarnMoves.length)]
    if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
    battle.pbDisplay(_INTL("{1} was alerted to {2}!",
    battler.pbThis, forewarnMoveName))
    else
    battle.pbDisplay(_INTL("{1}'s Forewarn alerted it to {2}!",
    battler.pbThis, forewarnMoveName))
    end
    battle.pbHideAbilitySplash(battler)
    end
    }
    )

    How do I get it to reveal all four codes?
    I'd probably need to get these values set correctly, then display them as such:
    forewarnMoves = []
    forewarnMoves2 = []
    forewarnMoves3 = []
    forewarnMoves4 = []
    battle.pbDisplay(_INTL("{1}'s Forewarn alerted it to {2}, {3}, {4}, and {5}!",

    But how do I get these values and set them to the names of the foe's attacks, one per slot?
     
    Back
    Top