Examples: Wild Battles

Section 5.A

Wild Battle Example # 1

The example below demonstrates a 1v1 battle against a wild Deoxys. In this battle, the following rules are set:

  • "cannotRun" is used to prevent the playing from fleeing.

  • "disablePokeBalls" is used to prevent the player from manually throwing Poke Balls.

  • "terrain" is used to set permanent Psychic terrain.

  • "environ" is used to set the battle environment to :Space.

  • "backdrop" and "base" are used to customize the battle backdrop and bases, respectively.

  • "alwaysCapture" is used to ensure a 100% capture rate in this battle.

  • "battleBGM" is used to set custom battle music.

  • "battleIntroText" is used to set custom battle intro text.

  • "editWildPokemon" is used to edit the following attributes of the wild Deoxys:

    • Name is set to "????" so that it may be "revealed" in battle.

    • Obtain location is set to "Outer Space."

    • Flagged as Super Shiny.

    • Given Pokerus.

    • HP Level set to 2, multiplying its natural HP 2x.

    • Given boss immunity to OHKO effects, effects that would force it to flee, and all forms of indirect damage.

  • "midbattleScript" is used to set a script to use for this battle which does the following:

    • "Reveals" Deoxy's real name at the start of the battle.

    • Sets a damage cap for Deoxys so that it will survive with 1 HP regardless of damage taken.

    • At the end of each round, Deoxys will cycle to its next form and recover its HP/Status.

    • Whenever Deoxys takes damage from an attack, it recovers back a little HP.

    • When Deoxy's HP falls to 25% or lower, it stops regenerating HP.

    • When Deoxys reaches the set damage cap (1 HP) after its regeneration has ended, the player will automatically throw a Poke Ball to capture Deoxys. This capture is guaranteed thanks to the "alwaysCapture" rule.

setBattleRule("cannotRun")
setBattleRule("disablePokeBalls")
setBattleRule("terrain", :Psychic)
setBattleRule("environ", :Space)
setBattleRule("backdrop", "elite4")
setBattleRule("base", "distortion")
setBattleRule("alwaysCapture")
setBattleRule("battleBGM", "Battle roaming")
setBattleRule("battleIntroText", "You encountered an alien invader!")
setBattleRule("editWildPokemon", {
  :name        => "????",
  :obtain_text => "Outer Space.",
  :super_shiny => true,
  :pokerus     => true,
  :hp_level    => 2,
  :immunities  => [:OHKO, :ESCAPE, :INDIRECT]
})
setBattleRule("midbattleScript", {
  "RoundStartCommand_1_foe" => {
    "text_A"       => "You used Prof. Pluto's Roto-Dex upgrade to identify the alien species!",
    "playSE"       => "PC access",
    "battlerName"  => "Deoxys",
    "battlerHPCap" => -1,
    "text_B"       => "The alien species was identified as Deoxys!"
  },
  "RoundEnd_foe_repeat" => {
    "playSE"        => "Anim/Sound2",
    "battlerForm"   => [:Cycle, "{1} suddenly mutated!"],
    "playCry"       => :Self,
    "battlerMoves"  => :Reset,
    "ignoreAfter"   => "TargetHPLow_foe",
    "battlerStatus" => [:NONE, true],
    "battlerHP"     => [4, "{1} regenerated some HP!"]
  },
  "TargetTookDamage_foe_repeat" => {
    "ignoreAfter" => "TargetHPLow_foe",
    "text"        => "{1} started to regenerate!",
    "battlerHP"   => [8, "{1} regenerated some HP!"]
  },
  "TargetHPLow_foe" => {
    "text" => "{1} has become too weak to regenerate any more HP!"
  },
  "BattlerReachedHPCap_foe" => {
    "speech"       => [:Opposing, "It's getting weak!\nIt's now or never!", "Go, Poké Ball!"],
    "disableBalls" => false,
    "useItem"      => :POKEBALL
  },
  "AfterCapture" => [0, "Phew...it's finally over.", "The professor would be proud."]
})
WildBattle.start(:DEOXYS, 50)

Wild Battle Example # 2

The example below demonstrates a double battle where the player and their partner May encounter a wild Latias and Latios. In this battle, the following rules are set:

  • "cannotRun" is used to prevent the playing from fleeing.

  • "weather" is used to set permanent Hail.

  • "backdrop" is used to customize the battle backdrop and bases.

  • "editWildPokemon" is used to edit the following attributes of the wild Latias:

    • Nature is set to Modest.

    • Given Soul Dew to hold.

    • Ability is set to Healer.

    • Given the moves Life Dew, Reflect, Helping Hand, and Psychic.

  • "editWildPokemon2" is used to edit the following attributes of the wild Latios:

    • Nature is set to Adamant.

    • Given Soul Dew to hold.

    • Ability is set to Friend Guard.

    • Given the moves Dragon Dance, Breaking Swipe, Zen Headbutt, and Earthquake.

  • "midbattleScript" is used to set a script to use for this battle which does the following:

    • When either Latios or Latias reach 25% HP or lower, they will call upon the other to heal them.

    • When either Latios or Latias faint, the remaining one will flee, ending the battle.

setBattleRule("cannotRun")
setBattleRule("weather", :Hail)
setBattleRule("backdrop", "champion2")
setBattleRule("editWildPokemon", {
  :nature  => :MODEST,
  :item    => :SOULDEW,
  :ability => :HEALER,
  :moves   => [:LIFEDEW, :REFLECT, :HELPINGHAND, :PSYCHIC]
})
setBattleRule("editWildPokemon2", {
  :nature  => :ADAMANT,
  :item    => :SOULDEW,
  :ability => :FRIENDGUARD,
  :moves   => [:DRAGONDANCE, :BREAKINGSWIPE, :ZENHEADBUTT, :EARTHQUAKE]
})
setBattleRule("midbattleScript", {
  "TargetHPLow_foe_repeat" => {
    "text_A"    => "{1} calls out to its partner with a whimpering cry!",
    "playCry"   => :Self,
    "text_B"    => [:Ally, "{1} comes to its partner's aid!"],
    "battlerHP" => [4, "{1} restored a little HP!"]
  },
  "BattlerFainted_foe" => {
    "setBattler" => :Ally,
    "text"       => "{1} looks upset by its partner's defeat...\nIt lost the will to fight!",
    "wildFlee"   => true
  }
})
pbRegisterPartner(:POKEMONTRAINER_May, "May")
WildBattle.start(:LATIAS, 30, :LATIOS, 30)

Last updated