• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Reminder: AI-generated content is not allowed on the forums per the Rules and Regulations. Please contact us if you have any questions!
Resource icon

v21.1 Sky/Dive Battle Script 21.1

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v21.1 ✅
Hey everyone.
This is a script that i made in Pokemon Essentials V21.1 to make sky battles or something similar. It is very modular in how it works. NOTE: You will need 6 free switches all next to each other for this to work. In mine i used switch 119 - 124.

There are 5 way to modify this script, you have,

DisabledPokemon (pokemon that cann't be in the next battle)

DisabledMoves (move that will be disabled in the next battle)

AllowedAbilitys (ability that if that pokemon has it, it will be able to join the battle NOTE: The pokemon must have said ability to join the battle not just be able to have that ability e.g. Poliwag has 3 abilitys Water absorb/Damp/(H)Swift Swim. If you put water absorb as one of the abilitys in AllowedAbilitys and it had Damp it won't be able to join).

AllowedTypes (This is what type of pokemon you want to be able to battle, this and AllowedAbilitys work together. So back to the Poliwag, even if it did not have water absorb but you put :WATER in the AllowedType list then it would still allow it in battle).

AllowedPokemon (This will let the pokemon join the battle no matter what, as long as they are not in the DisabledPokemon list)

Last is stopping any move of a certian type (By defult this is any :FIRE move as this was made for dive battles but it can easily be changed.)


How to use:

In your scripts (f11), scroll all the way down to the bottom and just above main (If it goes below then it will not work) insert a new script and copy and past this in it.

Ruby:
Expand Collapse Copy
# ----------------------------
#   Dive Battle script
# ----------------------------


  DisabledPokemon = [:MARACTUS, :OGERPON, :CACNEA, :CACTURNE, :WINGULL,
    :PELIPPER, :SHELMET, :ACCELGOR, :GOOMY, :SLIGGOO, :GOODRA, :SMOOCHUM,
    :SURSKIT, :MORELULL, :SHIINOTIC, :FEEBAS, :MAGIKARP, :BEARTIC,
    :INKAY, :MALAMAR, :ROTOM]

  DisabledMoves = [:FLY, :BOUNCE, :BEAKBLAST, :BLEAKWINDSTORM, :SUNNYDAY,
    :DRAGONASCENT, :CHATTER, :HURRICANE, :SKYATTACK, :SKYDROP, :TAILWIND,
    :BOOMBURST, :ECHOEDVOICE, :EGGBOMB, :EXPLOSION, :GROWL, :HOWL, :HYPERVOICE,
    :LEER, :PERISHSONG, :POPULATIONBOMB, :RAPIDSPIN, :RAZORWIND, :RELICSONG,
    :SELFDESTRUCT, :SING, :SLEEPTALK, :SNORE, :SONICBOOM, :SWEETSCENT,
    :UPROAR, :WHIRLWIND, :YAWN, :COTTONSPORE, :GRASSKNOT, :INGRAIN, :LEAFSTORM,
    :LEAFTORNADO, :PETALBLIZZARD, :SEEDBOMB, :SLEEPPOWDER, :SOLARBEAM,
    :SOLARBLADE, :SPORE, :STUNSPORE, :SYRUPBOMB, :BLIZZARD, :HAIL, :RAINDANCE,
    :ICYWIND, :FLYINGPRESS, :HIGHJUMPKICK, :JUMPKICK, :SKYUPPERCUT, :AIRCUTTER,
    :AIRSLASH, :DUALWINGBEAT, :OBLIVIONWING, :GRAVITY, :BUGBUZZ, :POLLENPUFF,
    :POWDER, :RAGEPOWDER, :SILVERWIND, :SANDSTORM, :OMINOUSWIND, :DRACOMETEOR,
    :TWISTER, :FLATTER, :SNARL, :CLANGINGSCALES, :CONFIDE, :DISARMINGVOICE,
    :GRASSWHISTLE, :METALSOUND, :NOBLEROAR, :PARTINGSHOT, :ROAR, :ROUND,
    :SCREECH, :SPARKLINGARIA, :SUPERSONIC, :ALLURINGVOICE, :FAIRYWIND,
    :DEFOG, :SNOWSCAPE, :CHILLYRECEPTION, :DIVE]
  
    AllowedAbilitys = [:WATERABSORB, :STORMDRAIN, :HYDRATION, :RAINDISH,
      :SWIFTSWIM, :WATERVEIL, :SUCTIONCUPS, :WATERBUBBLE, :PROPELLERTAIL]
    
    AllowedTypes = [:WATER]
  
    AllowedPokemon = [:LUGIA, :DRAGALGE, :STUNFISK, :TYNAMO, :EELEKTRIK,
    :EELEKTROSS, :CLOBBOPUS, :GRAPPLOCT, :DHELMISE, :PINCURCHIN]
  
 #-----------------------------------------------

    $temporary_banned_moves = nil
    
def pbDiveBattle?


  if $player.party[0] && !DisabledPokemon.include?($player.party[0].species)
    if $player.party[0] && AllowedPokemon.include?($player.party[0].species)
      $game_switches[119] = true
      else
    if $player.party[0] && $player.party[0].types.any? { |t| AllowedTypes.include?(t) }||
       $player.party[0] && AllowedAbilitys.include?($player.party[0].ability_id)
       $game_switches[119] = true
  else
    $game_switches[119] = false
  end
end
end
  if $player.party[1] && !DisabledPokemon.include?($player.party[1].species)
      if $player.party[1] && AllowedPokemon.include?($player.party[1].species)
      $game_switches[120] = true
      else
    if $player.party[1] && $player.party[1].types.any? { |t| AllowedTypes.include?(t) }||
       $player.party[1] && AllowedAbilitys.include?($player.party[1].ability_id)
       $game_switches[120] = true
  else
    $game_switches[120] = false
  end
end
end
  if $player.party[2] && !DisabledPokemon.include?($player.party[2].species)
      if $player.party[2] && AllowedPokemon.include?($player.party[2].species)
      $game_switches[121] = true
      else
    if $player.party[2] && $player.party[2].types.any? { |t| AllowedTypes.include?(t) }||
       $player.party[2] && AllowedAbilitys.include?($player.party[2].ability_id)
       $game_switches[121] = true
  else
    $game_switches[121] = false
  end
end
end
  if $player.party[3] && !DisabledPokemon.include?($player.party[3].species)
      if $player.party[3] && AllowedPokemon.include?($player.party[3].species)
      $game_switches[122] = true
      else
    if $player.party[3] && $player.party[3].types.any? { |t| AllowedTypes.include?(t) }||
       $player.party[3] && AllowedAbilitys.include?($player.party[3].ability_id)
       $game_switches[122] = true
  else
    $game_switches[122] = false
  end
end
end
  if $player.party[4] && !DisabledPokemon.include?($player.party[4].species)
      if $player.party[4] && AllowedPokemon.include?($player.party[4].species)
      $game_switches[123] = true
      else
    if $player.party[4] && $player.party[4].types.any? { |t| AllowedTypes.include?(t) }||
       $player.party[4] && AllowedAbilitys.include?($player.party[4].ability_id)
       $game_switches[123] = true
  else
    $game_switches[123] = false
  end
end
end
  if $player.party[5] && !DisabledPokemon.include?($player.party[5].species)
      if $player.party[5] && AllowedPokemon.include?($player.party[5].species)
      $game_switches[124] = true
      else
    if $player.party[5] && $player.party[5].types.any? { |t| AllowedTypes.include?(t) }||
       $player.party[5] && AllowedAbilitys.include?($player.party[5].ability_id)
       $game_switches[124] = true
  else
    $game_switches[124] = false
  end
end
end
  if  $game_switches[119] == true || $game_switches[120] == true ||
      $game_switches[121] == true || $game_switches[122] == true ||
      $game_switches[123] == true || $game_switches[124] == true
      $stored_party = $player.party.clone
      allowed_slots = []
    6.times do |i|
      switch_id = 119 + i
      allowed_slots << i if $game_switches[switch_id] == true
    end
    
  selected_party = allowed_slots.map { |i| $player.party[i] }.compact

  $player.party = selected_party
 
    setBattleRule("backdrop", "water_night")
    setBattleRule("environment", "water")
  
    $temporary_banned_moves = DisabledMoves.clone
 
    end
  end

#===============================================================================
# Fire-type and Temporary Banned Moves System
#===============================================================================

def pbMoveIsBanned?(move_id)
  return false if $temporary_banned_moves.nil? || $temporary_banned_moves.empty?
  move_data = GameData::Move.try_get(move_id)
  return false if move_data.nil?
  return true if $temporary_banned_moves.include?(move_data.id)
  return false
end

#-----------------------------------------------------------------------------
# Battle hook: Prevents banned or Fire-type moves from being used.
#-----------------------------------------------------------------------------
class Battle::Battler
  alias_method :bannedmoves_pbTryUseMove, :pbTryUseMove unless method_defined?(:bannedmoves_pbTryUseMove)

  def pbTryUseMove(*args)
    move_obj = nil
    if args[0].is_a?(Battle::Move)
      move_obj = args[0]
    elsif args[0].is_a?(Array) && args[0][2].is_a?(Battle::Move)
      move_obj = args[0][2]
    end
    return bannedmoves_pbTryUseMove(*args) if move_obj.nil?

    move_data = GameData::Move.try_get(move_obj.id)
    return bannedmoves_pbTryUseMove(*args) if move_data.nil?

    # --- Block Fire-type moves ---
    if move_data.type == :FIRE
      battle.pbDisplay(_INTL("{1} tried to use {2} but the vast amount of water fizzled it out!", name, move_obj.name))
      return false
    end

    # --- Block temporarily banned moves ---
    if pbMoveIsBanned?(move_obj.id)
      battle.pbDisplay(_INTL("{1} can’t use {2} because of the vast amount of water!", name, move_obj.name))
      return false
    end

    bannedmoves_pbTryUseMove(*args)
  end
end

#-----------------------------------------------------------------------------
# Automatically clear banned moves after any battle ends
#-----------------------------------------------------------------------------
EventHandlers.add(:on_end_battle, :clear_temp_move_bans,
  proc {
    next if $temporary_banned_moves.nil? || $temporary_banned_moves.empty?
    $temporary_banned_moves.clear
  }
)

  
  
def pbResetParty
$player.party = $stored_party
$stored_party = nil
end


As well as banning pokemon and moves this will also change the battle background and battle message box. In the code if you search for:
setBattleRule("backdrop", "water_night")
setBattleRule("environment", "water")
Then you can change it to what ever you want by changing "Water_night" and "Water".

To be able to set the next battle with these rules run pbDiveBattle? in a script command just before you start a battle, and after the battle is finished run pbResetParty to set your party back to what it was before.
Credits
Not needed.
  • Like
Reactions: Ophilia
Author
Radboy1244
Views
60
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Radboy1244

Back
Top