• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

[Essentials Tutorial] HM02 Fly replaced by Event

JustKenneth

Developer Pokemon The Kingdom of Meralas
  • 8
    Posts
    15
    Years
    Hello,

    I've been looking for a way to implement some sort of teleport/flight service instead of HM02 Fly.
    What I did first was insert following script under script section Pfield_HiddenMoves, under Fly.
    It looks like this:

    Code:
    def canUseMoveFly?
      if $game_player.pbHasDependentEvents?
        Kernel.pbMessage(_INTL("It can't be used when you have someone with you.")) #you can comment this if necessary
        return false
      end
      return true
    end  
    
    def useMoveFly # Add useMoveFly in the event in a script command
      scene=PokemonRegionMapScene.new(-1,false)
      screen=PokemonRegionMap.new(scene)
      ret=screen.pbStartFlyScreen
      return false if !ret
      $PokemonTemp.flydata=ret
      if !$PokemonTemp.flydata
        Kernel.pbMessage(_INTL("Can't use that here."))
      end
      if !pbHiddenMoveAnimation(nil)
        Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Fly"))
      end
      pbFadeOutIn(99999){
        Kernel.pbCancelVehicles
        $game_temp.player_new_map_id=$PokemonTemp.flydata[0]
        $game_temp.player_new_x=$PokemonTemp.flydata[1]
        $game_temp.player_new_y=$PokemonTemp.flydata[2]
        $PokemonTemp.flydata=nil
        $game_temp.player_new_direction=2
        $scene.transfer_player
        $game_map.autoplay
        $game_map.refresh
      }
      pbEraseEscapePoint
      return true
    end

    Example of the event in attachment!

    I hope I could help at least someone...

    CREDIT FOR THE SCRIPT GOES TO -FL-
    make sure to check out FL's tutorial if you need to turn HM's into items.

    Good day to all!
     

    Attachments

    • [PokeCommunity.com] HM02 Fly replaced by Event
      example.png
      25.9 KB · Views: 272
    I shall use this! I am due to create the same style for my game but you beat me to it! I'ms till stuck on creating icons above event heads.
     
    WOW! This is just the option what i was searching. Thanks for the input, i will give you credits for that.
     
    Last edited:
    Hey man! your script looks very cool and I'd like to use it, but it doesn't work for V17.2.
    I'm trying to fix it for essential 17+, without success so far, I'll post again if I achieve it, but if someone find a way to do it before then, please post it it would be appreciated :)

    EDIT: Achieved it!
    There was actually not much to change, but I was not looking at the right place,

    Anyway, here's the updated code for V17.2.
    Just go to PField_FieldMoves, and replace everything in the Fly section by this:

    Code:
    #===============================================================================
    # Fly
    #===============================================================================
    
    
    HiddenMoveHandlers::CanUseMove.add(:FLY,proc{|move,pkmn,showmsg|
       return false if !pbCheckHiddenMoveBadge(BADGEFORFLY,showmsg)
       #if $game_player.pbHasDependentEvents?
       #  Kernel.pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
       #  return false
       #end
       if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
         Kernel.pbMessage(_INTL("Can't use that here.")) if showmsg
         return false
       end
       return true
    })
    
    #EDIT#
    def canUseMoveFly?
       return false if !pbCheckHiddenMoveBadge(BADGEFORFLY)
       #if $game_player.pbHasDependentEvents?
       #  Kernel.pbMessage(_INTL("It can't be used when you have someone with you.")) 
       #  return false
       #end
       if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
         Kernel.pbMessage(_INTL("Can't use that here.")) 
         return false
       end
       return true
       end
    #EDIT#
    
    HiddenMoveHandlers::UseMove.add(:FLY,proc{|move,pokemon|
       if !$PokemonTemp.flydata
         Kernel.pbMessage(_INTL("Can't use that here."))
         return false
       end
       if !pbHiddenMoveAnimation(pokemon)
         Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
       end
       pbFadeOutIn(99999){
          $game_temp.player_new_map_id    = $PokemonTemp.flydata[0]
          $game_temp.player_new_x         = $PokemonTemp.flydata[1]
          $game_temp.player_new_y         = $PokemonTemp.flydata[2]
          $game_temp.player_new_direction = 2
          Kernel.pbCancelVehicles
          $PokemonTemp.flydata = nil
          $scene.transfer_player
          $game_map.autoplay
          $game_map.refresh
       }
       pbEraseEscapePoint
       return true
    })
    
    
    #EDIT#
    def useMoveFly
    scene = PokemonRegionMap_Scene.new(-1,false)
    screen = PokemonRegionMapScreen.new(scene)
    ret=screen.pbStartFlyScreen
    return false if !ret
    $PokemonTemp.flydata=ret
    if !$PokemonTemp.flydata
         Kernel.pbMessage(_INTL("Can't use that here."))
         return false
       end
      if !pbHiddenMoveAnimation(nil)
         Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Fly"))
       end
       pbFadeOutIn(99999){
          $game_temp.player_new_map_id    = $PokemonTemp.flydata[0]
          $game_temp.player_new_x         = $PokemonTemp.flydata[1]
          $game_temp.player_new_y         = $PokemonTemp.flydata[2]
          $game_temp.player_new_direction = 2
          Kernel.pbCancelVehicles
          $PokemonTemp.flydata = nil
          $scene.transfer_player
          $game_map.autoplay
          $game_map.refresh
       }
       pbEraseEscapePoint
       return true
    end
    #EDIT#

    Also, there is some quoted line, you can unquote them if you DO NOT use Follow Pokemon. If you use it, these lines need to be quoted if you want to be able to fly without needing to deactivate your pokemon following you.
     
    Last edited:
    Back
    Top