• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Whirlpool HGSS problem

17
Posts
5
Years
  • Hello,
    I made this script for Whirlpool in HGSS Style it works when going up and down but left and right goes down can anyone help me?
    this is the script

    Spoiler:
     
    220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    First thing I got to ask is why are you checking if the event direction isn't a value?

    The only time it's going to get beyond the first if is when direction is 8, which isn't 2. Meaning that all this:
    Code:
    elsif event.direction!=4
      oldthrough   = event.through
      oldmovespeed = event.move_speed
      terrain = Kernel.pbFacingTerrainTag
      return if !PBTerrain.isWhirlpool?(terrain)
      event.through = true
      event.move_speed = 0.5
      loop do
        event.move_left(false)
        terrain = pbGetTerrainTag(event)
        break if !PBTerrain.isWhirlpool?(terrain)
      end
      event.through    = oldthrough
      event.move_speed = oldmovespeed
    elsif event.direction!=6
      oldthrough   = event.through
      oldmovespeed = event.move_speed
      terrain = Kernel.pbFacingTerrainTag
      return if !PBTerrain.isWhirlpool?(terrain)
      event.through = true
      event.move_speed = 0.5
      loop do
        event.move_right(false)
        terrain = pbGetTerrainTag(event)
        break if !PBTerrain.isWhirlpool?(terrain)
      end
      event.through    = oldthrough
      event.move_speed = oldmovespeed
     end
    Is doing nothing, if I'm reading it right.
     
    Last edited:
    220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    Yes, but you're not checking if direction is equal to a value (if event.direction==X), you're (for some reason) checking if direction isn't equal to a value (if event.direction!=X).
    Why?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    You can only go one way over a waterfall (either down when you're just surfing, or up when you're using Waterfall). That's why its code excludes other directions. You don't want to do that.
     
    Back
    Top