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

rafahbit

Novice
Member
Joined
Oct 21, 2020
Posts
42
rafahbit submitted a new resource:

Water current for Essentials v21.1 - Water current

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.

this is the old tutorial:
Water current V20/20.1

changes are made to the game's base scripts, so make a backup beforehand to avoid losing your project.

STEP 1 : TerrainTag...

Read more about this resource...
 

Willix

Novice
Member
Joined
Feb 7, 2024
Posts
22
Thanks for your help with this, I followed your steps (but made it a plugin) and it works fine. However, there's a bug if you try to surf directly over a current terrain, which is something that I need to work because how some parts of my game are made. Do you know how to fix this? I recorded a little clip for reference. If you enter the current while surfing everything works ok, but if you 'jump' over it glitches.
 

Attachments

  • watercurrent.mp4
    1.9 MB
  • watercurrentbug.mp4
    2.4 MB

rafahbit

Novice
Member
Joined
Oct 21, 2020
Posts
42
Thanks for your help with this, I followed your steps (but made it a plugin) and it works fine. However, there's a bug if you try to surf directly over a current terrain, which is something that I need to work because how some parts of my game are made. Do you know how to fix this? I recorded a little clip for reference. If you enter the current while surfing everything works ok, but if you 'jump' over it glitches.
I need to check this in my game, but I believe it needs a line similar to staying good surfing after a battle. I'll check this later, and if I find a solution I'll come back here.
 

rafahbit

Novice
Member
Joined
Oct 21, 2020
Posts
42
Thanks for your help with this, I followed your steps (but made it a plugin) and it works fine. However, there's a bug if you try to surf directly over a current terrain, which is something that I need to work because how some parts of my game are made. Do you know how to fix this? I recorded a little clip for reference. If you enter the current while surfing everything works ok, but if you 'jump' over it glitches.
I can't explain this bug, the current you placed was on top of a layer of water with the surf tag? Or was it placed as the first layer? the autotile is

Anyway, I tested all possibilities and the bug didn't happen, maybe it's the plugin.
unable to make a plugin that would work properly, perhaps some part is not working properly as a plugin.
If possible, try doing it without the plugin and see if the same bug occurs.

Another thing that I only realized now was that if you use the tags on the treadmill, you can also surf, so I'll have to rework that part, but it was the only bug I found.
 

Willix

Novice
Member
Joined
Feb 7, 2024
Posts
22
I can't explain this bug, the current you placed was on top of a layer of water with the surf tag? Or was it placed as the first layer? the autotile is

Anyway, I tested all possibilities and the bug didn't happen, maybe it's the plugin.
unable to make a plugin that would work properly, perhaps some part is not working properly as a plugin.
If possible, try doing it without the plugin and see if the same bug occurs.

Another thing that I only realized now was that if you use the tags on the treadmill, you can also surf, so I'll have to rework that part, but it was the only bug I found.
I tried doing it without making it a plugin and have the same error. However, I found this on the original post which I hadn't read before:

future improvements:

There is a bug when using the default essentials graphics.
In this case, surf and dive have 2 separate graphics, the base and the palyer, if you use surf directly in a watercurrent, only the player moves and the surf base
does not, to avoid this, if it does not affect your game, combine the charts are surf base with the two palyer and leave the surf chart invisible. For now I don't have a plan on how to fix this.

I use default essentials graphics and this describes exactly what happens to me, so I guess this explains it 😅. I'll change the graphics as you say to make it work properly.
 

rafahbit

Novice
Member
Joined
Oct 21, 2020
Posts
42
I tried doing it without making it a plugin and have the same error. However, I found this on the original post which I hadn't read before:

future improvements:

There is a bug when using the default essentials graphics.
In this case, surf and dive have 2 separate graphics, the base and the palyer, if you use surf directly in a watercurrent, only the player moves and the surf base
does not, to avoid this, if it does not affect your game, combine the charts are surf base with the two palyer and leave the surf chart invisible. For now I don't have a plan on how to fix this.

I use default essentials graphics and this describes exactly what happens to me, so I guess this explains it 😅. I'll change the graphics as you say to make it work properly.
My God, sorry, I swore I had replied to you again talking about how to fix the bug but only mentioning in the tutorial that this exists.
I'm sorry, I hope everything is ok now
 

Willix

Novice
Member
Joined
Feb 7, 2024
Posts
22
My God, sorry, I swore I had replied to you again talking about how to fix the bug but only mentioning in the tutorial that this exists.
I'm sorry, I hope everything is ok now
Don't worry, now it works nicely, thanks for your help! 😊
 

googud

Rookie
Member
Joined
Jun 19, 2024
Posts
2
Thanks for your help with this, I followed your steps (but made it a plugin) and it works fine. However, there's a bug if you try to surf directly over a current terrain, which is something that I need to work because how some parts of my game are made. Do you know how to fix this? I recorded a little clip for reference. If you enter the current while surfing everything works ok, but if you 'jump' over it glitches.
I fix this bug by add one line.
at
def pbWaterCurrent

if !$DEBUG || !Input.press?(Input::CTRL)
return if !$game_player.pbTerrainTag.water_current
$game_temp.surf_base_coords = nil # I added here #manual remove surf base
$game_temp.followers.update

Bug1.png


and one more bug for anyone who stuck at rock near current

change
break if !$game_player.pbTerrainTag.water_current
to
break if ![imath]game_player.pbTerrainTag.water_current || ![/imath]game_player.can_move_in_direction?($game_player.direction) # I added here

Bug2.png


I trying to fix:
def pbWaterCurrent
  if !$DEBUG || !Input.press?(Input::CTRL)
    return if !$game_player.pbTerrainTag.water_current
    $game_temp.surf_base_coords = nil # I added here #manual remove surf base
    $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 || !$game_player.can_move_in_direction?($game_player.direction) # I added here

      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
 

googud

Rookie
Member
Joined
Jun 19, 2024
Posts
2
I using 2 layer Rock on Sea
layer 1 : sea
layer 2 : rock
Avoid it or more bug 🤣



edit
I found that it's not about 2 layer rock.
Player still surf through 1layer rock.

fixed
I found that something make $game_player.through = true
so at pbStartSurfing I add this one line. this problem solve.
Bug3.png


almost good script

a few more bug as you can see in video
sometime it is not smooth water current.
 
Last edited:
Back
Top