• 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

FL

Pokémon Island Creator
2,443
Posts
13
Years
  • Seen Apr 16, 2024
Hi I'm getting this error:

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

Here are the things i changed:

Surf.
Spoiler:


Waterfall.
Spoiler:


Dive.
Spoiler:
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.
 
19
Posts
7
Years
  • Age 28
  • Seen Aug 10, 2020
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.
 

FL

Pokémon Island Creator
2,443
Posts
13
Years
  • Seen Apr 16, 2024
(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[/[b]*[/b]code] . Without the [b]*[/b].

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)'.
 
19
Posts
7
Years
  • Age 28
  • Seen Aug 10, 2020
Use "code" tag instead of "spoiler" tag:

Code:
Your code goes here[/[b]*[/b]code] . Without the [b]*[/b].

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)'.[/QUOTE]
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.)
 
19
Posts
7
Years
  • Age 28
  • Seen Aug 10, 2020
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  
})
 

FL

Pokémon Island Creator
2,443
Posts
13
Years
  • Seen Apr 16, 2024
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?
 

Zeak6464

Zeak #3205 - Discord
1,101
Posts
11
Years
  • Age 31
  • USA
  • Seen Oct 9, 2023
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
})
 
Last edited:
19
Posts
7
Years
  • Age 28
  • Seen Aug 10, 2020
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
})
But the problem isn't surf, it's Rock Smash.
 

FL

Pokémon Island Creator
2,443
Posts
13
Years
  • Seen Apr 16, 2024
Nope. I turned it off in the settings beforehand. It still doesn't work.
I tested your code right now and it is working. Make sure that you have HM07 in bag and, in settings, HIDDENMOVESCOUNTBADGES = true and BADGEFORROCKSMASH=0 .
 
23
Posts
8
Years
  • Age 30
  • Seen Nov 24, 2016
hi to all, in my game i would made this item, but i want that moves continuing to have their effect, can i do this? and how? thanks ç_ç
 

FL

Pokémon Island Creator
2,443
Posts
13
Years
  • Seen Apr 16, 2024
hi to all, in my game i would made this item, but i want that moves continuing to have their effect, can i do this? and how? thanks ç_ç
Don't comment the 'HiddenMoveHandlers::CanUseMove' proc. Instead of changing the line 'if $DEBUG || movefinder' to 'if $DEBUG || $PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)>0', change it into 'if $DEBUG || movefinder || $PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)>0'.
 
195
Posts
7
Years
  • Age 27
  • Seen Apr 12, 2024
Ok so I have this for Flash and it gives me a syntax error. Can someone explain what the problem is?
Code:
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc{|move,pkmn|
def canUseFlash?
   if !$DEBUG &&
      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLASH : $Trainer.badges[BADGEFORSLASH])
     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
     return false
   end
   if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
     Kernel.pbMessage(_INTL("Can't use that here."))
     return false
   end
   if $PokemonGlobal.flashUsed
     Kernel.pbMessage(_INTL("This is in use already."))
     return false
   return true
end

HiddenMoveHandlers::UseMove.add(:FLASH,proc{|move,pokemon|
def canUseFlash
   darkness=$PokemonTemp.darknessSprite
   return false if !darkness || darkness.disposed?
   if !pbHiddenMoveAnimation(nil)
     Kernel.pbMessage(_INTL("{1} used the Torch!",$Trainer.name))
   end
   $PokemonGlobal.flashUsed=true
   while darkness.radius<176
     Graphics.update
     Input.update
     pbUpdateSceneMap
     darkness.radius+=4
   end
   return true
end
Code:
ItemHandlers::UseFromBag.add(:TORCH,proc{|item| next canUseFlash? ? 2:0 })

ItemHandlers::UseInField.add(:TORCH,proc{|item| canUseFlash if canUseFlash? })
 

FL

Pokémon Island Creator
2,443
Posts
13
Years
  • Seen Apr 16, 2024
Ok so I have this for Flash and it gives me a syntax error. Can someone explain what the problem is?
Code:
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc{|move,pkmn|
def canUseFlash?
   if !$DEBUG &&
      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLASH : $Trainer.badges[BADGEFORSLASH])
     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
     return false
   end
   if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
     Kernel.pbMessage(_INTL("Can't use that here."))
     return false
   end
   if $PokemonGlobal.flashUsed
     Kernel.pbMessage(_INTL("This is in use already."))
     return false
   return true
end

HiddenMoveHandlers::UseMove.add(:FLASH,proc{|move,pokemon|
def canUseFlash
   darkness=$PokemonTemp.darknessSprite
   return false if !darkness || darkness.disposed?
   if !pbHiddenMoveAnimation(nil)
     Kernel.pbMessage(_INTL("{1} used the Torch!",$Trainer.name))
   end
   $PokemonGlobal.flashUsed=true
   while darkness.radius<176
     Graphics.update
     Input.update
     pbUpdateSceneMap
     darkness.radius+=4
   end
   return true
end
Code:
ItemHandlers::UseFromBag.add(:TORCH,proc{|item| next canUseFlash? ? 2:0 })

ItemHandlers::UseInField.add(:TORCH,proc{|item| canUseFlash if canUseFlash? })

Instead of

Code:
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc{|move,pkmn|
def canUseFlash?
   if !$DEBUG &&
      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLASH : $Trainer.badges[BADGEFORSLASH])
     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
     return false
   end
   if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
     Kernel.pbMessage(_INTL("Can't use that here."))
     return false
   end
   if $PokemonGlobal.flashUsed
     Kernel.pbMessage(_INTL("This is in use already."))
     return false
   return true
end

try

Code:
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc{|move,pkmn|
   if !$DEBUG &&
      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLASH : $Trainer.badges[BADGEFORSLASH])
     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
     return false
   end
   if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
     Kernel.pbMessage(_INTL("Can't use that here."))
     return false
   end
   if $PokemonGlobal.flashUsed
     Kernel.pbMessage(_INTL("This is in use already."))
     return false
   return true
})

Like the examples.
 
Back
Top