• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Essentials Tutorial] Turn HM moves into items

1,403
Posts
10
Years
    • Seen Apr 29, 2024
    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.
     
    Last edited:
    • Like
    Reactions: FL
    5
    Posts
    6
    Years
    • UK
    • Seen Mar 9, 2024
    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
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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.
     
    1
    Posts
    6
    Years
    • Seen Mar 21, 2018
    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.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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.
    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.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Tutorial updated and tested for Essentials v17.2.
     
    Last edited:
    2
    Posts
    6
    Years
    • Seen Feb 26, 2021
    Hey thanks so much for all your guides and tutorials! They've been super helpful.

    I can't seem to get my HM Item Strength to work however.
    I can interact with the builders fine and the game recognizes the HM item I think, but when I activate the item, I just can't move the boulder. The boulder won't budge.

    This is my Strength script... sorry for messy format!

    def Kernel.pbStrength
    if $DEBUG ||
    (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
    movefinder=Kernel.pbCheckMove(:STRENGTH)
    movefinder=nil
    if $DEBUG || $PokemonBag.pbQuantity(PBItems::EXO)>0
    if Kernel.pbConfirmMessage(_INTL("Would you like to equip the Exoskeleton and move the boulder?"))
    speciesname=!movefinder ? $Trainer.name : movefinder.name
    Kernel.pbMessage(_INTL("{1} equipped the Exoskeleton!",$Trainer.name))
    pbHiddenMoveAnimation(movefinder)
    return true
    end
    else
    Kernel.pbMessage(_INTL("It's a big boulder, but theoretically it should be movable."))
    end
    else
    Kernel.pbMessage(_INTL("It's a big boulder, but theoretically it should be movable."))
    end
    return false
    end

    Events.onAction+=proc{|sender,e|
    facingEvent=$game_player.pbFacingEvent
    if facingEvent
    if facingEvent.name=="Boulder"
    Kernel.pbStrength
    return
    end
    end
    }

    #HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc{|move,pkmn,showmsg|
    # return false if !pbCheckHiddenMoveBadge(BADGEFORSTRENGTH,showmsg)
    # if $PokemonMap.strengthUsed
    # Kernel.pbMessage(_INTL("Exoskeleton is already being used.")) if showmsg
    # return false
    # end
    # return true
    #})

    #HiddenMoveHandlers::UseMove.add(:STRENGTH,proc{|move,pokemon|
    # if !pbHiddenMoveAnimation(pokemon)
    # Kernel.pbMessage(_INTL("{1} used the Exoskeleton!",$Trainer.name))
    # end
    # Kernel.pbMessage(_INTL("{1}'s Exoskeleton made it possible to move boulders around!",$Trainer.name))
    # $PokemonMap.strengthUsed = true
    # return true
    #})

    def canUseStrength?
    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!="Boulder"
    Kernel.pbMessage(_INTL("Can't use that here."))
    return false
    end
    return true
    end

    def useStrength
    if !pbHiddenMoveAnimation(nil)
    Kernel.pbMessage(_INTL("{1} used the Exoskeleton!",$Trainer.name))
    end
    facingEvent=$game_player.pbFacingEvent
    if facingEvent
    facingEvent.erase
    $PokemonMap.addErasedEvent(facingEvent.id)
    end
    return true
    end
     
    Last edited:

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Hey thanks so much for all your guides and tutorials! They've been super helpful.

    I can't seem to get my HM Item Strength to work however.
    I can interact with the builders fine and the game recognizes the HM item I think, but when I activate the item, I just can't move the boulder. The boulder won't budge.

    This is my Strength script... sorry for messy format!

    def Kernel.pbStrength
    if $DEBUG ||
    (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
    movefinder=Kernel.pbCheckMove(:STRENGTH)
    movefinder=nil
    if $DEBUG || $PokemonBag.pbQuantity(PBItems::EXO)>0
    if Kernel.pbConfirmMessage(_INTL("Would you like to equip the Exoskeleton and move the boulder?"))
    speciesname=!movefinder ? $Trainer.name : movefinder.name
    Kernel.pbMessage(_INTL("{1} equipped the Exoskeleton!",$Trainer.name))
    pbHiddenMoveAnimation(movefinder)
    return true
    end
    else
    Kernel.pbMessage(_INTL("It's a big boulder, but theoretically it should be movable."))
    end
    else
    Kernel.pbMessage(_INTL("It's a big boulder, but theoretically it should be movable."))
    end
    return false
    end

    Events.onAction+=proc{|sender,e|
    facingEvent=$game_player.pbFacingEvent
    if facingEvent
    if facingEvent.name=="Boulder"
    Kernel.pbStrength
    return
    end
    end
    }

    #HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc{|move,pkmn,showmsg|
    # return false if !pbCheckHiddenMoveBadge(BADGEFORSTRENGTH,showmsg)
    # if $PokemonMap.strengthUsed
    # Kernel.pbMessage(_INTL("Exoskeleton is already being used.")) if showmsg
    # return false
    # end
    # return true
    #})

    #HiddenMoveHandlers::UseMove.add(:STRENGTH,proc{|move,pokemon|
    # if !pbHiddenMoveAnimation(pokemon)
    # Kernel.pbMessage(_INTL("{1} used the Exoskeleton!",$Trainer.name))
    # end
    # Kernel.pbMessage(_INTL("{1}'s Exoskeleton made it possible to move boulders around!",$Trainer.name))
    # $PokemonMap.strengthUsed = true
    # return true
    #})

    def canUseStrength?
    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!="Boulder"
    Kernel.pbMessage(_INTL("Can't use that here."))
    return false
    end
    return true
    end

    def useStrength
    if !pbHiddenMoveAnimation(nil)
    Kernel.pbMessage(_INTL("{1} used the Exoskeleton!",$Trainer.name))
    end
    facingEvent=$game_player.pbFacingEvent
    if facingEvent
    facingEvent.erase
    $PokemonMap.addErasedEvent(facingEvent.id)
    end
    return true
    end
    Your code is a bit outdate. Here's mine:

    Code:
    def Kernel.pbStrength
      if $PokemonMap.strengthUsed
        Kernel.pbMessage(_INTL("Exoskeleton made it possible to move boulders around."))
        return false
      end
      move = getID(PBMoves,:STRENGTH)
      movefinder = Kernel.pbCheckMove(move)
        if !pbCheckHiddenMoveBadge(BADGEFORSTRENGTH,false) ||
          (!$DEBUG || $PokemonBag.pbQuantity(PBItems::EXO)>0)
        Kernel.pbMessage(_INTL("It's a big boulder, but theoretically it should be movable."))
        return false
      end
      Kernel.pbMessage(_INTL("It's a big boulder, but theoretically it should be movable.\1"))
      if Kernel.pbConfirmMessage(_INTL("Would you like to equip the Exoskeleton and move the boulder?"))
        movefinder = nil
        speciesname = (movefinder) ? movefinder.name : $Trainer.name
        Kernel.pbMessage(_INTL("{1} equipped the Exoskeleton!",$Trainer.name))
        pbHiddenMoveAnimation(movefinder)
        $PokemonMap.strengthUsed = true
        return true
      end
      return false
    end
    
    def useStrength
       if !pbHiddenMoveAnimation(nil)
         Kernel.pbMessage(_INTL("{1} used the Exoskeleton!",$Trainer.name))
       end
       $PokemonMap.strengthUsed = true
       return true
    end
    
    def canUseStrength?
       showmsg = false
       return false if !pbCheckHiddenMoveBadge(BADGEFORSTRENGTH,showmsg)
       if $PokemonMap.strengthUsed
         Kernel.pbMessage(_INTL("Exoskeleton is already being equipped.")) if showmsg
         return false
       end
       return true
    end

    I guess that '$PokemonMap.strengthUsed = true' made the difference.
     
    Last edited:
    2
    Posts
    6
    Years
    • Seen Feb 26, 2021
    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!
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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
     
    2
    Posts
    4
    Years
    • Seen Jun 25, 2020
    Hi, I'm starting to create a PKM game and I have some questions about objects and HM:
    -I'm creating a key object that resembles a swiss knife and can do Cut, Rock Smash, Headbutt, Flash and Strengh.
    Code:
    650,NAVALLA,Navalla,Navalles,8,0,"Una navalla suïssa que et permet eliminar obstacles.",2,0,6,
    -You get it at the start of the game with only Cut and RockSmash available. It upgrades as you find NPCs. Because you get it at the start of the game, I changed in Settings:
    Code:
    HIDDENMOVESCOUNTBADGES = false
    BADGEFORCUT            = 0
    BADGEFORFLASH          = 0
    BADGEFORROCKSMASH      = 0
    BADGEFORSURF           = 0
    BADGEFORFLY            = 0
    BADGEFORSTRENGTH       = 0
    BADGEFORDIVE           = 0
    BADGEFORWATERFALL      = 0
    But with that, right now I can execute all the HM without restriction. What line I have to change so the interaction will only happen if you have the specific object?
    If I want to create an item that upgrades, should I define different items and just change that every time the item "upgrades"?
    Also:

    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

    I don't understand what I have to do on this sentence :S

    Thx!
     

    #Not Important

    All hail the wishmaker
    910
    Posts
    4
    Years
  • I dont want to make you guys feel like u wasted your time...
    But Marin made a perfectly functioning script called HMItems that can be added using Luka S.J.'s EPI...
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    For activating the HM without the use command using the same item, just follow the tutorial and use the same item on both places.

    For having the badge requiremente, don't follow this step:
    Mark HIDDENMOVESCOUNTBADGES as true and all badges to 0 to remove the badge requirements.

    For adding on "use" effect, follow this model for Headbutt (untested).

    Code:
    ItemHandlers::UseFromBag.add(:YOURITEMINTERNALNAME,proc{|item|
       next canUseMoveRockSmash? || canUseMoveCut? || canUseMoveStrength? ? 2 : 0
    })
    
    ItemHandlers::UseInField.add(:YOURITEMINTERNALNAME,proc{|item|
       if canUseMoveRockSmash?
    	useMoveRockSmash
       elsif canUseMoveCut?
    	useMoveCut
       elsif canUseMoveStrength?
    	useMoveStrenght
    # ...
       end
    
    })
    Anyway, since you gonna add Flash, I suggest you to only maintain Flash "Use" effect.

    I don't understand what I have to do on this sentence

    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
    })
    Here is the HiddenMoveHandlers::CanUseMove for Cut. You need to comment all this code.

    I dont want to make you guys feel like u wasted your time...
    But Marin made a perfectly functioning script called HMItems that can be added using Luka S.J.'s EPI...
    Thanks for the tip!

    Anyway, this tutorial was made years before Marin joined on this forum.
     
    Back
    Top