• 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!
Resource icon

v21.1 Add the function of exchanging ball types in the Party UI 2024-08-24

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v21.1 ✅
Allow players to easily switch between different types of balls

Ruby:
Expand Collapse Copy
MenuHandlers.add(:party_menu, :change_ball, {
  "name"      => _INTL("Ball"),
  "order"     => 35,
  "condition" => proc { |screen, party, party_idx| next !party[party_idx].egg? && !party[party_idx].mail },
  "effect"    => proc { |screen, party, party_idx|
    balls = $bag.pockets[3].map { |ball| GameData::Item.try_get(ball[0]) }
    if balls.empty?
      pbMessage(_INTL("You don't have any balls in your bag."))
      next
    end
    balls.sort_by! { |ball| ball.name }
    commands = balls.map { |ball| ball.name }
    pkmn = party[party_idx]
    current_ball_id = pkmn.poke_ball
    current_ball_name = GameData::Item.try_get(current_ball_id)&.name
    current_cmd = balls.index { |ball| ball.id == current_ball_id } || 0
    selected_cmd = screen.pbShowCommands(_INTL("Select a ball to swap.\nCurrent:{1}", current_ball_name), commands, current_cmd)
    next if selected_cmd < 0
    new_ball = balls[selected_cmd]
    if new_ball.id == current_ball_id
      pbMessage(_INTL("The ball you have selected is the same as the current ball."))
      next
    end
    $bag.remove(new_ball.id)
    pkmn.poke_ball = new_ball.id
    pbMessage(_INTL("The Pokemon's ball was changed to {1}.", new_ball.name))
    screen.pbRefreshSingle(party_idx)
  }
})
Credits
Halily
TAAAAAAA
  • Like
Reactions: NikDie
Author
halily
Views
490
First release
Last update

Ratings

5.00 star(s) 1 ratings
Back
Top