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

Scripts, Tutorials & Tools 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
  #76    
Old March 30th, 2017 (10:09 AM).
Mashirosakura's Avatar
Mashirosakura Mashirosakura is offline
     
    Join Date: Jan 2017
    Gender: Male
    Posts: 104
    Quote:
    Originally Posted by M3rein View Post
    Look at the error. Please. "isSurfableTag?".
    Hasn't fixed anything, sadly. I put it where the error was but there's still an issue.
    Reply With Quote
      #77    
    Old March 31st, 2017 (6:55 AM).
    FL's Avatar
    FL FL is offline
    Pokémon Island Creator
       
      Join Date: Sep 2010
      Gender: Male
      Posts: 1,770
      Quote:
      Originally Posted by Mashirosakura View Post
      It fixed the initial activating surf animation issue. Now a new one has started, when I move in any direction in the water afterwards. I'll put an image below.
      I tested my tutorial again on V 16.2, even on bridges. The working code:

      Code:
      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
        terrain=Kernel.pbFacingTerrainTag
        notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
        if !PBTerrain.isSurfable?(terrain) || !notCliff
          Kernel.pbMessage(_INTL("No surfing here!"))
          return false
        end
        return true
      end
       
      def useMoveSurf
        $game_temp.in_menu=false
        if !pbHiddenMoveAnimation(nil)
          Kernel.pbMessage(_INTL("{1} used Surfboard!",$Trainer.name))
        end
        surfbgm=pbGetMetadata(0,MetadataSurfBGM)
        pbCueBGM(surfbgm,0.5) if surfbgm
        pbStartSurfing()
        return true
      end
      __________________
      Reply With Quote
        #78    
      Old April 1st, 2017 (2:48 AM).
      Mashirosakura's Avatar
      Mashirosakura Mashirosakura is offline
         
        Join Date: Jan 2017
        Gender: Male
        Posts: 104
        Quote:
        Originally Posted by FL View Post
        I tested my tutorial again on V 16.2, even on bridges. The working code:

        Code:
        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
          terrain=Kernel.pbFacingTerrainTag
          notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
          if !PBTerrain.isSurfable?(terrain) || !notCliff
            Kernel.pbMessage(_INTL("No surfing here!"))
            return false
          end
          return true
        end
         
        def useMoveSurf
          $game_temp.in_menu=false
          if !pbHiddenMoveAnimation(nil)
            Kernel.pbMessage(_INTL("{1} used Surfboard!",$Trainer.name))
          end
          surfbgm=pbGetMetadata(0,MetadataSurfBGM)
          pbCueBGM(surfbgm,0.5) if surfbgm
          pbStartSurfing()
          return true
        end
        It must be something on my end then, because I'm still getting the error with PBEndSurf
        Reply With Quote
          #79    
        Old January 30th, 2018 (7:07 AM).
        MissKanabellle MissKanabellle is offline
           
          Join Date: Jan 2018
          Posts: 2
          Hi, could I get a little help with my surf code? I am trying to replace the HM with a surfboard item which works up until I try to actually surf then it throws out this error:

          [Pokémon Essentials version 17.2]

          Exception: NoMethodError

          Message: undefined method `hp' for nil:NilClass

          Following Pokemon:419:in `check_surf'

          Following Pokemon:880:in `pbSurf'

          PField_FieldMoves:847

          PField_FieldMoves:842:in `call'

          EventHandlers:54:in `trigger'

          EventHandlers:49:in `each'

          EventHandlers:49:in `trigger'

          Scene_Map:223:in `follow_update'

          Following Pokemon:1551:in `update'

          Scene_Map:234:in `main'

          This is my code so far:

          Code:
          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 PBTerrain.isSurfable?(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
            terrain=Kernel.pbFacingTerrainTag
            notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
            if !PBTerrain.isSurfable?(terrain) || !notCliff
              Kernel.pbMessage(_INTL("No surfing here!"))
              return false
            end
            return true
          end
           
          def useMoveSurf
            $game_temp.in_menu=false
            if !pbHiddenMoveAnimation(nil)
              Kernel.pbMessage(_INTL("{1} used Surfboard!",$Trainer.name))
            end
            surfbgm=pbGetMetadata(0,MetadataSurfBGM)
            pbCueBGM(surfbgm,0.5) if surfbgm
            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
          })
          And this is what I have for the effects
          Code:
          ItemHandlers::UseFromBag.add(:SURFBOARD,proc{|item|
             next canUseMoveSurf? ? 2 : 0
          })
          
          ItemHandlers::UseInField.add(:SURFBOARD,proc{|item|
             useMoveSurf if canUseMoveSurf?
          })
          I have it defined in the items like this:
          527,SURFBOARD,Surfboard,Surfboards,8,0,"This Surfboard is used to travel across the water.",2,0,6
          Reply With Quote
            #80    
          Old January 30th, 2018 (12:32 PM). Edited January 30th, 2018 by mgriffin.
          mgriffin's Avatar
          mgriffin mgriffin is offline
             
            Join Date: Apr 2014
            Posts: 157
            Quote:
            Originally Posted by MissKanabellle View Post
            Message: undefined method `hp' for nil:NilClass
            Following Pokemon:419:in `check_surf'
            Following Pokemon:880:in `pbSurf'
            I think all the stuff you've written so far is fine, but you need to additionally make some changes in the following pokemon script that you've added to support surf (because it overwrites the core Essentials surfing code with its own code).

            If you understand the changes that you made elsewhere you should be able to work out how to make similar changes in Following Pokemon (probably around line 880 or 419 as those are the lines mentioned in your error).

            EDIT: I did something similar a while back, see this pastebin, specifically the part after "@@ -122154,23 +122323,30 @@ # Follow_Pokemon.rb", red is removed, green is added. Keep in mind that my item was called FLOATY and I wanted to keep the HM moves functional.
            Reply With Quote
              #81    
            Old January 30th, 2018 (1:41 PM).
            MissKanabellle MissKanabellle is offline
               
              Join Date: Jan 2018
              Posts: 2
              AH! Thank you, I didn't even think about updating the Follow Pokemon code. It's working now :)
              Reply With Quote
                #82    
              Old March 15th, 2018 (10:36 AM).
              TheTangentYeti's Avatar
              TheTangentYeti TheTangentYeti is offline
                 
                Join Date: Mar 2018
                Location: UK
                Gender: Male
                Nature: Relaxed
                Posts: 5
                FL do you think you could make a tutorial for essentials v17 as the structure of the code is a bit different and its quite confusing to me and im guessing thats the same for others as well
                Reply With Quote
                  #83    
                Old March 16th, 2018 (3:41 AM).
                FL's Avatar
                FL FL is offline
                Pokémon Island Creator
                   
                  Join Date: Sep 2010
                  Gender: Male
                  Posts: 1,770
                  Quote:
                  Originally Posted by TheTangentYeti View Post
                  FL do you think you could make a tutorial for essentials v17 as the structure of the code is a bit different and its quite confusing to me and im guessing thats the same for others as well
                  According to MissKanabellle and mgriffin, the tutorial is working for v17.2.
                  __________________
                  Reply With Quote
                    #84    
                  Old March 16th, 2018 (12:47 PM).
                  TheTangentYeti's Avatar
                  TheTangentYeti TheTangentYeti is offline
                     
                    Join Date: Mar 2018
                    Location: UK
                    Gender: Male
                    Nature: Relaxed
                    Posts: 5
                    okay thanks
                    Reply With Quote
                      #85    
                    Old March 18th, 2018 (1:14 AM).
                    Serpico Serpico is offline
                       
                      Join Date: Mar 2018
                      Posts: 1
                      Hello. I have the Same Problem as @TheTangentYeti.
                      Since the Structure of the Code changed in 17.2 I have no Idea what to change so I can make an Item out of a HM.
                      Yes, the Code might still work with 17.2 but the Thing is, that @MissKanabelle used it with SURF. I need it for CUT. Both codes look very different to me. Another thing is that I am very new to RPGMaker and Pokémon essentials and I learned that I should not edit the code, if I do not fully understand what it does.
                      I think what would help me as a completly noob besides Video tutorials, is if someone could tell me exactly what lines I have to change to what. For example: The Code of CUT starts at line 192 and ends with
                      247.So If someone could for example say: Change Line 209
                      Code:
                      HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn,showmsg|
                      to
                      Code:
                      HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|CHANGE,FOR,EXAMPLE|
                      I could better understand what happend and what was changed. Or post an example code of the code I need so I can check what was changed and where. That would be a great help.
                      Reply With Quote
                        #86    
                      Old March 22nd, 2018 (3:52 AM).
                      FL's Avatar
                      FL FL is offline
                      Pokémon Island Creator
                         
                        Join Date: Sep 2010
                        Gender: Male
                        Posts: 1,770
                        Quote:
                        Originally Posted by Serpico View Post
                        Hello. I have the Same Problem as @TheTangentYeti.
                        Since the Structure of the Code changed in 17.2 I have no Idea what to change so I can make an Item out of a HM.
                        Yes, the Code might still work with 17.2 but the Thing is, that @MissKanabelle used it with SURF. I need it for CUT. Both codes look very different to me. Another thing is that I am very new to RPGMaker and Pokémon essentials and I learned that I should not edit the code, if I do not fully understand what it does.
                        I think what would help me as a completly noob besides Video tutorials, is if someone could tell me exactly what lines I have to change to what. For example: The Code of CUT starts at line 192 and ends with
                        247.So If someone could for example say: Change Line 209
                        Code:
                        HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn,showmsg|
                        to
                        Code:
                        HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|CHANGE,FOR,EXAMPLE|
                        I could better understand what happend and what was changed. Or post an example code of the code I need so I can check what was changed and where. That would be a great help.
                        Quote:
                        I learned that I should not edit the code
                        At least while you don't have a good experience with scripts.

                        A step by step is a little harder, since changing the HMs into items requires a minimal script knowledge. I can post an example, like I did with Cut, but this should change a little with moves like Fly. Anyway, I gonna test again the process with Cut on version 17.2 and update the scripts.
                        __________________
                        Reply With Quote
                          #87    
                        Old May 12th, 2018 (5:03 AM).
                        FL's Avatar
                        FL FL is offline
                        Pokémon Island Creator
                           
                          Join Date: Sep 2010
                          Gender: Male
                          Posts: 1,770
                          Quote:
                          Originally Posted by huggintrees View Post
                          Yo FL! It worked like a charm haha thanks a bunch. It's been really cool to try and make my own Pokemon game, and it's a lot due to you haha!

                          Sorry if I'm asking too much, but do you mind sharing your Fly or Waterfall scripts? Haha thanks again!
                          Waterfall I guess that you only need to follow the tutorial. Fly I know that it is a different case. So, the code is:

                          Code:
                          def canUseFly
                              showmsg = true
                             return false if !pbCheckHiddenMoveBadge(BADGEFORFLY,showmsg)
                             if $game_player.pbHasDependentEvents?
                               Kernel.pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
                               return false
                             end
                             if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
                               Kernel.pbMessage(_INTL("Can't use that here.")) if showmsg
                               return false
                             end
                             return true
                          end
                          
                          def useFly
                             scene = PokemonRegionMap_Scene.new(-1,false)
                             screen = PokemonRegionMapScreen.new(scene)
                             $PokemonTemp.flydata = screen.pbStartFlyScreen
                             if !$PokemonTemp.flydata
                               Kernel.pbMessage(_INTL("Can't use that here."))
                               return false
                             end
                             if !pbHiddenMoveAnimation(nil)
                               Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Jetpack"))
                             end
                             pbFadeOutIn(99999){
                                $game_temp.player_new_map_id    = $PokemonTemp.flydata[0]
                                $game_temp.player_new_x         = $PokemonTemp.flydata[1]
                                $game_temp.player_new_y         = $PokemonTemp.flydata[2]
                                $game_temp.player_new_direction = 2
                                Kernel.pbCancelVehicles
                                $PokemonTemp.flydata = nil
                                $scene.transfer_player
                                $game_map.autoplay
                                $game_map.refresh
                             }
                             pbEraseEscapePoint
                             return true
                          end
                          __________________
                          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 7:53 PM.