• 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

Tutorial Water current for Essentials v20/20.1 1.0

ChromusSama

Novice
Member
Joined
Nov 2, 2020
Posts
14
Shir0n submitted a new resource:

Water current for Essentials v20/20.1 - A tutorial on how to add water currents to your game

Hi everyone! In this tutorial, I'm gonna show you how to add water currents to your game.
Before starting, be aware that this is for Essentials v20/20.1, and I'm not planning to make any compatibility with older versions of Essentials. This also isn't compatible with PSDK.

STEP 1 : TerrainTag section

In your script editor, go in the TerrainTag section and look for attr_reader :ignore_passability.
Add attr_reader...

Read more about this resource...
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
Mmm... currents work sort of similar to the spin tiles so this tutorial could be used with your animated spin tiles to recreate them too. (The spin tiles made the character spin, but I think that little detail can be overlooked).
 

rafahbit

Trainer
Member
Joined
Oct 21, 2020
Posts
53
I modified the script to work with 21.1; however, I tried to create a plugin because there are some additional changes required to make it work.

In the section of the def pbWaterCurrent, it should be this script:

def pbwatercurrent:
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

And now the additional parts:

in overworld # Auto-move the player over waterfalls and ice, add:
elsif currentTag.water_current || $PokemonGlobal.sliding
pbWaterCurrent
remaining like this:
# 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
elsif currentTag.water_current || $PokemonGlobal.sliding
pbWaterCurrent

end
}
)

In the "Overworld_Metadata," add the following to the class "PokemonGlobalMetadata"
attr_accessor :sliding

remaining like this

# 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

With these changes, I managed to make it work correctly in version 21.1, but I'm not very skilled with scripts and code. If anyone wants to create a plugin or improve the part I've done, please feel free to do so.

how it turned out:
 

Attachments

  • Pokémon Essentials v21.1 2023-10-21 18-32-00.mp4
    14.9 MB

bjorn__92

Rookie
Member
Joined
May 8, 2020
Posts
7
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.6]

Exception: NoMethodError
Message: undefined method `pbterraintag' for #<Game_Player>

Backtrace:
Overworld:614:in `block in pbWaterCurrent'
Overworld:613:in `loop'
Overworld:613:in `pbWaterCurrent'
Overworld:172:in `block in <main>'
Event_Handlers:89:in `block in trigger'
Event_Handlers:89:in `each_value'
Event_Handlers:89:in `trigger'
Event_HandlerCollections:63:in `trigger'
Game_Character:932:in `update_move'
Game_Player:497:in `update_move'

I have this error on v20.1 can somebody help me
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.6]

Exception: NoMethodError
Message: undefined method `pbterraintag' for #<Game_Player>

Backtrace:
Overworld:614:in `block in pbWaterCurrent'
Overworld:613:in `loop'
Overworld:613:in `pbWaterCurrent'
Overworld:172:in `block in <main>'
Event_Handlers:89:in `block in trigger'
Event_Handlers:89:in `each_value'
Event_Handlers:89:in `trigger'
Event_HandlerCollections:63:in `trigger'
Game_Character:932:in `update_move'
Game_Player:497:in `update_move'

I have this error on v20.1 can somebody help me
The method is case-sensitive. You wrote pbterraintag when it is pbTerrainTag.
 

Pigbot3

Rookie
Member
Joined
Apr 25, 2022
Posts
7
I know v21 is out now and this resource is supposedly outdated, but I am still working in v20.1 (don't ask me) and was wondering if the images(?) on this post could be re-added, assuming they still exist. I couldn't find them on the wayback machine either :(. They're named like "water_current_1.png" Alternatively, if anyone has the code for the "four terrain tag registrations" (like should they have can_surf or not, what else should they have, etc), the "two lines between pbSlideOnIce and end :", the thing "after the last end" in pbSlideonIce, and the line "before the last return false : " in def encounter_possible_here?. I just want to know what I should be doing to make it work. Thank you so much!
 
Back
Top