The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Tutorial Turn HM moves into items

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Reply
 
Thread Tools
  #26    
Old August 19th, 2015 (3:26 PM).
arktyz arktyz is offline
     
    Join Date: Sep 2013
    Posts: 6
    Thank you for looking through my coding mistake, but that add on seemed to generate another, here is the new problem that occurred:

    Spoiler:
    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NameError

    Message: uninitialized constant UseMoveSurf

    PokemonItemEffects:978

    PokemonItemEffects:977:in `call'

    PBEvent:150:in `trigger'

    PokemonItems:174:in `triggerUseInField'

    PokemonItems:362:in `pbUseKeyItemInField'

    PokemonPauseMenu:197:in `pbStartPokemonMenu'

    PokemonPauseMenu:142:in `loop'

    PokemonPauseMenu:256:in `pbStartPokemonMenu'

    Scene_Map:188:in `call_menu'

    Scene_Map:159:in `update'



    This exception was logged in

    C:\Users\Andy\Saved Games/Pokemon Essentials/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------


    I can see it is referring to the item section with clicking use on the surfboard in the bag, here is my code for that

    Spoiler:
    ItemHandlers::UseInField.add(:SURFBOARD,proc{|item|
    UseMoveSurf if canUseMoveSurf?
    })

    ItemHandlers::UseFromBag.add(:SURFBOARD,proc{|item|
    next canUseMoveSurf? ? 2 : 0
    })


    finally just so its here if it needs changing this is my surf section code

    Spoiler:
    def Kernel.pbSurf
    if $game_player.pbHasDependentEvents?
    return false
    end
    if $DEBUG ||
    (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
    movefinder=Kernel.pbCheckMove(:SURF)
    if $DEBUG || $PokemonBag.pbQuantity(PBItems::SURFBOARD)>0
    if Kernel.pbConfirmMessage(_INTL("The tides look nasty would you like to go surfing?"))
    speciesname=!movefinder ? $Trainer.name : movefinder.name
    Kernel.pbMessage(_INTL("You started surfing!",speciesname))

    surfbgm=pbGetMetadata(0,MetadataSurfBGM)
    if surfbgm
    pbCueBGM(surfbgm,0.5)
    end
    pbStartSurfing()
    return true
    end
    end
    end
    return false
    end

    def pbStartSurfing()
    Kernel.pbCancelVehicles
    $PokemonEncounters.clearStepCount
    $PokemonGlobal.surfing=true
    Kernel.pbUpdateVehicle
    Kernel.pbJumpToward
    Kernel.pbUpdateVehicle
    $game_player.check_event_trigger_here([1,2])
    end

    def pbEndSurf(xOffset,yOffset)
    return false if !$PokemonGlobal.surfing
    x=$game_player.x
    y=$game_player.y
    currentTag=$game_map.terrain_tag(x,y)
    facingTag=Kernel.pbFacingTerrainTag
    if pbIsSurfableTag?(currentTag) && !pbIsSurfableTag?(facingTag)
    if Kernel.pbJumpToward
    Kernel.pbCancelVehicles
    $game_map.autoplayAsCue
    $game_player.increase_steps
    result=$game_player.check_event_trigger_here([1,2])
    Kernel.pbOnStepTaken(result)
    end
    return true
    end
    return false
    end

    Events.onAction+=proc{|sender,e|
    terrain=Kernel.pbFacingTerrainTag
    notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
    if pbIsWaterTag?(terrain) && !$PokemonGlobal.surfing &&
    !pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
    Kernel.pbSurf
    return
    end
    }
    def canUseMoveSurf?
    terrain=Kernel.pbFacingTerrainTag
    notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
    if !$DEBUG &&
    !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
    Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
    return false
    end
    if $PokemonGlobal.surfing
    Kernel.pbMessage(_INTL("You're already surfing."))
    return false
    end
    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,MetadataBicycleAlways)
    Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
    return false
    end
    if !pbIsWaterTag?(terrain) || !notCliff
    Kernel.pbMessage(_INTL("No surfing here!"))
    return false
    end
    return true
    end
    def UseMoveSurf
    if !pbHiddenMoveAnimation(nil)
    Kernel.pbMessage(_INTL("You started surfing!",$Trainer.name,"Surf"))
    end
    pbStartSurfing()
    return true
    end

    #HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
    # terrain=Kernel.pbFacingTerrainTag
    # notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
    # if !$DEBUG &&
    # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
    # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
    # return false
    # end
    # if $PokemonGlobal.surfing
    # Kernel.pbMessage(_INTL("You're already surfing."))
    # return false
    # end
    # 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,MetadataBicycleAlways)
    # Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
    # return false
    # end
    # if !pbIsWaterTag?(terrain) || !notCliff
    # Kernel.pbMessage(_INTL("No surfing here!"))
    # return false
    # end
    # return true
    #})

    HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
    if !pbHiddenMoveAnimation(pokemon)
    Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
    end
    pbStartSurfing()
    return true
    })
    Reply With Quote

    Relevant Advertising!

      #27    
    Old August 22nd, 2015 (12:22 PM).
    FL's Avatar
    FL FL is offline
    Pokémon Island Creator
       
      Join Date: Sep 2010
      Gender: Male
      Posts: 1,725
      Quote:
      Originally Posted by arktyz View Post
      Thank you for looking through my coding mistake, but that add on seemed to generate another, here is the new problem that occurred:

      Spoiler:
      ---------------------------
      Pokemon Essentials
      ---------------------------
      Exception: NameError

      Message: uninitialized constant UseMoveSurf

      PokemonItemEffects:978

      PokemonItemEffects:977:in `call'

      PBEvent:150:in `trigger'

      PokemonItems:174:in `triggerUseInField'

      PokemonItems:362:in `pbUseKeyItemInField'

      PokemonPauseMenu:197:in `pbStartPokemonMenu'

      PokemonPauseMenu:142:in `loop'

      PokemonPauseMenu:256:in `pbStartPokemonMenu'

      Scene_Map:188:in `call_menu'

      Scene_Map:159:in `update'



      This exception was logged in

      C:\Users\Andy\Saved Games/Pokemon Essentials/errorlog.txt.

      Press Ctrl+C to copy this message to the clipboard.
      ---------------------------
      OK
      ---------------------------


      I can see it is referring to the item section with clicking use on the surfboard in the bag, here is my code for that

      Spoiler:
      ItemHandlers::UseInField.add(:SURFBOARD,proc{|item|
      UseMoveSurf if canUseMoveSurf?
      })

      ItemHandlers::UseFromBag.add(:SURFBOARD,proc{|item|
      next canUseMoveSurf? ? 2 : 0
      })


      finally just so its here if it needs changing this is my surf section code

      Spoiler:
      def Kernel.pbSurf
      if $game_player.pbHasDependentEvents?
      return false
      end
      if $DEBUG ||
      (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
      movefinder=Kernel.pbCheckMove(:SURF)
      if $DEBUG || $PokemonBag.pbQuantity(PBItems::SURFBOARD)>0
      if Kernel.pbConfirmMessage(_INTL("The tides look nasty would you like to go surfing?"))
      speciesname=!movefinder ? $Trainer.name : movefinder.name
      Kernel.pbMessage(_INTL("You started surfing!",speciesname))

      surfbgm=pbGetMetadata(0,MetadataSurfBGM)
      if surfbgm
      pbCueBGM(surfbgm,0.5)
      end
      pbStartSurfing()
      return true
      end
      end
      end
      return false
      end

      def pbStartSurfing()
      Kernel.pbCancelVehicles
      $PokemonEncounters.clearStepCount
      $PokemonGlobal.surfing=true
      Kernel.pbUpdateVehicle
      Kernel.pbJumpToward
      Kernel.pbUpdateVehicle
      $game_player.check_event_trigger_here([1,2])
      end

      def pbEndSurf(xOffset,yOffset)
      return false if !$PokemonGlobal.surfing
      x=$game_player.x
      y=$game_player.y
      currentTag=$game_map.terrain_tag(x,y)
      facingTag=Kernel.pbFacingTerrainTag
      if pbIsSurfableTag?(currentTag) && !pbIsSurfableTag?(facingTag)
      if Kernel.pbJumpToward
      Kernel.pbCancelVehicles
      $game_map.autoplayAsCue
      $game_player.increase_steps
      result=$game_player.check_event_trigger_here([1,2])
      Kernel.pbOnStepTaken(result)
      end
      return true
      end
      return false
      end

      Events.onAction+=proc{|sender,e|
      terrain=Kernel.pbFacingTerrainTag
      notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
      if pbIsWaterTag?(terrain) && !$PokemonGlobal.surfing &&
      !pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
      Kernel.pbSurf
      return
      end
      }
      def canUseMoveSurf?
      terrain=Kernel.pbFacingTerrainTag
      notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
      if !$DEBUG &&
      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
      Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
      return false
      end
      if $PokemonGlobal.surfing
      Kernel.pbMessage(_INTL("You're already surfing."))
      return false
      end
      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,MetadataBicycleAlways)
      Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
      return false
      end
      if !pbIsWaterTag?(terrain) || !notCliff
      Kernel.pbMessage(_INTL("No surfing here!"))
      return false
      end
      return true
      end
      def UseMoveSurf
      if !pbHiddenMoveAnimation(nil)
      Kernel.pbMessage(_INTL("You started surfing!",$Trainer.name,"Surf"))
      end
      pbStartSurfing()
      return true
      end

      #HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
      # terrain=Kernel.pbFacingTerrainTag
      # notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
      # if !$DEBUG &&
      # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
      # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
      # return false
      # end
      # if $PokemonGlobal.surfing
      # Kernel.pbMessage(_INTL("You're already surfing."))
      # return false
      # end
      # 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,MetadataBicycleAlways)
      # Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
      # return false
      # end
      # if !pbIsWaterTag?(terrain) || !notCliff
      # Kernel.pbMessage(_INTL("No surfing here!"))
      # return false
      # end
      # return true
      #})

      HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
      if !pbHiddenMoveAnimation(pokemon)
      Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
      end
      pbStartSurfing()
      return true
      })
      Every time that you repost the code, please use the code tag!

      'Kernel.pbMessage(_INTL("You started surfing!",$Trainer.name,"Surf"))' as is the purpose of using three parameters as _INTL without the place to replace on main message?

      Are you sure that you typed 'useMoveSurf' and not 'UseMoveSurf' in both places? Ruby is case sensitive!
      __________________
      Reply With Quote
        #28    
      Old October 3rd, 2015 (5:02 AM).
      fmw fmw is offline
         
        Join Date: Oct 2015
        Posts: 2
        Could you please post the complete script for cut as i do not completely understand where to put it. Thanks!
        Reply With Quote
          #29    
        Old October 5th, 2015 (4:31 PM).
        FL's Avatar
        FL FL is offline
        Pokémon Island Creator
           
          Join Date: Sep 2010
          Gender: Male
          Posts: 1,725
          Quote:
          Originally Posted by fmw View Post
          Could you please post the complete script for cut as i do not completely understand where to put it. Thanks!
          This is already on main thread post, at "example" part.
          __________________
          Reply With Quote
            #30    
          Old October 10th, 2015 (6:07 PM).
          fmw fmw is offline
             
            Join Date: Oct 2015
            Posts: 2
            o I mean like the complete section for cut. Please I'm a terrible script-er! :)
            Reply With Quote
              #31    
            Old October 11th, 2015 (3:12 AM).
            FL's Avatar
            FL FL is offline
            Pokémon Island Creator
               
              Join Date: Sep 2010
              Gender: Male
              Posts: 1,725
              Quote:
              Originally Posted by fmw View Post
              o I mean like the complete section for cut. Please I'm a terrible script-er! :)
              The first code part goes into item.txt, the second goes into PokemonHiddenMoves script section and the last goes into PokemonItemEffects script section. Just copy and paste the code!
              __________________
              Reply With Quote
                #32    
              Old October 11th, 2015 (4:53 AM).
              dydd90's Avatar
              dydd90 dydd90 is offline
                 
                Join Date: Dec 2013
                Location: Italy
                Gender: Male
                Posts: 245
                I tried to turn teleport into an item but it is different from others, how can i make it?
                __________________


                Reply With Quote
                  #33    
                Old October 11th, 2015 (5:13 PM).
                FL's Avatar
                FL FL is offline
                Pokémon Island Creator
                   
                  Join Date: Sep 2010
                  Gender: Male
                  Posts: 1,725
                  Quote:
                  Originally Posted by dydd90 View Post
                  I tried to turn teleport into an item but it is different from others, how can i make it?
                  The only diference is that the confirmation message show ups twice if you use by item menu. To fix this, change

                  Code:
                       mapname=pbGetMapNameFromId(healing[0])
                       if Kernel.pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
                         return true
                       end
                       return false
                  into 'return true'. And add after 'if healing' (in useMoveTeleport):

                  Code:
                       mapname=pbGetMapNameFromId(healing[0])
                       if !Kernel.pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
                         return false
                       end
                  __________________
                  Reply With Quote
                    #34    
                  Old March 25th, 2016 (8:19 AM).
                  Fazsapphire Fazsapphire is offline
                     
                    Join Date: Mar 2016
                    Posts: 5
                    This works for essentials v16 ? as the scripts are pretty different
                    Reply With Quote
                      #35    
                    Old April 6th, 2016 (2:13 AM).
                    FL's Avatar
                    FL FL is offline
                    Pokémon Island Creator
                       
                      Join Date: Sep 2010
                      Gender: Male
                      Posts: 1,725
                      Quote:
                      Originally Posted by Fazsapphire View Post
                      This works for essentials v16 ? as the scripts are pretty different
                      I guess so. Some (like Fly) probably need adjustment.
                      __________________
                      Reply With Quote
                        #36    
                      Old April 10th, 2016 (10:56 AM).
                      FL's Avatar
                      FL FL is offline
                      Pokémon Island Creator
                         
                        Join Date: Sep 2010
                        Gender: Male
                        Posts: 1,725
                        Quote:
                        Originally Posted by FL View Post
                        I guess so. Some (like Fly) probably need adjustment.
                        After testing, the only adjustment was the plural field when declaring items.

                        But using Surf from menu won't work in Essentials V16.1, so it won't work here too.
                        __________________
                        Reply With Quote
                          #37    
                        Old April 10th, 2016 (7:54 PM).
                        Weedfanatic Weedfanatic is offline
                           
                          Join Date: Mar 2016
                          Posts: 21
                          Quote:
                          Originally Posted by FL View Post
                          After testing, the only adjustment was the plural field when declaring items.

                          But using Surf from menu won't work in Essentials V16.1, so it won't work here too.
                          Surf will work from the bag. You just need to fix outdated code.
                          Try out the script below and let me know if it works. It should, it does for me with v16.1

                          Code:
                          #===============================================================================
                          # Surf
                          #===============================================================================
                          def Kernel.pbSurf
                          if $game_player.pbHasDependentEvents?
                          return false
                          end
                          if $DEBUG ||
                          (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
                          movefinder=Kernel.pbCheckMove(:SURF)
                          if $DEBUG || $PokemonBag.pbQuantity(PBItems::RAFT)>0
                          if Kernel.pbConfirmMessage(_INTL("The water is a deep blue, would you like to use the raft?"))
                          speciesname=!movefinder ? $Trainer.name : movefinder.name
                          Kernel.pbMessage(_INTL("You started rafting!",speciesname))
                          
                          surfbgm=pbGetMetadata(0,MetadataSurfBGM)
                          if surfbgm
                          pbCueBGM(surfbgm,0.5)
                          end
                          
                          pbStartSurfing()
                          return true
                          end
                          end
                          end
                          return false
                          end
                          
                          def pbStartSurfing()
                          Kernel.pbCancelVehicles
                          $PokemonEncounters.clearStepCount
                          $PokemonGlobal.surfing=true
                          Kernel.pbUpdateVehicle
                          Kernel.pbJumpToward
                          Kernel.pbUpdateVehicle
                          $game_player.check_event_trigger_here([1,2])
                          end
                          
                          def pbEndSurf(xOffset,yOffset)
                          return false if !$PokemonGlobal.surfing
                          x=$game_player.x
                          y=$game_player.y
                          currentTag=$game_map.terrain_tag(x,y)
                          facingTag=Kernel.pbFacingTerrainTag
                          if pbIsSurfableTag?(currentTag) && !pbIsSurfableTag?(facingTag)
                          if Kernel.pbJumpToward
                          Kernel.pbCancelVehicles
                          $game_map.autoplayAsCue
                          $game_player.increase_steps
                          result=$game_player.check_event_trigger_here([1,2])
                          Kernel.pbOnStepTaken(result)
                          end
                          return true
                          end
                          return false
                          end
                          
                          Events.onAction+=proc{|sender,e|
                          terrain=Kernel.pbFacingTerrainTag
                          notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                          if pbIsWaterTag?(terrain) && !$PokemonGlobal.surfing && 
                          !pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
                          Kernel.pbSurf
                          return
                          end
                          }
                          def canUseMoveSurf?
                          terrain=Kernel.pbFacingTerrainTag
                          notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                          if !$DEBUG &&
                          !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
                          Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                          return false
                          end
                          if $PokemonGlobal.surfing
                          Kernel.pbMessage(_INTL("You're already rafting."))
                          return false
                          end
                          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,MetadataBicycleAlways)
                          Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
                          return false
                          end
                          #if !PBTerrain.isSurfable?(terrain) || !notCliff
                          if !pbIsWaterTag?(terrain) || !notCliff
                          Kernel.pbMessage(_INTL("No rafting here!"))
                          return false
                          end
                          return true
                          end
                          
                          def useMoveSurf
                          if !pbHiddenMoveAnimation(nil)
                          Kernel.pbMessage(_INTL("You started rafting!",$Trainer.name,"Surf"))
                          end
                          pbStartSurfing()
                          return true
                          end
                          
                          HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
                          if !pbHiddenMoveAnimation(pokemon)
                          Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
                          end
                          pbStartSurfing()
                          return true
                          })
                          Reply With Quote
                            #38    
                          Old May 22nd, 2016 (3:12 PM).
                          Jol the Hedgehog Jol the Hedgehog is offline
                             
                            Join Date: Dec 2015
                            Posts: 29
                            Can you do a better tutorial? I always get errors.. I'm using essentials 16.1
                            Reply With Quote
                              #39    
                            Old May 28th, 2016 (8:49 AM). Edited May 28th, 2016 by FL.
                            FL's Avatar
                            FL FL is offline
                            Pokémon Island Creator
                               
                              Join Date: Sep 2010
                              Gender: Male
                              Posts: 1,725
                              Quote:
                              Originally Posted by Jol the Hedgehog View Post
                              Can you do a better tutorial? I always get errors.. I'm using essentials 16.1
                              I need a better feedback that "do a better tutorial". This isn't an easy modification. You need to know what is a procedure/method start and end. Fortunately, I put an example, so, even if you get confused in some part, you can look in this example.

                              Even, there some moves that are exceptions as I mentioned before with Fly.

                              Like I said before, I tested this tutorial with the latest versions.

                              EDIT: I detailed the example a little more.
                              __________________
                              Reply With Quote
                                #40    
                              Old May 31st, 2016 (3:33 AM).
                              Vernerl Vernerl is offline
                                 
                                Join Date: May 2016
                                Gender: Male
                                Posts: 9
                                Hi I'm getting this error:

                                "Script 'PField_HiddenMoves' line 506: SyntaxError occurred."

                                Here are the things i changed:

                                Surf.
                                Spoiler:
                                #===============================================================================
                                # Surf
                                #===============================================================================
                                def Kernel.pbSurf
                                if $game_player.pbHasDependentEvents?
                                return false
                                end
                                if $DEBUG ||
                                (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
                                movefinder=Kernel.pbCheckMove(:SURF)
                                if $DEBUG || ($PokemonBag.pbQuantity(PBItems::SURFBOARD)>0
                                if Kernel.pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
                                speciesname=!movefinder ? $Trainer.name : movefinder.name
                                Kernel.pbMessage(_INTL("{1} used Surf!",speciesname))
                                pbHiddenMoveAnimation(movefinder)
                                surfbgm=pbGetMetadata(0,MetadataSurfBGM)
                                if surfbgm
                                pbCueBGM(surfbgm,0.5)
                                end
                                pbStartSurfing()
                                return true
                                end
                                end (This is the infamous line 506 btw.)
                                end
                                return false
                                end

                                def pbStartSurfing()
                                Kernel.pbCancelVehicles
                                $PokemonEncounters.clearStepCount
                                $PokemonGlobal.surfing=true
                                Kernel.pbUpdateVehicle
                                Kernel.pbJumpToward
                                Kernel.pbUpdateVehicle
                                $game_player.check_event_trigger_here([1,2])
                                end

                                def pbEndSurf(xOffset,yOffset)
                                return false if !$PokemonGlobal.surfing
                                x=$game_player.x
                                y=$game_player.y
                                currentTag=$game_map.terrain_tag(x,y)
                                facingTag=Kernel.pbFacingTerrainTag
                                if PBTerrain.isSurfable?(currentTag) && !PBTerrain.isSurfable?(facingTag)
                                if Kernel.pbJumpToward(1,false,true)
                                # Kernel.pbCancelVehicles
                                $game_map.autoplayAsCue
                                $game_player.increase_steps
                                result=$game_player.check_event_trigger_here([1,2])
                                Kernel.pbOnStepTaken(result)
                                end
                                return true
                                end
                                return false
                                end

                                def Kernel.pbTransferSurfing(mapid,xcoord,ycoord,direction=$game_player.direction)
                                pbFadeOutIn(99999){
                                $game_temp.player_new_map_id=mapid
                                $game_temp.player_new_x=xcoord
                                $game_temp.player_new_y=ycoord
                                $game_temp.player_new_direction=direction
                                Kernel.pbCancelVehicles
                                $PokemonGlobal.surfing=true
                                Kernel.pbUpdateVehicle
                                $scene.transfer_player(false)
                                $game_map.autoplay
                                $game_map.refresh
                                }
                                end

                                Events.onAction+=proc{|sender,e|
                                terrain=Kernel.pbFacingTerrainTag
                                notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                                if PBTerrain.isSurfable?(terrain) && !$PokemonGlobal.surfing &&
                                !pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
                                Kernel.pbSurf
                                return
                                end
                                }

                                #HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
                                # terrain=Kernel.pbFacingTerrainTag
                                # notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                                # if !$DEBUG &&
                                # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
                                # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                # return false
                                # end
                                # if $PokemonGlobal.surfing
                                # Kernel.pbMessage(_INTL("You're already surfing."))
                                # return false
                                # end
                                # 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,MetadataBicycleAlways)
                                # Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
                                # return false
                                # end
                                # if !PBTerrain.isSurfable?(terrain) || !notCliff
                                # Kernel.pbMessage(_INTL("No surfing here!"))
                                # return false
                                # end
                                # return true
                                #})

                                HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
                                if !pbHiddenMoveAnimation(pokemon)
                                Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
                                end
                                pbStartSurfing()
                                return true
                                })



                                Waterfall.
                                Spoiler:
                                #===============================================================================
                                # Waterfall
                                #===============================================================================
                                def Kernel.pbAscendWaterfall(event=nil)
                                event=$game_player if !event
                                return if !event
                                return if event.direction!=8 # can't ascend if not facing up
                                oldthrough=event.through
                                oldmovespeed=event.move_speed
                                terrain=Kernel.pbFacingTerrainTag
                                return if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                event.through=true
                                event.move_speed=2
                                loop do
                                event.move_up
                                terrain=pbGetTerrainTag(event)
                                break if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                end
                                event.through=oldthrough
                                event.move_speed=oldmovespeed
                                end

                                def Kernel.pbDescendWaterfall(event=nil)
                                event=$game_player if !event
                                return if !event
                                return if event.direction!=2 # Can't descend if not facing down
                                oldthrough=event.through
                                oldmovespeed=event.move_speed
                                terrain=Kernel.pbFacingTerrainTag
                                return if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                event.through=true
                                event.move_speed=2
                                loop do
                                event.move_down
                                terrain=pbGetTerrainTag(event)
                                break if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                end
                                event.through=oldthrough
                                event.move_speed=oldmovespeed
                                end

                                def Kernel.pbWaterfall
                                if $DEBUG ||
                                (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORWATERFALL : $Trainer.badges[BADGEFORWATERFALL])
                                movefinder=Kernel.pbCheckMove(:WATERFALL)
                                if $DEBUG || ($PokemonBag.pbQuantity(PBItems::WATERBOARD)>0
                                if Kernel.pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
                                speciesname=!movefinder ? $Trainer.name : movefinder.name
                                Kernel.pbMessage(_INTL("{1} used Waterfall.",speciesname))
                                pbHiddenMoveAnimation(movefinder)
                                pbAscendWaterfall
                                return true
                                end
                                else
                                Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
                                end
                                else
                                Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
                                end
                                return false
                                end

                                Events.onAction+=proc{|sender,e|
                                terrain=Kernel.pbFacingTerrainTag
                                if terrain==PBTerrain::Waterfall
                                Kernel.pbWaterfall
                                return
                                end
                                if terrain==PBTerrain::WaterfallCrest
                                Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
                                return
                                end
                                }

                                #HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc{|move,pkmn|
                                # if !$DEBUG &&
                                # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORWATERFALL : $Trainer.badges[BADGEFORWATERFALL])
                                # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                # return false
                                # end
                                # terrain=Kernel.pbFacingTerrainTag
                                # if terrain!=PBTerrain::Waterfall
                                # Kernel.pbMessage(_INTL("Can't use that here."))
                                # return false
                                # end
                                # return true
                                #})

                                HiddenMoveHandlers::UseMove.add(:WATERFALL,proc{|move,pokemon|
                                if !pbHiddenMoveAnimation(pokemon)
                                Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
                                end
                                Kernel.pbAscendWaterfall
                                return true
                                })


                                Dive.
                                Spoiler:
                                #===============================================================================
                                # Dive
                                #===============================================================================
                                def Kernel.pbDive
                                divemap=pbGetMetadata($game_map.map_id,MetadataDiveMap)
                                return false if !divemap
                                if $DEBUG ||
                                (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE])
                                movefinder=Kernel.pbCheckMove(:DIVE)
                                if $DEBUG || ($PokemonBag.pbQuantity(PBItems::DIVEBOARD)>0
                                if Kernel.pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
                                speciesname=!movefinder ? $Trainer.name : movefinder.name
                                Kernel.pbMessage(_INTL("{1} used Dive.",speciesname))
                                pbHiddenMoveAnimation(movefinder)
                                pbFadeOutIn(99999){
                                $game_temp.player_new_map_id=divemap
                                $game_temp.player_new_x=$game_player.x
                                $game_temp.player_new_y=$game_player.y
                                $game_temp.player_new_direction=$game_player.direction
                                Kernel.pbCancelVehicles
                                $PokemonGlobal.diving=true
                                Kernel.pbUpdateVehicle
                                $scene.transfer_player(false)
                                $game_map.autoplay
                                $game_map.refresh
                                }
                                return true
                                end
                                else
                                Kernel.pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
                                end
                                else
                                Kernel.pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
                                end
                                return false
                                end

                                def Kernel.pbSurfacing
                                return if !$PokemonGlobal.diving
                                divemap=nil
                                meta=pbLoadMetadata
                                for i in 0...meta.length
                                if meta[i] && meta[i][MetadataDiveMap]
                                if meta[i][MetadataDiveMap]==$game_map.map_id
                                divemap=i
                                break
                                end
                                end
                                end
                                return if !divemap
                                movefinder=Kernel.pbCheckMove(:DIVE)
                                if $DEBUG || (movefinder &&
                                (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE]) )
                                if Kernel.pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
                                speciesname=!movefinder ? $Trainer.name : movefinder.name
                                Kernel.pbMessage(_INTL("{1} used Dive.",speciesname))
                                pbHiddenMoveAnimation(movefinder)
                                pbFadeOutIn(99999){
                                $game_temp.player_new_map_id=divemap
                                $game_temp.player_new_x=$game_player.x
                                $game_temp.player_new_y=$game_player.y
                                $game_temp.player_new_direction=$game_player.direction
                                Kernel.pbCancelVehicles
                                $PokemonGlobal.surfing=true
                                Kernel.pbUpdateVehicle
                                $scene.transfer_player(false)
                                surfbgm=pbGetMetadata(0,MetadataSurfBGM)
                                if surfbgm
                                pbBGMPlay(surfbgm)
                                else
                                $game_map.autoplayAsCue
                                end
                                $game_map.refresh
                                }
                                return true
                                end
                                else
                                Kernel.pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
                                end
                                return false
                                end

                                def Kernel.pbTransferUnderwater(mapid,xcoord,ycoord,direction=$game_player.direction)
                                pbFadeOutIn(99999){
                                $game_temp.player_new_map_id=mapid
                                $game_temp.player_new_x=xcoord
                                $game_temp.player_new_y=ycoord
                                $game_temp.player_new_direction=direction
                                Kernel.pbCancelVehicles
                                $PokemonGlobal.diving=true
                                Kernel.pbUpdateVehicle
                                $scene.transfer_player(false)
                                $game_map.autoplay
                                $game_map.refresh
                                }
                                end

                                Events.onAction+=proc{|sender,e|
                                terrain=$game_player.terrain_tag
                                if terrain==PBTerrain::DeepWater
                                Kernel.pbDive
                                return
                                end
                                if $PokemonGlobal.diving
                                if DIVINGSURFACEANYWHERE
                                Kernel.pbSurfacing
                                return
                                else
                                divemap=nil
                                meta=pbLoadMetadata
                                for i in 0...meta.length
                                if meta[i] && meta[i][MetadataDiveMap]
                                if meta[i][MetadataDiveMap]==$game_map.map_id
                                divemap=i
                                break
                                end
                                end
                                end
                                if $MapFactory.getTerrainTag(divemap,$game_player.x,$game_player.y)==PBTerrain::DeepWater
                                Kernel.pbSurfacing
                                return
                                end
                                end
                                end
                                }

                                #HiddenMoveHandlers::CanUseMove.add(:DIVE,proc{|move,pkmn|
                                # if !$DEBUG &&
                                # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE])
                                # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                # return false
                                # end
                                # if $PokemonGlobal.diving
                                # return true if DIVINGSURFACEANYWHERE
                                # divemap=nil
                                # meta=pbLoadMetadata
                                # for i in 0...meta.length
                                # if meta[i] && meta[i][MetadataDiveMap]
                                # if meta[i][MetadataDiveMap]==$game_map.map_id
                                # divemap=i
                                # break
                                # end
                                # end
                                # end
                                # if $MapFactory.getTerrainTag(divemap,$game_player.x,$game_player.y)==PBTerrain::DeepWater
                                # return true
                                # else
                                # Kernel.pbMessage(_INTL("Can't use that here."))
                                # return false
                                # end
                                # end
                                # if $game_player.terrain_tag!=PBTerrain::DeepWater
                                # Kernel.pbMessage(_INTL("Can't use that here."))
                                # return false
                                # end
                                # if !pbGetMetadata($game_map.map_id,MetadataDiveMap)
                                # Kernel.pbMessage(_INTL("Can't use that here."))
                                # return false
                                # end
                                # return true
                                #})

                                HiddenMoveHandlers::UseMove.add(:DIVE,proc{|move,pokemon|
                                wasdiving=$PokemonGlobal.diving
                                if $PokemonGlobal.diving
                                divemap=nil
                                meta=pbLoadMetadata
                                for i in 0...meta.length
                                if meta[i] && meta[i][MetadataDiveMap]
                                if meta[i][MetadataDiveMap]==$game_map.map_id
                                divemap=i
                                break
                                end
                                end
                                end
                                else
                                divemap=pbGetMetadata($game_map.map_id,MetadataDiveMap)
                                end
                                return false if !divemap
                                if !pbHiddenMoveAnimation(pokemon)
                                Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
                                end
                                pbFadeOutIn(99999){
                                $game_temp.player_new_map_id=divemap
                                $game_temp.player_new_x=$game_player.x
                                $game_temp.player_new_y=$game_player.y
                                $game_temp.player_new_direction=$game_player.direction
                                Kernel.pbCancelVehicles
                                if wasdiving
                                $PokemonGlobal.surfing=true
                                else
                                $PokemonGlobal.diving=true
                                end
                                Kernel.pbUpdateVehicle
                                $scene.transfer_player(false)
                                $game_map.autoplay
                                $game_map.refresh
                                }
                                return true
                                })
                                Reply With Quote
                                  #41    
                                Old June 4th, 2016 (4:44 PM).
                                FL's Avatar
                                FL FL is offline
                                Pokémon Island Creator
                                   
                                  Join Date: Sep 2010
                                  Gender: Male
                                  Posts: 1,725
                                  Quote:
                                  Originally Posted by Vernerl View Post
                                  Hi I'm getting this error:

                                  "Script 'PField_HiddenMoves' line 506: SyntaxError occurred."

                                  Here are the things i changed:

                                  Surf.
                                  Spoiler:
                                  #===============================================================================
                                  # Surf
                                  #===============================================================================
                                  def Kernel.pbSurf
                                  if $game_player.pbHasDependentEvents?
                                  return false
                                  end
                                  if $DEBUG ||
                                  (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
                                  movefinder=Kernel.pbCheckMove(:SURF)
                                  if $DEBUG || ($PokemonBag.pbQuantity(PBItems::SURFBOARD)>0
                                  if Kernel.pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
                                  speciesname=!movefinder ? $Trainer.name : movefinder.name
                                  Kernel.pbMessage(_INTL("{1} used Surf!",speciesname))
                                  pbHiddenMoveAnimation(movefinder)
                                  surfbgm=pbGetMetadata(0,MetadataSurfBGM)
                                  if surfbgm
                                  pbCueBGM(surfbgm,0.5)
                                  end
                                  pbStartSurfing()
                                  return true
                                  end
                                  end (This is the infamous line 506 btw.)
                                  end
                                  return false
                                  end

                                  def pbStartSurfing()
                                  Kernel.pbCancelVehicles
                                  $PokemonEncounters.clearStepCount
                                  $PokemonGlobal.surfing=true
                                  Kernel.pbUpdateVehicle
                                  Kernel.pbJumpToward
                                  Kernel.pbUpdateVehicle
                                  $game_player.check_event_trigger_here([1,2])
                                  end

                                  def pbEndSurf(xOffset,yOffset)
                                  return false if !$PokemonGlobal.surfing
                                  x=$game_player.x
                                  y=$game_player.y
                                  currentTag=$game_map.terrain_tag(x,y)
                                  facingTag=Kernel.pbFacingTerrainTag
                                  if PBTerrain.isSurfable?(currentTag) && !PBTerrain.isSurfable?(facingTag)
                                  if Kernel.pbJumpToward(1,false,true)
                                  # Kernel.pbCancelVehicles
                                  $game_map.autoplayAsCue
                                  $game_player.increase_steps
                                  result=$game_player.check_event_trigger_here([1,2])
                                  Kernel.pbOnStepTaken(result)
                                  end
                                  return true
                                  end
                                  return false
                                  end

                                  def Kernel.pbTransferSurfing(mapid,xcoord,ycoord,direction=$game_player.direction)
                                  pbFadeOutIn(99999){
                                  $game_temp.player_new_map_id=mapid
                                  $game_temp.player_new_x=xcoord
                                  $game_temp.player_new_y=ycoord
                                  $game_temp.player_new_direction=direction
                                  Kernel.pbCancelVehicles
                                  $PokemonGlobal.surfing=true
                                  Kernel.pbUpdateVehicle
                                  $scene.transfer_player(false)
                                  $game_map.autoplay
                                  $game_map.refresh
                                  }
                                  end

                                  Events.onAction+=proc{|sender,e|
                                  terrain=Kernel.pbFacingTerrainTag
                                  notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                                  if PBTerrain.isSurfable?(terrain) && !$PokemonGlobal.surfing &&
                                  !pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
                                  Kernel.pbSurf
                                  return
                                  end
                                  }

                                  #HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
                                  # terrain=Kernel.pbFacingTerrainTag
                                  # notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                                  # if !$DEBUG &&
                                  # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
                                  # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                  # return false
                                  # end
                                  # if $PokemonGlobal.surfing
                                  # Kernel.pbMessage(_INTL("You're already surfing."))
                                  # return false
                                  # end
                                  # 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,MetadataBicycleAlways)
                                  # Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
                                  # return false
                                  # end
                                  # if !PBTerrain.isSurfable?(terrain) || !notCliff
                                  # Kernel.pbMessage(_INTL("No surfing here!"))
                                  # return false
                                  # end
                                  # return true
                                  #})

                                  HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
                                  if !pbHiddenMoveAnimation(pokemon)
                                  Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
                                  end
                                  pbStartSurfing()
                                  return true
                                  })



                                  Waterfall.
                                  Spoiler:
                                  #===============================================================================
                                  # Waterfall
                                  #===============================================================================
                                  def Kernel.pbAscendWaterfall(event=nil)
                                  event=$game_player if !event
                                  return if !event
                                  return if event.direction!=8 # can't ascend if not facing up
                                  oldthrough=event.through
                                  oldmovespeed=event.move_speed
                                  terrain=Kernel.pbFacingTerrainTag
                                  return if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                  event.through=true
                                  event.move_speed=2
                                  loop do
                                  event.move_up
                                  terrain=pbGetTerrainTag(event)
                                  break if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                  end
                                  event.through=oldthrough
                                  event.move_speed=oldmovespeed
                                  end

                                  def Kernel.pbDescendWaterfall(event=nil)
                                  event=$game_player if !event
                                  return if !event
                                  return if event.direction!=2 # Can't descend if not facing down
                                  oldthrough=event.through
                                  oldmovespeed=event.move_speed
                                  terrain=Kernel.pbFacingTerrainTag
                                  return if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                  event.through=true
                                  event.move_speed=2
                                  loop do
                                  event.move_down
                                  terrain=pbGetTerrainTag(event)
                                  break if terrain!=PBTerrain::Waterfall && terrain!=PBTerrain::WaterfallCrest
                                  end
                                  event.through=oldthrough
                                  event.move_speed=oldmovespeed
                                  end

                                  def Kernel.pbWaterfall
                                  if $DEBUG ||
                                  (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORWATERFALL : $Trainer.badges[BADGEFORWATERFALL])
                                  movefinder=Kernel.pbCheckMove(:WATERFALL)
                                  if $DEBUG || ($PokemonBag.pbQuantity(PBItems::WATERBOARD)>0
                                  if Kernel.pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
                                  speciesname=!movefinder ? $Trainer.name : movefinder.name
                                  Kernel.pbMessage(_INTL("{1} used Waterfall.",speciesname))
                                  pbHiddenMoveAnimation(movefinder)
                                  pbAscendWaterfall
                                  return true
                                  end
                                  else
                                  Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
                                  end
                                  else
                                  Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
                                  end
                                  return false
                                  end

                                  Events.onAction+=proc{|sender,e|
                                  terrain=Kernel.pbFacingTerrainTag
                                  if terrain==PBTerrain::Waterfall
                                  Kernel.pbWaterfall
                                  return
                                  end
                                  if terrain==PBTerrain::WaterfallCrest
                                  Kernel.pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
                                  return
                                  end
                                  }

                                  #HiddenMoveHandlers::CanUseMove.add(:WATERFALL,proc{|move,pkmn|
                                  # if !$DEBUG &&
                                  # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORWATERFALL : $Trainer.badges[BADGEFORWATERFALL])
                                  # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                  # return false
                                  # end
                                  # terrain=Kernel.pbFacingTerrainTag
                                  # if terrain!=PBTerrain::Waterfall
                                  # Kernel.pbMessage(_INTL("Can't use that here."))
                                  # return false
                                  # end
                                  # return true
                                  #})

                                  HiddenMoveHandlers::UseMove.add(:WATERFALL,proc{|move,pokemon|
                                  if !pbHiddenMoveAnimation(pokemon)
                                  Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
                                  end
                                  Kernel.pbAscendWaterfall
                                  return true
                                  })


                                  Dive.
                                  Spoiler:
                                  #===============================================================================
                                  # Dive
                                  #===============================================================================
                                  def Kernel.pbDive
                                  divemap=pbGetMetadata($game_map.map_id,MetadataDiveMap)
                                  return false if !divemap
                                  if $DEBUG ||
                                  (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE])
                                  movefinder=Kernel.pbCheckMove(:DIVE)
                                  if $DEBUG || ($PokemonBag.pbQuantity(PBItems::DIVEBOARD)>0
                                  if Kernel.pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
                                  speciesname=!movefinder ? $Trainer.name : movefinder.name
                                  Kernel.pbMessage(_INTL("{1} used Dive.",speciesname))
                                  pbHiddenMoveAnimation(movefinder)
                                  pbFadeOutIn(99999){
                                  $game_temp.player_new_map_id=divemap
                                  $game_temp.player_new_x=$game_player.x
                                  $game_temp.player_new_y=$game_player.y
                                  $game_temp.player_new_direction=$game_player.direction
                                  Kernel.pbCancelVehicles
                                  $PokemonGlobal.diving=true
                                  Kernel.pbUpdateVehicle
                                  $scene.transfer_player(false)
                                  $game_map.autoplay
                                  $game_map.refresh
                                  }
                                  return true
                                  end
                                  else
                                  Kernel.pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
                                  end
                                  else
                                  Kernel.pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
                                  end
                                  return false
                                  end

                                  def Kernel.pbSurfacing
                                  return if !$PokemonGlobal.diving
                                  divemap=nil
                                  meta=pbLoadMetadata
                                  for i in 0...meta.length
                                  if meta[i] && meta[i][MetadataDiveMap]
                                  if meta[i][MetadataDiveMap]==$game_map.map_id
                                  divemap=i
                                  break
                                  end
                                  end
                                  end
                                  return if !divemap
                                  movefinder=Kernel.pbCheckMove(:DIVE)
                                  if $DEBUG || (movefinder &&
                                  (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE]) )
                                  if Kernel.pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
                                  speciesname=!movefinder ? $Trainer.name : movefinder.name
                                  Kernel.pbMessage(_INTL("{1} used Dive.",speciesname))
                                  pbHiddenMoveAnimation(movefinder)
                                  pbFadeOutIn(99999){
                                  $game_temp.player_new_map_id=divemap
                                  $game_temp.player_new_x=$game_player.x
                                  $game_temp.player_new_y=$game_player.y
                                  $game_temp.player_new_direction=$game_player.direction
                                  Kernel.pbCancelVehicles
                                  $PokemonGlobal.surfing=true
                                  Kernel.pbUpdateVehicle
                                  $scene.transfer_player(false)
                                  surfbgm=pbGetMetadata(0,MetadataSurfBGM)
                                  if surfbgm
                                  pbBGMPlay(surfbgm)
                                  else
                                  $game_map.autoplayAsCue
                                  end
                                  $game_map.refresh
                                  }
                                  return true
                                  end
                                  else
                                  Kernel.pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
                                  end
                                  return false
                                  end

                                  def Kernel.pbTransferUnderwater(mapid,xcoord,ycoord,direction=$game_player.direction)
                                  pbFadeOutIn(99999){
                                  $game_temp.player_new_map_id=mapid
                                  $game_temp.player_new_x=xcoord
                                  $game_temp.player_new_y=ycoord
                                  $game_temp.player_new_direction=direction
                                  Kernel.pbCancelVehicles
                                  $PokemonGlobal.diving=true
                                  Kernel.pbUpdateVehicle
                                  $scene.transfer_player(false)
                                  $game_map.autoplay
                                  $game_map.refresh
                                  }
                                  end

                                  Events.onAction+=proc{|sender,e|
                                  terrain=$game_player.terrain_tag
                                  if terrain==PBTerrain::DeepWater
                                  Kernel.pbDive
                                  return
                                  end
                                  if $PokemonGlobal.diving
                                  if DIVINGSURFACEANYWHERE
                                  Kernel.pbSurfacing
                                  return
                                  else
                                  divemap=nil
                                  meta=pbLoadMetadata
                                  for i in 0...meta.length
                                  if meta[i] && meta[i][MetadataDiveMap]
                                  if meta[i][MetadataDiveMap]==$game_map.map_id
                                  divemap=i
                                  break
                                  end
                                  end
                                  end
                                  if $MapFactory.getTerrainTag(divemap,$game_player.x,$game_player.y)==PBTerrain::DeepWater
                                  Kernel.pbSurfacing
                                  return
                                  end
                                  end
                                  end
                                  }

                                  #HiddenMoveHandlers::CanUseMove.add(:DIVE,proc{|move,pkmn|
                                  # if !$DEBUG &&
                                  # !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE])
                                  # Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                  # return false
                                  # end
                                  # if $PokemonGlobal.diving
                                  # return true if DIVINGSURFACEANYWHERE
                                  # divemap=nil
                                  # meta=pbLoadMetadata
                                  # for i in 0...meta.length
                                  # if meta[i] && meta[i][MetadataDiveMap]
                                  # if meta[i][MetadataDiveMap]==$game_map.map_id
                                  # divemap=i
                                  # break
                                  # end
                                  # end
                                  # end
                                  # if $MapFactory.getTerrainTag(divemap,$game_player.x,$game_player.y)==PBTerrain::DeepWater
                                  # return true
                                  # else
                                  # Kernel.pbMessage(_INTL("Can't use that here."))
                                  # return false
                                  # end
                                  # end
                                  # if $game_player.terrain_tag!=PBTerrain::DeepWater
                                  # Kernel.pbMessage(_INTL("Can't use that here."))
                                  # return false
                                  # end
                                  # if !pbGetMetadata($game_map.map_id,MetadataDiveMap)
                                  # Kernel.pbMessage(_INTL("Can't use that here."))
                                  # return false
                                  # end
                                  # return true
                                  #})

                                  HiddenMoveHandlers::UseMove.add(:DIVE,proc{|move,pokemon|
                                  wasdiving=$PokemonGlobal.diving
                                  if $PokemonGlobal.diving
                                  divemap=nil
                                  meta=pbLoadMetadata
                                  for i in 0...meta.length
                                  if meta[i] && meta[i][MetadataDiveMap]
                                  if meta[i][MetadataDiveMap]==$game_map.map_id
                                  divemap=i
                                  break
                                  end
                                  end
                                  end
                                  else
                                  divemap=pbGetMetadata($game_map.map_id,MetadataDiveMap)
                                  end
                                  return false if !divemap
                                  if !pbHiddenMoveAnimation(pokemon)
                                  Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
                                  end
                                  pbFadeOutIn(99999){
                                  $game_temp.player_new_map_id=divemap
                                  $game_temp.player_new_x=$game_player.x
                                  $game_temp.player_new_y=$game_player.y
                                  $game_temp.player_new_direction=$game_player.direction
                                  Kernel.pbCancelVehicles
                                  if wasdiving
                                  $PokemonGlobal.surfing=true
                                  else
                                  $PokemonGlobal.diving=true
                                  end
                                  Kernel.pbUpdateVehicle
                                  $scene.transfer_player(false)
                                  $game_map.autoplay
                                  $game_map.refresh
                                  }
                                  return true
                                  })
                                  Delete the infamous line 506.

                                  And please, in the next time, put your code between code tags. I needed a software for auto-indent your code.
                                  __________________
                                  Reply With Quote
                                    #42    
                                  Old June 5th, 2016 (12:39 AM).
                                  Vernerl Vernerl is offline
                                     
                                    Join Date: May 2016
                                    Gender: Male
                                    Posts: 9
                                    Quote:
                                    Originally Posted by FL View Post
                                    Delete the infamous line 506.

                                    And please, in the next time, put your code between code tags. I needed a software for auto-indent your code.
                                    (With regards to the code tags.) I know I should've done that, but I don't know how...

                                    Anyway, I've deleted line 506 and it still gives the same error.
                                    Reply With Quote
                                      #43    
                                    Old June 5th, 2016 (6:11 AM).
                                    FL's Avatar
                                    FL FL is offline
                                    Pokémon Island Creator
                                       
                                      Join Date: Sep 2010
                                      Gender: Male
                                      Posts: 1,725
                                      Quote:
                                      Originally Posted by Vernerl View Post
                                      (With regards to the code tags.) I know I should've done that, but I don't know how...

                                      Anyway, I've deleted line 506 and it still gives the same error.
                                      Use "code" tag instead of "spoiler" tag:

                                      [code]Your code goes here[/*code] . Without the *.

                                      Sorry for the wrong tip. Return line 506. The error root is a missing ')'. Change '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0' into '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0)'.
                                      __________________
                                      Reply With Quote
                                        #44    
                                      Old June 5th, 2016 (7:56 AM).
                                      Vernerl Vernerl is offline
                                         
                                        Join Date: May 2016
                                        Gender: Male
                                        Posts: 9
                                        Quote:
                                        Originally Posted by FL View Post
                                        Use "code" tag instead of "spoiler" tag:

                                        [code]Your code goes here[/*code] . Without the *.

                                        Sorry for the wrong tip. Return line 506. The error root is a missing ')'. Change '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0' into '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0)'.
                                        Actually... You're wrong.
                                        My code said: '($PokemonBag.pbQuantity(PBItems::SURFBOARD)>0' so i changed it to: '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0' and now there are no errors. (I applied this fix to Waterfall and Dive aswell.)
                                        Reply With Quote
                                          #45    
                                        Old June 14th, 2016 (4:35 AM).
                                        Vernerl Vernerl is offline
                                           
                                          Join Date: May 2016
                                          Gender: Male
                                          Posts: 9
                                          Well I'm here again. I tried doing this with Rocksmash, and the game opens fine, but the rocks act as though I don't have Rocksmash...
                                          Here's the coding:
                                          Code:
                                          def pbRockSmashRandomEncounter
                                            if rand(100)<25
                                              pbEncounter(EncounterTypes::RockSmash)
                                            end
                                          end
                                          
                                          def Kernel.pbRockSmash
                                            if $DEBUG ||
                                              (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORROCKSMASH : $Trainer.badges[BADGEFORROCKSMASH])
                                              movefinder=Kernel.pbCheckMove(:ROCKSMASH)
                                              if $DEBUG || ($PokemonBag.pbQuantity(PBItems::HM07)>0)
                                                if Kernel.pbConfirmMessage(_INTL("This rock appears to be breakable. Would you like to use Rock Smash?"))
                                                  speciesname=!movefinder ? $Trainer.name : movefinder.name
                                                  Kernel.pbMessage(_INTL("{1} used Rock Smash!",speciesname))
                                                  pbHiddenMoveAnimation(movefinder)
                                                  return true
                                                end
                                              else
                                                Kernel.pbMessage(_INTL("It's a rugged rock, but a Pokémon may be able to smash it."))
                                              end
                                            else
                                              Kernel.pbMessage(_INTL("It's a rugged rock, but a Pokémon may be able to smash it."))
                                            end
                                            return false
                                          end
                                          
                                          #HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc{|move,pkmn|
                                          #   terrain=Kernel.pbFacingTerrainTag
                                          #   if !$DEBUG &&
                                          #      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORROCKSMASH : $Trainer.badges[BADGEFORROCKSMASH])
                                          #     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                          #     return false
                                          #   end
                                          #   facingEvent=$game_player.pbFacingEvent
                                          #   if !facingEvent || facingEvent.name!="Rock"
                                          #     Kernel.pbMessage(_INTL("Can't use that here."))
                                          #     return false
                                          #   end
                                          #   return true  
                                          #})
                                          
                                          HiddenMoveHandlers::UseMove.add(:ROCKSMASH,proc{|move,pokemon|
                                             if !pbHiddenMoveAnimation(pokemon)
                                               Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
                                             end
                                             facingEvent=$game_player.pbFacingEvent
                                             if facingEvent
                                               facingEvent.erase
                                               $PokemonMap.addErasedEvent(facingEvent.id)
                                             end
                                             return true  
                                          })
                                          Reply With Quote
                                            #46    
                                          Old June 17th, 2016 (2:48 AM).
                                          FL's Avatar
                                          FL FL is offline
                                          Pokémon Island Creator
                                             
                                            Join Date: Sep 2010
                                            Gender: Male
                                            Posts: 1,725
                                            Quote:
                                            Originally Posted by Vernerl View Post
                                            Well I'm here again. I tried doing this with Rocksmash, and the game opens fine, but the rocks act as though I don't have Rocksmash...
                                            Here's the coding:
                                            Code:
                                            def pbRockSmashRandomEncounter
                                              if rand(100)<25
                                                pbEncounter(EncounterTypes::RockSmash)
                                              end
                                            end
                                            
                                            def Kernel.pbRockSmash
                                              if $DEBUG ||
                                                (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORROCKSMASH : $Trainer.badges[BADGEFORROCKSMASH])
                                                movefinder=Kernel.pbCheckMove(:ROCKSMASH)
                                                if $DEBUG || ($PokemonBag.pbQuantity(PBItems::HM07)>0)
                                                  if Kernel.pbConfirmMessage(_INTL("This rock appears to be breakable. Would you like to use Rock Smash?"))
                                                    speciesname=!movefinder ? $Trainer.name : movefinder.name
                                                    Kernel.pbMessage(_INTL("{1} used Rock Smash!",speciesname))
                                                    pbHiddenMoveAnimation(movefinder)
                                                    return true
                                                  end
                                                else
                                                  Kernel.pbMessage(_INTL("It's a rugged rock, but a Pokémon may be able to smash it."))
                                                end
                                              else
                                                Kernel.pbMessage(_INTL("It's a rugged rock, but a Pokémon may be able to smash it."))
                                              end
                                              return false
                                            end
                                            
                                            #HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc{|move,pkmn|
                                            #   terrain=Kernel.pbFacingTerrainTag
                                            #   if !$DEBUG &&
                                            #      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORROCKSMASH : $Trainer.badges[BADGEFORROCKSMASH])
                                            #     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                            #     return false
                                            #   end
                                            #   facingEvent=$game_player.pbFacingEvent
                                            #   if !facingEvent || facingEvent.name!="Rock"
                                            #     Kernel.pbMessage(_INTL("Can't use that here."))
                                            #     return false
                                            #   end
                                            #   return true  
                                            #})
                                            
                                            HiddenMoveHandlers::UseMove.add(:ROCKSMASH,proc{|move,pokemon|
                                               if !pbHiddenMoveAnimation(pokemon)
                                                 Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
                                               end
                                               facingEvent=$game_player.pbFacingEvent
                                               if facingEvent
                                                 facingEvent.erase
                                                 $PokemonMap.addErasedEvent(facingEvent.id)
                                               end
                                               return true  
                                            })
                                            Do you have the badge for Rock Smash AND HM07?
                                            __________________
                                            Reply With Quote
                                              #47    
                                            Old June 17th, 2016 (10:54 PM).
                                            Vernerl Vernerl is offline
                                               
                                              Join Date: May 2016
                                              Gender: Male
                                              Posts: 9
                                              Quote:
                                              Originally Posted by FL View Post
                                              Do you have the badge for Rock Smash AND HM07?
                                              I turned that requirement off.
                                              Reply With Quote
                                                #48    
                                              Old June 19th, 2016 (4:10 PM).
                                              FL's Avatar
                                              FL FL is offline
                                              Pokémon Island Creator
                                                 
                                                Join Date: Sep 2010
                                                Gender: Male
                                                Posts: 1,725
                                                Quote:
                                                Originally Posted by Vernerl View Post
                                                I turned that requirement off.
                                                So, you remove this code part and the item worked?
                                                __________________
                                                Reply With Quote
                                                  #49    
                                                Old June 19th, 2016 (11:20 PM).
                                                Vernerl Vernerl is offline
                                                   
                                                  Join Date: May 2016
                                                  Gender: Male
                                                  Posts: 9
                                                  Quote:
                                                  Originally Posted by FL View Post
                                                  So, you remove this code part and the item worked?
                                                  Nope. I turned it off in the settings beforehand. It still doesn't work.
                                                  Reply With Quote
                                                    #50    
                                                  Old June 20th, 2016 (2:03 PM). Edited June 20th, 2016 by Zeak6464.
                                                  Zeak6464's Avatar
                                                  Zeak6464 Zeak6464 is offline
                                                  The Cold Guy
                                                     
                                                    Join Date: Mar 2013
                                                    Location: USA
                                                    Age: 25
                                                    Gender: Male
                                                    Nature: Calm
                                                    Posts: 579
                                                    This is 100% Working on version 15+

                                                    Item Effect
                                                    Code:
                                                    #Surf
                                                    ItemHandlers::UseFromBag.add(:SURFBOARD,proc{|item|
                                                       next canUseMoveSurf? ? 2 : 0
                                                    })
                                                    
                                                    ItemHandlers::UseInField.add(:SURFBOARD,proc{|item|
                                                       useMoveSurf if canUseMoveSurf?
                                                    })
                                                    Hidden Moves
                                                    Code:
                                                    #===============================================================================
                                                    # Surf
                                                    #===============================================================================
                                                    def Kernel.pbSurf
                                                    if $game_player.pbHasDependentEvents?
                                                    return false
                                                    end
                                                    if $DEBUG || movefinder=Kernel.pbCheckMove(:SURF)
                                                    if $DEBUG || $PokemonBag.pbQuantity(PBItems::SURFBOARD)>0
                                                    if Kernel.pbConfirmMessage(_INTL("The water is a deep blue, would you like to swim?"))
                                                    speciesname=!movefinder ? $Trainer.name : movefinder.name
                                                    Kernel.pbMessage(_INTL("You started swimming!",speciesname))
                                                    
                                                    surfbgm=pbGetMetadata(0,MetadataSurfBGM)
                                                    if surfbgm
                                                    pbCueBGM(surfbgm,0.5)
                                                    end
                                                    
                                                    pbStartSurfing()
                                                    return true
                                                    end
                                                    end
                                                    end
                                                    return false
                                                    end
                                                    
                                                    def pbStartSurfing()
                                                    Kernel.pbCancelVehicles
                                                    $PokemonEncounters.clearStepCount
                                                    $PokemonGlobal.surfing=true
                                                    Kernel.pbUpdateVehicle
                                                    Kernel.pbJumpToward
                                                    Kernel.pbUpdateVehicle
                                                    $game_player.check_event_trigger_here([1,2])
                                                    end
                                                    
                                                    def pbEndSurf(xOffset,yOffset)
                                                    return false if !$PokemonGlobal.surfing
                                                    x=$game_player.x
                                                    y=$game_player.y
                                                    currentTag=$game_map.terrain_tag(x,y)
                                                    facingTag=Kernel.pbFacingTerrainTag
                                                    if pbIsSurfableTag?(currentTag) && !pbIsSurfableTag?(facingTag)
                                                    if Kernel.pbJumpToward
                                                    Kernel.pbCancelVehicles
                                                    $game_map.autoplayAsCue
                                                    $game_player.increase_steps
                                                    result=$game_player.check_event_trigger_here([1,2])
                                                    Kernel.pbOnStepTaken(result)
                                                    end
                                                    return true
                                                    end
                                                    return false
                                                    end
                                                    
                                                    Events.onAction+=proc{|sender,e|
                                                    terrain=Kernel.pbFacingTerrainTag
                                                    notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                                                    if pbIsWaterTag?(terrain) && !$PokemonGlobal.surfing && 
                                                    !pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
                                                    Kernel.pbSurf
                                                    return
                                                    end
                                                    }
                                                    
                                                    def canUseMoveSurf?
                                                    terrain=Kernel.pbFacingTerrainTag
                                                    notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                                                    if $PokemonGlobal.surfing
                                                    Kernel.pbMessage(_INTL("You're already swimming."))
                                                    return false
                                                    end
                                                    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,MetadataBicycleAlways)
                                                    Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
                                                    return false
                                                    end
                                                    #if !PBTerrain.isSurfable?(terrain) || !notCliff
                                                    if !pbIsWaterTag?(terrain) || !notCliff
                                                    Kernel.pbMessage(_INTL("No swimming here!"))
                                                    return false
                                                    end
                                                    return true
                                                    end
                                                    
                                                    def useMoveSurf
                                                    if !pbHiddenMoveAnimation(nil)
                                                    Kernel.pbMessage(_INTL("You started swimming!",$Trainer.name,"Surf"))
                                                    end
                                                    pbStartSurfing()
                                                    return true
                                                    end
                                                    
                                                    HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
                                                    if !pbHiddenMoveAnimation(pokemon)
                                                    Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
                                                    end
                                                    pbStartSurfing()
                                                    return true
                                                    })
                                                    __________________
                                                    Reply With Quote
                                                    Reply

                                                    Quick Reply

                                                    Join the conversation!

                                                    Create an account to post a reply in this thread, participate in other discussions, and more!

                                                    Create a PokéCommunity Account

                                                    Sponsored Links
                                                    Thread Tools

                                                    Posting Rules
                                                    You may not post new threads
                                                    You may not post replies
                                                    You may not post attachments
                                                    You may not edit your posts

                                                    BB code is On
                                                    Smilies are On
                                                    [IMG] code is On
                                                    HTML code is Off

                                                    Forum Jump


                                                    All times are GMT -8. The time now is 6:26 PM.