• 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] Surf, waterfall and dive with no HM

  • 1
    Posts
    23
    Days
    • Seen May 27, 2024
    Hi! Is there any way to set a game where you can use these 3 field moves on terrains without having them? I don't mind if there's an item that allows you to use them, all I want is to be able to use them since the beginning of the game. Thanks a lot!
     
  • 10
    Posts
    1
    Years
    • Seen today
    Hi ! I'm using v20.1 version and created items for Fly, Surf, Waterfall, Strenght, Rock Smash and Flash.
    You need to add an item to the game that triggers the same behaviour than the HM. This is what I did for Surf (my messages are in french in scripts, just adapt for what you want to display) :

    1) Add the item in the item.txt PBS file :

    Code:
    [YOURSURFITEM]
    Name = Your Surf Item
    Pocket = 8
    Price = 0
    FieldUse = Direct
    Flags = KeyItem
    Description = Your surf item description.

    2) Choose a png to use for your item, name it as your item (for instance YOURSURFITEM.png here) and put it in Graphics\Items.

    3) Next you add the item handler in section Item_Effects of the scripts and call pbSurfItem (the regular HM uses pbSurf) :

    Code:
    ItemHandlers::UseInField.add(:YOURSURFITEM,proc{|item|
      pbSurfItem
      next true
    })

    4) Finally you define pbSurfItem similar to pbSurf in section Overworld_FieldMoves (my surf item is named Pédalokhlass, it's a pedalo with a Lapras head !) :

    Code:
    def pbSurfItem
      if !$game_player.can_ride_vehicle_with_follower?
        pbMessage("Vous avez un partenaire avec vous!")
        return false
      end
      if $PokemonGlobal.surfing
        pbMessage("Vous êtes déjà sur l'eau!")
        return false
      end
      if $game_map.metadata&.always_bicycle
        pbMessage("Ce n'est pas le moment d'utiliser ça!")
        return false
      end
      if !$game_player.pbFacingTerrainTag.can_surf_freely
        pbMessage("Ce n'est pas vraiment l'endroit pour sortir le Pédalokhlass...")
        return false
      end
      if !$game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player)
        pbMessage("Impossible de passer par là avec le Pédalokhlass.")
        return false
      end
      pbCancelVehicles
      pbMessage("Vous enfourchez votre Pédalokhlass!")
      surfbgm = GameData::Metadata.get.surf_BGM
      pbCueBGM(surfbgm, 0.5) if surfbgm
      pbStartSurfing
      return true
    end

    5) Because I wanted to change the default vehicle, I had to create a pbStartSurfingItem function instead of pbStartSurfing modify pbUpdateVehicule, add a global variable, etc... I think you don't need that.

    And for Waterfall :

    1) and 2) same way

    3) Add the item handler :
    Code:
    ItemHandlers::UseInField.add(:YOURWATERFALLITEM,proc{|item|
      if !$game_player.pbFacingTerrainTag.waterfall
        pbMessage(_INTL("You can't use that here."))
        next false
      end
      pbAscendWaterfall
      next true
    })

    4) Here I just edited the pbWaterfall function to take into account the item, maybe you could do that for surf too but it was easier for me to create a new function for the vehicle management (my waterfall item is named Propulseur here) :
    Code:
    def pbWaterfall
      move = :WATERFALL
      movefinder = $player.get_pokemon_with_move(move)
      if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL, false) || (!$DEBUG && !movefinder && !$bag.has?(:YOURWATERFALLITEM))
        pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
        return false
      end
      if (movefinder || $DEBUG)
        if pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
          speciesname = (movefinder) ? movefinder.name : $player.name
          pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
          pbHiddenMoveAnimation(movefinder)
          pbAscendWaterfall
          return true
        end
      else
        if pbConfirmMessage(_INTL("Une énorme cascade bloque le chemin. Voulez-vous utiliser votre Propulseur?"))
          pbMessage(_INTL("{1} équipe le Propulseur pour franchir la cascade!", $player.name))
          pbAscendWaterfall
          return true
        end
      end
      return false
    end

    Tell me if it works for you.
     
    Back
    Top