• 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!
Bounce as a field move

v20.1 Bounce as a field move 2022-12-24

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
Jumping.gif

My quest for more overworld moves continues with Bounce! This lets the player use Bounce to get the ability to jump over the tile directly in front of them! (Provided they can stand on the next tile, of course)

Code​

Paste in a new script section above Main, or download as a plugin here.
Ruby:
module Settings
  BADGE_FOR_BOUNCE = 0
end

class PokemonMapMetadata
  attr_accessor :bounceUsed
 
  alias oldclear clear
  def clear
    oldclear
    @bounceUsed   = false
  end
 
end

HiddenMoveHandlers::CanUseMove.add(:BOUNCE, proc { |move, pkmn, showmsg|
  #next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_BOUNCE, showmsg)
  if $PokemonMap.bounceUsed
    pbMessage(_INTL("Bounce is already being used.")) if showmsg
    next false
  end
  next true
})

HiddenMoveHandlers::UseMove.add(:BOUNCE, proc { |move, pokemon|
  if !pbHiddenMoveAnimation(pokemon)
    pbMessage(_INTL("{1} used {2}!\1", pokemon.name, GameData::Move.get(move).name))
  end
  pbMessage(_INTL("Bounce made it possible to jump using the ALT key!"))
  $PokemonMap.bounceUsed = true
  next true
})

class Scene_Map
  def update
    loop do
      pbMapInterpreter.update
      $game_player.update
      updateMaps
      $game_system.update
      $game_screen.update
      break unless $game_temp.player_transferring
      transfer_player(false)
      break if $game_temp.transition_processing
    end
    updateSpritesets
    if $game_temp.title_screen_calling
      $game_temp.title_screen_calling = false
      SaveData.mark_values_as_unloaded
      $scene = pbCallTitle
      return
    end
    if $game_temp.transition_processing
      $game_temp.transition_processing = false
      if $game_temp.transition_name == ""
        Graphics.transition
      else
        Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name)
      end
    end
    return if $game_temp.message_window_showing
    if !pbMapInterpreterRunning?
      if Input.trigger?(Input::USE)
        $game_temp.interact_calling = true
      elsif Input.trigger?(Input::ACTION)
        unless $game_system.menu_disabled || $game_player.moving?
          $game_temp.menu_calling = true
          $game_temp.menu_beep = true
        end
      elsif Input.trigger?(Input::SPECIAL)
        unless $game_player.moving?
          $game_temp.ready_menu_calling = true
        end
      #bouncetech
      elsif Input.trigger?(Input::ALT) && $PokemonMap.bounceUsed
        facingtile = $map_factory.getFacingTile($game_player.direction,$game_player)
        unless $game_player.moving? || $game_map.counter?(facingtile[1],facingtile[2])
          frombridge = $game_player.terrain_tag.bridge
          fromsurf = $PokemonGlobal&.surfing
          nexttile = $map_factory.getFacingTile($game_player.direction, $game_player, 2)
          nextterrain = $map_factory.getTerrainTag(nexttile[0],nexttile[1],nexttile[2])
          cancelsurf = !nextterrain.can_surf
          if pbJumpToward(2, true, cancelsurf)
            pbBridgeOff if frombridge && !$game_player.terrain_tag.bridge
            $scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID, $game_player.x, $game_player.y, true, 1) unless $game_player.terrain_tag.can_surf
            $game_player.increase_steps
            $game_player.check_event_trigger_here([1, 2])
          end
        end
      elsif Input.press?(Input::F9)
        $game_temp.debug_calling = true if $DEBUG
      end
    end
    unless $game_player.moving?
      if $game_temp.menu_calling
        call_menu
      elsif $game_temp.debug_calling
        call_debug
      elsif $game_temp.ready_menu_calling
        $game_temp.ready_menu_calling = false
        $game_player.straighten
        pbUseKeyItem
      elsif $game_temp.interact_calling
        $game_temp.interact_calling = false
        $game_player.straighten
        EventHandlers.trigger(:on_player_interact)
      end
    end
  end
 
end

Part of this script does overwrite the update command for the Scene_Map class. If you're concerned about any incompatibilities, you can just add the top half of the script (everything above class Scene_Map), and add this part in the script section Scene_Map, right above elsif Input.press?(Input::F9).
Ruby:
      elsif Input.trigger?(Input::ALT) && $PokemonMap.bounceUsed
        facingtile = $map_factory.getFacingTile($game_player.direction,$game_player)
        unless $game_player.moving? || $game_map.counter?(facingtile[1],facingtile[2])
          frombridge = $game_player.terrain_tag.bridge
          fromsurf = $PokemonGlobal&.surfing
          nexttile = $map_factory.getFacingTile($game_player.direction, $game_player, 2)
          nextterrain = $map_factory.getTerrainTag(nexttile[0],nexttile[1],nexttile[2])
          cancelsurf = !nextterrain.can_surf
          if pbJumpToward(2, true, cancelsurf)
            pbBridgeOff if frombridge && !$game_player.terrain_tag.bridge
            $scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID, $game_player.x, $game_player.y, true, 1) unless $game_player.terrain_tag.can_surf
            $game_player.increase_steps
            $game_player.check_event_trigger_here([1, 2])
          end
        end

There is no v19 version of this script, as I didn't get around to updating it before v20 came out. I currently do not have plans to offer v19 support.

The v18 version of this script involved a lot of weird changes to the base scripts and, of all things, a common event on top of it all. I really don't recommend using it now, but it's left here for posterity.
There's a few steps to this process!

In PField_Field, add this to the bottom:

Ruby:
#===============================================================================
# Bounce
#===============================================================================

def pbBounce
    new_x = $game_player.x + ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
    new_y = $game_player.y + ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
  if Input.trigger?(Input::ALT) && !$PokemonGlobal.surfing &&
    !$game_player.moving? && !$game_system.map_interpreter.running? &&
    !PBTerrain.isBridge?(pbGetTerrainTag($game_player)) && $PokemonMap.bounceUsed &&
    !$game_map.counter?(new_x, new_y)
    pbBridgeOn
    if !PBTerrain.isBridge?(pbFacingTerrainTag)
        pbMoveRoute($game_player,[PBMoveRoute::AlwaysOnTopOn])
      end
      pbBridgeOff
  if  pbJumpToward(2,true)
      $scene.spriteset.addUserAnimation(DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)
      $game_player.increase_steps
       if !PBTerrain.isGrass?($game_map.terrain_tag($game_player.x,$game_player.y)) && !pbGetEnvironment==PBEnvironment::Cave
        $PokemonEncounters.clearStepCount
       end
      $game_player.check_event_trigger_here([1,2])
      Graphics.update
      Input.update
      pbUpdateSceneMap
    end
  pbMoveRoute($game_player,[PBMoveRoute::AlwaysOnTopOff])
  end
end

In PField_FieldMoves, add this at the bottom:
Ruby:
#===============================================================================
# Bounce
#===============================================================================


HiddenMoveHandlers::CanUseMove.add(:BOUNCE,proc { |move,pkmn,showmsg|
  if $PokemonMap.bounceUsed
    pbMessage(_INTL("Bounce is already being used.")) if showmsg
    next false
  end
  if $PokemonGlobal.surfing
    pbMessage(_INTL("Can't do that while surfing.")) if showmsg
    next false
  end
  next true
})

HiddenMoveHandlers::UseMove.add(:BOUNCE,proc { |move,pokemon|
  if !pbHiddenMoveAnimation(pokemon)
    pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
  end
    pbMessage(_INTL("{1} made it possible to jump with the Alt key!",pokemon.name))
    $PokemonMap.bounceUsed=true
  next true
})

Go to PField_Metadata and find:
Ruby:
class PokemonMapMetadata
  attr_reader :erasedEvents
  attr_reader :movedEvents
  attr_accessor :strengthUsed
  attr_accessor :blackFluteUsed
  attr_accessor :whiteFluteUsed
Below that, add:
Ruby:
  attr_accessor :bounceUsed
Ruby:
  def clear
    @erasedEvents   = {}
    @movedEvents    = {}
    @strengthUsed   = false
    @blackFluteUsed = false
    @whiteFluteUsed = false
  end
Right before "end", add
Ruby:
    @bounceUsed     = false

And one final step: Create a common event set to parallel process. It should just run pbBounce, and its condition switch should be something you intend to leave On, like access to the PokeDex.
1611625064084.png

(Apologies for this step- I know it's really weird, but when I playtested without this, sometimes the functionality would cut out, and this was the only fix I could find.)

Mechanics​

I chose Alt for jumping, because it's near the space bar but isn't already used for anything else. Unfortunately, I'm not especially familiar with adding controls in v20, but you can look in the section Input to see what's already defined, or check out the wiki's articles on Controls. (I think you could also change it to triggerex? to check for a specific key, but I'm not sure that would acknowledge any keybindings)

If Bounce is used to jump from a bridge tile to a non-bridge tile, it will assume that you're jumping off the bridge, and run pbBridgeOff. (You may want to make your bridge on/off events 2x2 tiles, so players can't jump over them)

Bounce can be used while surfing. The player can jump from sea to land, but not from land to sea.

Bounce doesn't let the player jump across a counter, but if you'd like to add that, just comment out || $game_map.counter?(facingtile[1],facingtile[2]).

Poisoned Pokémon will still take damage, and wild encounters can still be triggered if the player lands in grass or a cave. Egg will still have their steps decreased by jumps, but it will only be by one.

If the player lands on any player touch/event touch events (including jumping into the line of sight of an event), the event will still trigger.

Bounce does not require any badges, but you can change that by editing the BADGE_FOR_BOUNCE value at the top and uncommenting the line next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_BOUNCE, showmsg).
I chose Alt for jumping, because it's near the space bar but isn't already used for anything else. If you want to change that, it's easy to just look in PSystem_Control and see what other keys are already programmed, or use Marin's tutorial on adding input keys to add more.

Bounce can't be used while surfing, to jump across a counter, or while on a bridge. (You can still jump under bridges, though) You can jump over a trainer's line of sight, but if you land in front of them, they will see you. Poisoned Pokémon will still take damage, and wild encounters can still be triggered if the player lands in grass or a cave. Egg will still have their steps decreased by jumps, but it will only be by one.

The player will still trigger events that they land on, provided that they're intended to be stepped on and not like, NPCs or item balls or the like.

When to give the player Bounce​

When the player receives Bounce, they're going to be given a way around a lot of obstacles. Not only will Bounce make Cut and Rock Smash near-obsolete, it will also let them skip past trainers and ledges, as well as possibly giving them ways around Strength and Ice Puzzles. Because of this, I personally recommend you give Bounce to the player in the postgame, so your whole game doesn't become a cakewalk. (Alternatively, if you want to let them use Bounce in battle but not in the overworld, you could add in another switch to control when they're allowed to use it, like a gym badge)

There's another issue with Bounce- The player can use Bounce to jump over tiles that would trigger a roadblock event.
Leaving.gif
You could definitely work around this, but that would mean putting two sets of roadblocks every time you want to keep the player somewhere. That sounds really annoying to me, so I'd definitely want to cut down on how often I had to do that lol. The later in the game you give it, the less you have to worry about it!

Little bit of an update - Essentials v19 now lets you set events to be bigger than just one tile, so this shouldn't be an issue anymore! If you're using an earlier version, you could make a border with my Better Barriers script to do something similar!

Known Issues​

  • If you jump into grass/a cave and an encounter starts, the dust cloud animation will still be going when you exit the battle.
  • Jumping behind a large object like a building can look a bit clippy. I also recommend giving the tiles below the top row of the building increased priority, so the player doesn't clip through those.
  • I had a problem earlier where jumping out of grass could still trigger an encounter. As far as I know, that has been fixed, but let me know if you encounter it!

Ideas with Bounce​

For the most part, Bounce will kind of serve as this catch-all field move, but there's some things you could do to make it more unique!
  • Get rid of my check for the counter, and let the player hop over whatever counters they want! Maybe there's a secret backroom in the PokéMart, or they can watch someone else fighting in a battle facility!
  • Create events that work as projectiles and let the player jump over them! Maybe a Fire-type legendary spits fireballs at you, and you have to get past them to be able to battle it!
  • We all know about holes to let the player fall through to the floor below, but why not let the player jump over safety railings to fall somewhere unique? Just put an event on the other side of some guardrails!

Future Goals​

Bouncing while surfing needs a lot of touching up. There seems to be a bug when directly facing a land tile - you'll jump off your base and onto shore, and then jump again. The base also jumps with you if you're I'd also like to improve the visuals of it more - add a splash animation when landing like when jumping on land, and maybe create a "jumping surf base" sprite

Need to playtest this with the Overworld Shadows script and see how it looks.

I'd like to figure out a way to let players interact with events in mid-air. Jumping usually ignores events, unfortunately, so it's not as simple as just making them player touch and check if they're jumping.

I might need to do some more work with tiles with increased priority. Like, here -
1671877752231.png

The player can jump over these beams, because there's only one tile that's actually impassable. But it makes it look like they're just phasing through them.

Looking for more field moves?​

You may also be interested in Lucidious89's Improved Field Skills.
Credits
Credits to TechSkylander1518, please!
Author
TechSkylander1518
Downloads
462
Views
3,357
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from TechSkylander1518

Latest updates

  1. v20 Update

    Much-needed overhaul with this update! No more complicated script changes or common events, just...
Back
Top