• 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.
Water current/ treadmills for Essentials v21.1

v21.1 Water current/ treadmills for Essentials v21.1 1.1

This resource pertains to version 21.1 of Pokémon Essentials.
The plugin was created to make the old tutorial work in version 21.1, below is the explanation of what was done and scripts, it is no longer necessary to modify pokemon Essentials scripts.rxdata


It is possible to find how to make water currents in version 20 and 20.1, but it does not work properly in version v21.1, I made the changes about a few months ago in the original post, but many may not have seen it.
So I bring here the updated tutorial.
The treadmills part is optional, I left it separate because before there was a bug that you couldn't surf, so I separated the mats so as not to use surfing on them


this is the old tutorial:
Water current V20/20.1


was added "attr_reader :water current" in the TerrainTag script section "attr_reader:ignore passability"

Then where it says "@ignore_passability" was added "@water_current = hash[:water_current]" || false on the next line.

This should look like this:

TerrainTag:
Expand Collapse Copy
module GameData
  class TerrainTag
    attr_reader :id
    attr_reader :id_number
    attr_reader :real_name
    attr_reader :can_surf
    attr_reader :waterfall   # The main part only, not the crest
    attr_reader :waterfall_crest
    attr_reader :can_fish
    attr_reader :can_dive
    attr_reader :deep_bush
    attr_reader :shows_grass_rustle
    attr_reader :land_wild_encounters
    attr_reader :double_wild_encounters
    attr_reader :battle_environment
    attr_reader :ledge
    attr_reader :ice
    attr_reader :bridge
    attr_reader :shows_reflections
    attr_reader :must_walk
    attr_reader :must_walk_or_run
    attr_reader :ignore_passability
    attr_reader :water_current
    attr_reader :treadmills
    DATA = {}

    extend ClassMethods
    include InstanceMethods

    # @param other [Symbol, self, String, Integer]
    # @return [self]
    def self.try_get(other)
      return self.get(:None) if other.nil?
      validate other => [Symbol, self, String, Integer]
      return other if other.is_a?(self)
      other = other.to_sym if other.is_a?(String)
      return (self::DATA.has_key?(other)) ? self::DATA[other] : self.get(:None)
    end

    def self.load; end
    def self.save; end

    def initialize(hash)
      @id                     = hash[:id]
      @id_number              = hash[:id_number]
      @real_name              = hash[:id].to_s                || "Unnamed"
      @can_surf               = hash[:can_surf]               || false
      @waterfall              = hash[:waterfall]              || false
      @waterfall_crest        = hash[:waterfall_crest]        || false
      @can_fish               = hash[:can_fish]               || false
      @can_dive               = hash[:can_dive]               || false
      @deep_bush              = hash[:deep_bush]              || false
      @shows_grass_rustle     = hash[:shows_grass_rustle]     || false
      @land_wild_encounters   = hash[:land_wild_encounters]   || false
      @double_wild_encounters = hash[:double_wild_encounters] || false
      @battle_environment     = hash[:battle_environment]
      @ledge                  = hash[:ledge]                  || false
      @ice                    = hash[:ice]                    || false
      @bridge                 = hash[:bridge]                 || false
      @shows_reflections      = hash[:shows_reflections]      || false
      @must_walk              = hash[:must_walk]              || false
      @must_walk_or_run       = hash[:must_walk_or_run]       || false
      @ignore_passability     = hash[:ignore_passability]     || false
      @water_current          = hash[:water_current]          || false
      @treadmills             = hash[:treadmills]             || false
    end

    alias name real_name

    def can_surf_freely
      return @can_surf && !@waterfall && !@waterfall_crest
    end
  end
end


In addition to the game's original all-terrain tag, it has been added
if you have a custom terrainTag, check the IDS

Ruby:
Expand Collapse Copy
GameData::TerrainTag.register({
  :id                     => :currentNorth,
  :id_number              => 18,
  :can_surf               => true,
  :water_current          => true
})

GameData::TerrainTag.register({
  :id                     => :currentEast,
  :id_number              => 19,
  :can_surf               => true,
  :water_current          => true
})

GameData::TerrainTag.register({
  :id                     => :currentWest,
  :id_number              => 20,
  :can_surf               => true,
  :water_current          => true
})

GameData::TerrainTag.register({
  :id                     => :currentSouth,
  :id_number              => 21,
  :can_surf               => true,
  :water_current          => true
})

GameData::TerrainTag.register({
  :id                     => :treadmillsNorth,
  :id_number              => 30,
  :treadmills          => true
})

GameData::TerrainTag.register({
  :id                     => :treadmillsEast,
  :id_number              => 31,
  :treadmills          => true
})

GameData::TerrainTag.register({
  :id                     => :treadmillsWest,
  :id_number              => 32,
  :treadmills          => true
})

GameData::TerrainTag.register({
  :id                     => :treadmillsSouth,
  :id_number              => 33,
  :treadmills          => true

These terrain tags will be responsible for identifying in which direction the player will be launched, remember, you need:
1- enter the game
2- access the debug menu
3- go to other editors
4- edit terracing tag
5- choose the tileset
6-add the tag corresponding to the direction you want on the graph, it also works with autotile.

in the overworld script, in the part where it says " # Auto-move the player over waterfalls and ice" , was added:
elsif currentTag.water_current || $PokemonGlobal.sliding
pbWaterCurrent

elsif currentTag.treadmills || $PokemonGlobal.sliding
pbtreadmills


ending up like this:
Ruby:
Expand Collapse Copy
# Auto-move the player over waterfalls and ice
EventHandlers.add(:on_step_taken, :auto_move_player,
  proc { |event|
    next if !$scene.is_a?(Scene_Map)
    next if event != $game_player
    currentTag = $game_player.pbTerrainTag
    if currentTag.waterfall_crest || currentTag.waterfall ||
       $PokemonGlobal.descending_waterfall || $PokemonGlobal.ascending_waterfall
      pbTraverseWaterfall
    elsif currentTag.ice || $PokemonGlobal.ice_sliding
      pbSlideOnIce
[COLOR=rgb(41, 105, 176)]      elsif currentTag.water_current || $PokemonGlobal.sliding
      pbWaterCurrent[/COLOR]
 [COLOR=rgb(184, 49, 47)]  elsif currentTag.treadmills || $PokemonGlobal.sliding
      pbtreadmills[/COLOR]
    end
  }
)

In the overworld script, at the end of the " pbMoveTowardPlayer(event)" section the def pbWaterCurrent was added

Ruby:
Expand Collapse Copy
def pbWaterCurrent
  if !$DEBUG || !Input.press?(Input::CTRL)
    return if !$game_player.pbTerrainTag.water_current
    $game_temp.followers.update
    $PokemonGlobal.sliding = true
    in_water_current = true
    direction = $game_player.direction
    oldwalkanime = $game_player.walk_anime
    first_loop = true

    loop do
      if in_water_current
        case $game_player.pbTerrainTag.id
        when :currentNorth
          direction = 8
        when :currentEast
          direction = 6
        when :currentSouth
          direction = 2
        when :currentWest
          direction = 4
        end
      end

      break if !$game_player.pbTerrainTag.water_current

      if direction == $game_player.direction
        $game_player.move_forward
      else
        in_water_current = false
        case direction
        when 8
          $game_player.move_up
        when 6
          $game_player.move_right
        when 2
          $game_player.move_down
        when 4
          $game_player.move_left
        end
      end

      $game_temp.followers.move_followers if first_loop

      while $game_player.moving?
        pbUpdateSceneMap
        Graphics.update
        Input.update
      end
      first_loop = false

      while $game_player.moving?
        Graphics.update
        Input.update
        pbUpdateSceneMap
      end

      $game_player.center($game_player.x, $game_player.y)
      $game_player.straighten
      $game_player.walk_anime = oldwalkanime
      $PokemonGlobal.sliding = false
    end
  end
end
def pbtreadmills
  if !$DEBUG || !Input.press?(Input::CTRL)
    return if !$game_player.pbTerrainTag.treadmills
    $game_temp.followers.update
    $PokemonGlobal.sliding = true
    in_treadmills = true
    direction = $game_player.direction
    oldwalkanime = $game_player.walk_anime
    first_loop = true

    loop do
      if in_treadmills
        case $game_player.pbTerrainTag.id
        when :treadmillsNorth
          direction = 8
        when :treadmillsEast
          direction = 6
        when :treadmillsSouth
          direction = 2
        when :treadmillsWest
          direction = 4
        end
      end

      break if !$game_player.pbTerrainTag.treadmills

      if direction == $game_player.direction
        $game_player.move_forward
      else
        in_treadmills = false
        case direction
        when 8
          $game_player.move_up
        when 6
          $game_player.move_right
        when 2
          $game_player.move_down
        when 4
          $game_player.move_left
        end
      end

      $game_temp.followers.move_followers if first_loop

      while $game_player.moving?
        pbUpdateSceneMap
        Graphics.update
        Input.update
      end
      first_loop = false

      while $game_player.moving?
        Graphics.update
        Input.update
        pbUpdateSceneMap
      end

      $game_player.center($game_player.x, $game_player.y)
      $game_player.straighten
      $game_player.walk_anime = oldwalkanime
      $PokemonGlobal.sliding = false
    end
  end
end

This part is responsible for associating the directions the player will go with the previously mentioned Terraintag.


In "Overworld Metadata", the following has been added to the "Pokemon Global Metadata" class
attr_accessor :sliding

it will look like this:
Ruby:
Expand Collapse Copy
class PokemonGlobalMetadata
  # Movement
  attr_accessor :bicycle
  attr_accessor :surfing
  attr_accessor :diving
  attr_accessor :ice_sliding
  attr_accessor :sliding
  attr_accessor :descending_waterfall
  attr_accessor :ascending_waterfall
  attr_accessor :fishing

attr_accessor :sliding is essential for step 2 and 3 to work

in the Overworld Wild Encounters script, was added before the last return false in def encounter possible here?

return false if terrain_tag.water_current
like this:
Ruby:
Expand Collapse Copy
  def encounter_possible_here?
    return true if $PokemonGlobal.surfing
    terrain_tag = $game_map.terrain_tag($game_player.x, $game_player.y)
    return false if terrain_tag.ice
    return true if has_cave_encounters?   # i.e. this map is a cave
    return true if has_land_encounters? && terrain_tag.land_wild_encounters
   return false if terrain_tag.water_current
   return false if terrain_tag.treadmills
   return false
  end

Check the terraintag IDS if you have added any other custom ones

If you are using the "Visible Overworld Wild Encounters" plugin, be aware of bugs such as:

When exiting a battle that started while moving through the current, the player returns to the map stationary and can escape the current. A separate fix is being developed, but for now, you can prevent wild encounters while using the current.
Credits
ChromusSama => main script
Vendily and Techskylander1518 => helping fixing a bug
Rafahbit = > portability to essentials v21.1
googud => was responsible for identifying and solving some bugs in the script, so we thank him
  • water current.mp4
    3.4 MB
  • SpinDown.png
    SpinDown.png
    306 bytes · Views: 35
  • SpinLeft.png
    SpinLeft.png
    283 bytes · Views: 39
  • Spinright.png
    Spinright.png
    283 bytes · Views: 31
  • SpinUp.png
    SpinUp.png
    309 bytes · Views: 42
  • Water current east.png
    Water current east.png
    523 bytes · Views: 38
  • Water current north.png
    Water current north.png
    591 bytes · Views: 38
  • Water current south.png
    Water current south.png
    579 bytes · Views: 28
  • Water current west.png
    Water current west.png
    548 bytes · Views: 37
  • Like
Reactions: ardicoozer
Author
rafahbit
Downloads
138
Views
1,837
First release
Last update

Ratings

0.00 star(s) 0 ratings

Latest updates

  1. modification to plugin

    a plugin was created to override the original scripts so it is not necessary to modify the...
Back
Top