• The Eevee Expo Game Jam #10 has concluded, congratulations to all participants! Now it's time for the judges to play through the games, and you can play along to vote who deserves the community choice spotlight.
    You can check out the submitted games here!
    Play through the games and provide some feedback to the devs while you're at it!
  • Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Battle Size Options

v21.1 Battle Size Options 2022-05-20

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
1653007771940.png

Simple little add-on that lets players choose between Singles, Doubles, or Triples in the Options menu!
Plugin is made for v20/v21, code for v18/v19 is included in this post​

Code​

Can be pasted in a new script section above Main, or can be downloaded as a plugin here.
Ruby:
Expand Collapse Copy
class PokemonSystem
  attr_accessor :battlesize
 
  alias oldinitialize initialize

  def initialize
    oldinitialize
    @battlesize    = 0     # Battle size (0 = single, 1 = double 2 = triple)
  end
end

MenuHandlers.add(:options_menu, :text_input_style, {
  "name"        => _INTL("Battle Size"),
  "order"       => 55,
  "type"        => EnumOption,
  "parameters"  => [_INTL("Single"), _INTL("Double"), _INTL("Triple")],
  "description" => _INTL("Choose the size battles are fought in."),
  "get_proc"    => proc { next $PokemonSystem.battlesize },
  "set_proc"    => proc { |value, _scene| $PokemonSystem.battlesize = value }
})


EventHandlers.add(:on_trainer_load, :battle_size_option,
  proc { |trainer|
    if !$game_temp.battle_rules["size"] && trainer
    case $PokemonSystem.battlesize
      when 1
          setBattleRule("double") if pbCanDoubleBattle?
      when 2
          setBattleRule("triple") if pbCanTripleBattle?
          setBattleRule("double") if !pbCanTripleBattle? && pbCanDoubleBattle?
      end
    end
  }
)



For v18/v19, I had written out instructions to add it directly to the Options script.
A few steps to putting in this one, but nothing especially complicated!

In UI_Options (PScreen_Options in earlier versions), right at the top-
Ruby:
Expand Collapse Copy
class PokemonSystem
  attr_accessor :textspeed
  attr_accessor :battlescene
  attr_accessor :battlestyle
  attr_accessor :frame
  attr_writer   :textskin
  attr_accessor :font
  attr_accessor :screensize
  attr_writer   :border
  attr_writer   :language
  attr_writer   :runstyle
  attr_writer   :bgmvolume
  attr_writer   :sevolume
  attr_writer   :textinput
Add:
Ruby:
Expand Collapse Copy
  attr_accessor :battlesize

Below that:
Ruby:
Expand Collapse Copy
  def initialize
    @textspeed   = 1     # Text speed (0=slow, 1=normal, 2=fast)
    @battlescene = 0     # Battle effects (animations) (0=on, 1=off)
    @battlestyle = 0     # Battle style (0=switch, 1=set)
    @frame       = 0     # Default window frame (see also $TextFrames)
    @textskin    = 0     # Speech frame
    @font        = 0     # Font (see also $VersionStyles)
    @screensize  = (SCREEN_ZOOM.floor).to_i   # 0=half size, 1=full size, 2=double size
    @border      = 0     # Screen border (0=off, 1=on)
    @language    = 0     # Language (see also LANGUAGES in script PokemonSystem)
    @runstyle    = 0     # Run key functionality (0=hold to run, 1=toggle auto-run)
    @bgmvolume   = 100   # Volume of background music and ME
    @sevolume    = 100   # Volume of sound effects
    @textinput   = 0     # Text input mode (0=cursor, 1=keyboard)

Add:
Ruby:
Expand Collapse Copy
    @battlesize  = 0     # Battle size (0 = single, 1 = double)

Further down, below
Ruby:
Expand Collapse Copy
       EnumOption.new(_INTL("Battle Effects"),[_INTL("On"),_INTL("Off")],
         proc { $PokemonSystem.battlescene },
         proc { |value| $PokemonSystem.battlescene = value }
       ),
Add
Ruby:
Expand Collapse Copy
       EnumOption.new(_INTL("Battle Size"),[_INTL("Single"),_INTL("Double"),_INTL("Triple")],
         proc { $PokemonSystem.battlesize },
         proc { |value| $PokemonSystem.battlesize = value }
       ),

If you want to take Triple off the table, just remove ",_INTL("Triple")"

This last part can technically be put in any section, but I think it's best to put in PField_EncounterModifiers, with similar scripts-
Ruby:
Expand Collapse Copy
Events.onTrainerPartyLoad += proc { |_sender, e|
  if $PokemonTemp.battleRules["size"] == nil && e[0]
  case $PokemonSystem.battlesize
    when 1
        setBattleRule("double") if pbCanDoubleBattle?
    when 2
        setBattleRule("triple") if pbCanTripleBattle?
        setBattleRule("double") if !pbCanTripleBattle? && pbCanDoubleBattle?
    end
  end
}

Using the code​

You can overwrite the player's choice of battle size with the standard setBattleRule command!

If either the player or the opponent doesn't have enough Pokémon for a full side, then the battle will go down a size. For example, if the player has Triple battles turned on, but they only have two Pokémon that can fight, they'll fight opponents in a Double Battle.

Todo List​

Potentially, adjust this so that the option for doubles and triples doesn't even appear if the player doesn't have enough Pokémon. It was awkward when I tried to set that up, though, and it's not really necessary.
Credits
Credit to TechSkylander1518, please!
Author
TechSkylander1518
Downloads
641
Views
4,055
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from TechSkylander1518

Latest updates

  1. v20 Update

    Quick update for v20! Plugin version now included as well.
Back
Top