Advertiser Content

VitorBM

Male
Brazil
Seen 5 Hours Ago
Posted 5 Days Ago
14 posts
258 Days
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:
#===============================================================================
# Whirlpool
#===============================================================================
def Kernel.pbPassWhirlpool(event=nil)
  event = $game_player if !event
  return if !event
  if event.direction!=8   #
  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_down(false)
    terrain = pbGetTerrainTag(event)
    break if !PBTerrain.isWhirlpool?(terrain)
  end
  event.through    = oldthrough
  event.move_speed = oldmovespeed
elsif event.direction!=2
  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_up(false)
    terrain = pbGetTerrainTag(event)
    break if !PBTerrain.isWhirlpool?(terrain)
  end
  event.through    = oldthrough
  event.move_speed = oldmovespeed
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
end

def Kernel.pbWhirlpool
  move = getID(PBMoves,:WHIRLPOOL)
  movefinder = Kernel.pbCheckMove(move)
  if !pbCheckHiddenMoveBadge(BADGEFORWHIRLPOOL,false) || (!$DEBUG && !movefinder)
    Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
    return false
  end
  if Kernel.pbConfirmMessage(_INTL("It's a large Whirlpool. Would you like to use Whirlpool?"))
    speciesname = (movefinder) ? movefinder.name : $Trainer.name
    Kernel.pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
    pbHiddenMoveAnimation(movefinder)
    pbPassWhirlpool
    return true
  end
  return false
end

Events.onAction+=proc{|sender,e|
   terrain = Kernel.pbFacingTerrainTag
   if terrain==PBTerrain::Whirlpool
     Kernel.pbWhirlpool
     return
   end
}

HiddenMoveHandlers::CanUseMove.add(:WHIRLPOOL,proc{|move,pkmn,showmsg|
   return false if !pbCheckHiddenMoveBadge(BADGEFORWHIRLPOOL,showmsg)
   if Kernel.pbFacingTerrainTag!=PBTerrain::Whirlpool
     Kernel.pbMessage(_INTL("Can't use that here.")) if showmsg
     return false
   end
   return true
})

HiddenMoveHandlers::UseMove.add(:WHIRLPOOL,proc{|move,pokemon|
   if !pbHiddenMoveAnimation(pokemon)
     Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
   end
   Kernel.pbPassWhirlpool
   return true
})
Seen 20 Hours Ago
Posted 1 Week Ago
200 posts
9.6 Years
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:
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.

VitorBM

Male
Brazil
Seen 5 Hours Ago
Posted 5 Days Ago
14 posts
258 Days
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?
why my script was based on waterfall
Advertiser Content