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
  #1    
Old July 13th, 2013 (1:29 PM). Edited June 3rd, 2018 by FL.
FL's Avatar
FL FL is offline
Pokémon Island Creator
     
    Join Date: Sep 2010
    Gender: Male
    Posts: 1,765
    In this tutorial I explain how to turn HMs and/or other moves that work outside of battle to items.

    First, in PokemonHiddenMoves script section comment the 'HiddenMoveHandlers::CanUseMove' proc (all the code, inclusive the '})'). Change the line '(!$DEBUG && !movefinder)' (there's one for each move that can be used outside menu) to '(!$DEBUG && $PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)==0)'. Before line 'speciesname = (movefinder) ? movefinder.name : $Trainer.name', add line 'movefinder=nil' for won't show pokémon name and animation. There's a item example for item.txt PBS:

    Code:
    601,SURFBOARD,Surfboard,Surfboards,8,0,"Insert description here.",0,0,6
    Adding the move in the "Use" item command

    At this point, the item is already working except the "Use" command. This command is almost unnecessary for some moves like Cut and Surf, but is vital for others like Fly and Flash.

    In item PBS data change the '0,0,6' to '2,0,6'. Copy the content of 'HiddenMoveHandlers::CanUseMove' proc (the code between the first line and the '})') and put between a method who start in the first line like 'def canUseMoveSurf?' and ends with 'end'. After method first line (the one who starts with "def"), add line 'showmsg = true'. Do the same with 'HiddenMoveHandlers::UseMove' and name the method something like 'def useMoveSurf'. For this last one remember to change pokemon.name to $Trainer.name, pbHiddenMoveAnimation(pokemon) to pbHiddenMoveAnimation(nil) and PBMoves.getName(move) to the move name (e. g. "Surf"). In PokemonItemEffects script section, add the two item handlers:

    Code:
    ItemHandlers::UseFromBag.add(:YOURITEMINTERNALNAME,proc{|item|
       next canUseMoveSurf? ? 2 : 0
    })
    
    ItemHandlers::UseInField.add(:YOURITEMINTERNALNAME,proc{|item|
       useMoveSurf if canUseMoveSurf?
    })
    I suggest to change the text like "used Surf" to "used Surfboard". Mark HIDDENMOVESCOUNTBADGES as true and all badges to 0 to remove the badge requirements.

    Example

    I will made an example of the adding in the "use" item command using a knife item for Cut. First, I changed the eighth value to 2.

    Code:
    602,KNIFE,Knife,Knifes,8,0,"Cut down thin trees.",2,0,6
    I copied the two HiddenMoveHandlers below (these are in base Essentials):

    Code:
    HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn,showmsg|
       return false if !pbCheckHiddenMoveBadge(BADGEFORCUT,showmsg)
       facingEvent = $game_player.pbFacingEvent
       if !facingEvent || facingEvent.name!="Tree"
         Kernel.pbMessage(_INTL("Can't use that here.")) if showmsg
         return false
       end
       return true
    })
    
    HiddenMoveHandlers::UseMove.add(:CUT,proc{|move,pokemon|
       if !pbHiddenMoveAnimation(pokemon)
         Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
       end
       facingEvent = $game_player.pbFacingEvent
       if facingEvent
         pbSmashEvent(facingEvent)
       end
       return true
    })
    For making the two methods below. I added after the handlers:

    Code:
    def canUseMoveCut?
       showmsg = true
       return false if !pbCheckHiddenMoveBadge(BADGEFORCUT,showmsg)
       facingEvent = $game_player.pbFacingEvent
       if !facingEvent || facingEvent.name!="Tree"
         Kernel.pbMessage(_INTL("Can't use that here.")) if showmsg
         return false
       end
       return true
    end
    
    def useMoveCut
       if !pbHiddenMoveAnimation(nil)
         Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Cut"))
       end
       facingEvent = $game_player.pbFacingEvent
       if facingEvent
         pbSmashEvent(facingEvent)
       end
       return true
    end
    And I added at PokemonItemEffects script section:

    Code:
    ItemHandlers::UseFromBag.add(:KNIFE,proc{|item|
       next canUseMoveCut? ? 2 : 0
    })
    
    ItemHandlers::UseInField.add(:KNIFE,proc{|item|
       useMoveCut if canUseMoveCut?
    })
    __________________
    Reply With Quote
      #2    
    Old December 23rd, 2013 (2:24 AM).
    Rayquaza.'s Avatar
    Rayquaza. Rayquaza. is offline
    Lead Dev in Pokémon Order and Chaos
       
      Join Date: Sep 2011
      Location: United Kingdom
      Age: 22
      Gender: Male
      Nature: Adamant
      Posts: 691
      I too am finding it difficult to understand what you've stated in the 'Adding the move in the "Use" item command'.

      Is there no way that it could be better explained?
      __________________
      Reply With Quote
        #3    
      Old December 23rd, 2013 (8:37 AM).
      p.claydon p.claydon is offline
         
        Join Date: Jan 2011
        Gender: Female
        Posts: 389
        thank yu for this its pretty straight forward if you follow the steps
        Reply With Quote
          #4    
        Old December 23rd, 2013 (9:34 AM).
        Rayquaza.'s Avatar
        Rayquaza. Rayquaza. is offline
        Lead Dev in Pokémon Order and Chaos
           
          Join Date: Sep 2011
          Location: United Kingdom
          Age: 22
          Gender: Male
          Nature: Adamant
          Posts: 691
          Quote:
          Originally Posted by p.claydon View Post
          thank yu for this its pretty straight forward if you follow the steps
          I am following the steps. But the middle section isn't very clear to me.
          __________________
          Reply With Quote
            #5    
          Old December 24th, 2013 (3:47 AM).
          p.claydon p.claydon is offline
             
            Join Date: Jan 2011
            Gender: Female
            Posts: 389
            well bit busy atm (sortting new laptop out) but when able (prob boxing day) i'll see if i can do a better tutorial
            __________________
            Still learning how to sprite but if you want to look at my progress then here you go
            http://pclaydon.deviantart.com/gallery/
            Reply With Quote
              #6    
            Old December 24th, 2013 (5:23 AM).
            Rayquaza.'s Avatar
            Rayquaza. Rayquaza. is offline
            Lead Dev in Pokémon Order and Chaos
               
              Join Date: Sep 2011
              Location: United Kingdom
              Age: 22
              Gender: Male
              Nature: Adamant
              Posts: 691
              Okay. Does that mean you and FL are the same person or something?
              __________________
              Reply With Quote
                #7    
              Old December 26th, 2013 (6:34 AM).
              FL's Avatar
              FL FL is offline
              Pokémon Island Creator
                 
                Join Date: Sep 2010
                Gender: Male
                Posts: 1,765
                Topic updated with an example.

                Quote:
                Originally Posted by Rayquaza. View Post
                Okay. Does that mean you and FL are the same person or something?
                Yeah! And in this post I'm talking with myself!

                Just joking. I'm not p.claydon.
                __________________
                Reply With Quote
                  #8    
                Old December 27th, 2013 (3:51 AM).
                Rayquaza.'s Avatar
                Rayquaza. Rayquaza. is offline
                Lead Dev in Pokémon Order and Chaos
                   
                  Join Date: Sep 2011
                  Location: United Kingdom
                  Age: 22
                  Gender: Male
                  Nature: Adamant
                  Posts: 691
                  I'm still having trouble with the script. It keeps coming up with syntax errors and I'm unsure why.
                  __________________
                  Reply With Quote
                    #9    
                  Old December 28th, 2013 (11:49 AM).
                  FL's Avatar
                  FL FL is offline
                  Pokémon Island Creator
                     
                    Join Date: Sep 2010
                    Gender: Male
                    Posts: 1,765
                    Quote:
                    Originally Posted by Rayquaza. View Post
                    I'm still having trouble with the script. It keeps coming up with syntax errors and I'm unsure why.
                    Post the script parts here and I try to help you.

                    Your problem may be the same problem of other people that will uses this tutorial.
                    __________________
                    Reply With Quote
                      #10    
                    Old March 23rd, 2014 (12:01 AM).
                    mej71's Avatar
                    mej71 mej71 is offline
                       
                      Join Date: Mar 2014
                      Location: Omnipresence
                      Gender: Male
                      Posts: 1,222
                      How does one alter this code for moves like Fly or Flash in which the
                      Spoiler:
                      if $DEBUG || movefinder
                      lines do not exist? I am getting syntax errors.
                      Reply With Quote
                        #11    
                      Old March 24th, 2014 (8:37 PM).
                      Derxwna Kapsyla's Avatar
                      Derxwna Kapsyla Derxwna Kapsyla is offline
                      Derxwna "The Badman" Kapsyla
                         
                        Join Date: Jun 2011
                        Location: Margate, FL
                        Age: 25
                        Gender: Male
                        Nature: Lax
                        Posts: 394
                        I'm actually curious about how to bind Fly to an item as well. My scripters and I have been unable to really figure out how to bind what fly does to an individual item, despite searching through the code for fly to find a clue, and I have it planned for a Fly item to appear in the next demo of my game, and I'd rather not delay the item or the game if it's unavoidable
                        __________________
                        Development Blog:
                        For more information future news and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
                        Game Projects:
                        In Progress:
                        Reply With Quote
                          #12    
                        Old March 25th, 2014 (10:22 AM).
                        FL's Avatar
                        FL FL is offline
                        Pokémon Island Creator
                           
                          Join Date: Sep 2010
                          Gender: Male
                          Posts: 1,765
                          Quote:
                          Originally Posted by mej71 View Post
                          How does one alter this code for moves like Fly or Flash in which the
                          Spoiler:
                          if $DEBUG || movefinder
                          lines do not exist? I am getting syntax errors.
                          For these moves that only can be triggered at menu screen just don't change HiddenMoveHandlers::CanUseMove code since it's can't be called when the player haven't a pokémon with this move.
                          __________________
                          Reply With Quote
                            #13    
                          Old March 25th, 2014 (1:48 PM).
                          mej71's Avatar
                          mej71 mej71 is offline
                             
                            Join Date: Mar 2014
                            Location: Omnipresence
                            Gender: Male
                            Posts: 1,222
                            I can't get the item to be useable for fly. For the cut example, that line you said to initially change is not located in CanUseMove, it's in Kernel.pbCut, and returns sytnax errors if you change it.
                            Sorry if I'm just incompetent, but it's really confusing me.
                            Reply With Quote
                              #14    
                            Old March 27th, 2014 (12:34 PM).
                            FL's Avatar
                            FL FL is offline
                            Pokémon Island Creator
                               
                              Join Date: Sep 2010
                              Gender: Male
                              Posts: 1,765
                              Sorry! Fly is an exception since $PokemonTemp.flydata had some definitions at the summary screen, so the methods should be:

                              Code:
                              def canUseMoveFly?
                                if !$DEBUG &&
                                  !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLY : $Trainer.badges[BADGEFORFLY])
                                  Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
                                  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,MetadataOutdoor)
                                  Kernel.pbMessage(_INTL("Can't use that here."))
                                  return false
                                end
                                return true
                              end  
                              
                              def useMoveFly
                                scene=PokemonRegionMapScene.new(-1,false)
                                screen=PokemonRegionMap.new(scene)
                                ret=screen.pbStartFlyScreen
                                return false if !ret
                                $PokemonTemp.flydata=ret
                                if !$PokemonTemp.flydata
                                  Kernel.pbMessage(_INTL("Can't use that here."))
                                end
                                if !pbHiddenMoveAnimation(nil)
                                  Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Fly"))
                                end
                                pbFadeOutIn(99999){
                                  Kernel.pbCancelVehicles
                                  $game_temp.player_new_map_id=$PokemonTemp.flydata[0]
                                  $game_temp.player_new_x=$PokemonTemp.flydata[1]
                                  $game_temp.player_new_y=$PokemonTemp.flydata[2]
                                  $PokemonTemp.flydata=nil
                                  $game_temp.player_new_direction=2
                                  $scene.transfer_player
                                  $game_map.autoplay
                                  $game_map.refresh
                                }
                                pbEraseEscapePoint
                                return true
                              end
                              Tested.
                              __________________
                              Reply With Quote
                                #15    
                              Old March 27th, 2014 (12:40 PM).
                              Mugendai's Avatar
                              Mugendai Mugendai is offline
                              Glitchologist
                                 
                                Join Date: Jun 2010
                                Posts: 11
                                This is my attempt at turning Fly into a key item, called the Mini Teleporter, but it doesn't work. HM Fly works normally, but if I press F5, it says "Can't use that here." and if I bypass that part of the code, the game has a scripting error.

                                I assume it's because specifically $PokemonTemp.flydata is missing; $PokemonTemp itself exists to the code. How would I fix this?

                                Code:
                                ItemHandlers::UseInField.add(:TELEPORTER,proc{|item|
                                   if !$PokemonTemp.flydata || !pbGetMetadata($game_map.map_id,MetadataOutdoor)
                                     Kernel.pbMessage(_INTL("Can't use that here."))
                                     next false
                                   end
                                   if $game_player.pbHasDependentEvents?
                                     Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
                                     next false
                                   end
                                   Kernel.pbMessage(_INTL("{1} used the Mini Teleporter!",$Trainer.name))
                                   pbFadeOutIn(99999){
                                      $game_temp.player_new_map_id=$PokemonTemp.flydata[0]
                                      $game_temp.player_new_x=$PokemonTemp.flydata[1]
                                      $game_temp.player_new_y=$PokemonTemp.flydata[2]
                                      $PokemonTemp.flydata=nil
                                      $game_temp.player_new_direction=2
                                      $scene.transfer_player
                                      $game_map.autoplay
                                      $game_map.refresh
                                   }
                                   pbEraseEscapePoint
                                   next true
                                })
                                Here's the error if I bypass the "Can't use that here." message:

                                Code:
                                ---------------------------
                                Touhoumon Faith & Prayer Version 1.8
                                ---------------------------
                                Exception: NoMethodError
                                
                                Message: undefined method `[]' for nil:NilClass
                                
                                PokemonItemEffects:996
                                
                                PokemonItemEffects:995:in `pbFadeOutIn'
                                
                                PokemonItemEffects:995
                                
                                PokemonItemEffects:985:in `call'
                                
                                PBEvent:150:in `trigger'
                                
                                PokemonItems:186:in `triggerUseInField'
                                
                                PokemonItems:379:in `pbUseKeyItemInField'
                                
                                PokemonField:2276:in `pbUseKeyItem'
                                
                                Scene_Map:170:in `update'
                                
                                Scene_Map:68:in `main'
                                
                                
                                
                                This exception was logged in 
                                
                                C:\Users\Mugendai\Saved Games/Touhoumon Faith _ Prayer Version 1_8/errorlog.txt.
                                
                                Press Ctrl+C to copy this message to the clipboard.
                                ---------------------------
                                OK   
                                ---------------------------
                                Edit: Sorry, didn't see new post above.
                                Reply With Quote
                                  #16    
                                Old March 27th, 2014 (12:44 PM).
                                mej71's Avatar
                                mej71 mej71 is offline
                                   
                                  Join Date: Mar 2014
                                  Location: Omnipresence
                                  Gender: Male
                                  Posts: 1,222
                                  Worked. Thank you so much!
                                  Reply With Quote
                                    #17    
                                  Old March 28th, 2014 (5:27 AM).
                                  Mugendai's Avatar
                                  Mugendai Mugendai is offline
                                  Glitchologist
                                     
                                    Join Date: Jun 2010
                                    Posts: 11
                                    It worked for me as well, thanks.
                                    Reply With Quote
                                      #18    
                                    Old November 13th, 2014 (4:55 AM).
                                    C me's Avatar
                                    C me C me is offline
                                    Creator of Pokemon League Of Legends
                                       
                                      Join Date: Jan 2014
                                      Age: 21
                                      Gender: Male
                                      Posts: 683
                                      What does this look like in a hex editor? I dont't understand what to do with these ASM commands.
                                      __________________
                                      Check out my hack: Pokemon League of Legends.
                                      Join the subreddit: https://www.reddit.com/r/PokemonLoL/
                                      If you would like to give me money for no reason you can do so here
                                      Reply With Quote
                                        #19    
                                      Old November 13th, 2014 (12:17 PM).
                                      Maruno's Avatar
                                      Maruno Maruno is offline
                                      Lead Dev of Pokémon Essentials
                                         
                                        Join Date: Jan 2008
                                        Location: England
                                        Posts: 5,182
                                        This isn't the ROM Hacking section. We don't use hex editors here.
                                        __________________
                                        Go to the Essentials Docs Wiki

                                        Essentials Docs Wiki

                                        Follow me on Twitter: @maruno42


                                        Reply With Quote
                                          #20    
                                        Old August 8th, 2015 (12:28 PM).
                                        arktyz arktyz is offline
                                           
                                          Join Date: Sep 2013
                                          Posts: 6
                                          i am getting this message for when making a surfboard as an item, i do not know what i am doing wrong i followed everything, can anyone offer help? am i not seeing my mistake?

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

                                          Message: undefined local variable or method `terrain' for nil:NilClass

                                          PokemonHiddenMoves:455:in `canUseMoveSurf?'

                                          PokemonItemEffects:131

                                          PokemonItemEffects:130:in `call'

                                          PBEvent:150:in `trigger'

                                          PokemonItems:165:in `triggerUseFromBag'

                                          PokemonItems:520:in `pbUseItem'

                                          PokemonBag:677:in `pbStartScreen'

                                          PokemonBag:651:in `loop'

                                          PokemonBag:716:in `pbStartScreen'

                                          PokemonPauseMenu:189:in `pbStartPokemonMenu'



                                          This exception was logged in
                                          Reply With Quote
                                            #21    
                                          Old August 9th, 2015 (9:47 AM).
                                          FL's Avatar
                                          FL FL is offline
                                          Pokémon Island Creator
                                             
                                            Join Date: Sep 2010
                                            Gender: Male
                                            Posts: 1,765
                                            Quote:
                                            Originally Posted by arktyz View Post
                                            i am getting this message for when making a surfboard as an item, i do not know what i am doing wrong i followed everything, can anyone offer help? am i not seeing my mistake?

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

                                            Message: undefined local variable or method `terrain' for nil:NilClass

                                            PokemonHiddenMoves:455:in `canUseMoveSurf?'

                                            PokemonItemEffects:131

                                            PokemonItemEffects:130:in `call'

                                            PBEvent:150:in `trigger'

                                            PokemonItems:165:in `triggerUseFromBag'

                                            PokemonItems:520:in `pbUseItem'

                                            PokemonBag:677:in `pbStartScreen'

                                            PokemonBag:651:in `loop'

                                            PokemonBag:716:in `pbStartScreen'

                                            PokemonPauseMenu:189:in `pbStartPokemonMenu'



                                            This exception was logged in
                                            Post your changes.
                                            __________________
                                            Reply With Quote
                                              #22    
                                            Old August 9th, 2015 (10:24 AM). Edited August 10th, 2015 by Maruno.
                                            arktyz arktyz is offline
                                               
                                              Join Date: Sep 2013
                                              Posts: 6
                                              Quote:
                                              Originally Posted by FL View Post
                                              Post your changes.
                                              This is what i edited for the surf in PokemonHiddenMoves

                                              Code:
                                              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?
                                                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("{1} used {2}!",$Trainer.name,PBMoves.getName(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
                                              })

                                              This is in PokemonItemEffects

                                              Code:
                                              ItemHandlers::UseInField.add(:SURFBOARD,proc{|item|
                                                 useMoveSurf if canUseMoveSurf?
                                              })
                                              
                                              ItemHandlers::UseFromBag.add(:SURFBOARD,proc{|item|
                                                 next canUseMoveSurf? ? 2 : 0
                                              })
                                              and this is in my PBS for items

                                              526, SURFBOARD, Surfboard, 8, 0, The perfect board for shredding the gnar.,2,0,6


                                              The error message pops up when i am standing facing water, and go into my bag and click use on the surfboard, any help is appreciated thanks!
                                              Reply With Quote
                                                #23    
                                              Old August 15th, 2015 (3:10 PM).
                                              FL's Avatar
                                              FL FL is offline
                                              Pokémon Island Creator
                                                 
                                                Join Date: Sep 2010
                                                Gender: Male
                                                Posts: 1,765
                                                After line 'def canUseMoveSurf?' you forget to add:

                                                Code:
                                                   terrain=Kernel.pbFacingTerrainTag
                                                   notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
                                                __________________
                                                Reply With Quote
                                                  #24    
                                                Old August 16th, 2015 (8:03 AM).
                                                fabaaun fabaaun is offline
                                                   
                                                  Join Date: Aug 2015
                                                  Gender: Male
                                                  Posts: 12
                                                  Is there any way to, instead of activating the move from an item, activating it from an event?? Like, talking to a rocket and calling the Fly menu, interacting with a ship to start surfing or touching a scuba to dive the sea?

                                                  Also, if you could answer this question I present here http://www.pokecommunity.com/showthread.php?t=353829, that would be most appreciated =P
                                                  Reply With Quote
                                                    #25    
                                                  Old August 16th, 2015 (4:36 PM). Edited August 16th, 2015 by FL.
                                                  FL's Avatar
                                                  FL FL is offline
                                                  Pokémon Island Creator
                                                     
                                                    Join Date: Sep 2010
                                                    Gender: Male
                                                    Posts: 1,765
                                                    Quote:
                                                    Originally Posted by fabaaun View Post
                                                    Is there any way to, instead of activating the move from an item, activating it from an event?? Like, talking to a rocket and calling the Fly menu, interacting with a ship to start surfing or touching a scuba to dive the sea?

                                                    Also, if you could answer this question I present here http://www.pokecommunity.com/showthread.php?t=353829, that would be most appreciated =P
                                                    I guess that you only need to copy the content on 'UseInField' and paste into a script event command.

                                                    I replied at your thread.
                                                    __________________
                                                    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
                                                    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 10:41 AM.