PDA

View Full Version : [Essentials Tutorial] Turn HM moves into items


FL
July 13th, 2013, 1:29 PM
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 'if $DEBUG || movefinder' (there's one for each move) to 'if $DEBUG || $PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)>0'. There's a item example for item.txt PBS:

601,SURFBOARD,Surfboard,Surfboards,8,0,"Insert description here.",0,0,6

Adding the move in the "Use" item command

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'. 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:

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 seventh value to 2.

602,KNIFE,Knife,Knifes,8,0,"Cut down thin trees.",2,0,6

I copied the two HiddenMoveHandlers below (these are in base Essentials):

HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn|
if !$DEBUG &&
!(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
return false
end
facingEvent=$game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="Tree"
Kernel.pbMessage(_INTL("Can't use that here."))
return false
end
return true
})

HiddenMoveHandlers::UseMove.add(:CUT,proc{|move,pokemon|
if !pbHiddenMoveAnimation(nil)
Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Cut"))
end
facingEvent=$game_player.pbFacingEvent
if facingEvent
facingEvent.erase
$PokemonMap.addErasedEvent(facingEvent.id)
end
return true
})

For making the two methods below. I added after the handlers:

def canUseMoveCut?
if !$DEBUG &&
!(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
return false
end
facingEvent=$game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="Tree"
Kernel.pbMessage(_INTL("Can't use that here."))
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
facingEvent.erase
$PokemonMap.addErasedEvent(facingEvent.id)
end
return true
end

And I added at PokemonItemEffects script section:

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

ItemHandlers::UseInField.add(:KNIFE,proc{|item|
useMoveCut if canUseMoveCut?
})

Rayquaza.
December 23rd, 2013, 2:24 AM
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?

p.claydon
December 23rd, 2013, 8:37 AM
thank yu for this its pretty straight forward if you follow the steps

Rayquaza.
December 23rd, 2013, 9:34 AM
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.

p.claydon
December 24th, 2013, 3:47 AM
well bit busy atm (sortting new laptop out) but when able (prob boxing day) i'll see if i can do a better tutorial

Rayquaza.
December 24th, 2013, 5:23 AM
Okay. Does that mean you and FL are the same person or something?

FL
December 26th, 2013, 6:34 AM
Topic updated with an example.

Okay. Does that mean you and FL are the same person or something?Yeah! And in this post (http://www.pokecommunity.com/showpost.php?p=7989315&postcount=35) I'm talking with myself!

Just joking. I'm not p.claydon.

Rayquaza.
December 27th, 2013, 3:51 AM
I'm still having trouble with the script. It keeps coming up with syntax errors and I'm unsure why.

FL
December 28th, 2013, 11:49 AM
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.

mej71
March 23rd, 2014, 12:01 AM
How does one alter this code for moves like Fly or Flash in which the if $DEBUG || movefinder lines do not exist? I am getting syntax errors.

Derxwna Kapsyla
March 24th, 2014, 8:37 PM
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

FL
March 25th, 2014, 10:22 AM
How does one alter this code for moves like Fly or Flash in which the 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.

mej71
March 25th, 2014, 1:48 PM
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.

FL
March 27th, 2014, 12:34 PM
Sorry! Fly is an exception since $PokemonTemp.flydata had some definitions at the summary screen, so the methods should be:

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.

Mugendai
March 27th, 2014, 12:40 PM
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?


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:


---------------------------
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.

mej71
March 27th, 2014, 12:44 PM
Worked. Thank you so much!

Mugendai
March 28th, 2014, 5:27 AM
It worked for me as well, thanks.

C me
November 13th, 2014, 4:55 AM
What does this look like in a hex editor? I dont't understand what to do with these ASM commands.

Maruno
November 13th, 2014, 12:17 PM
This isn't the ROM Hacking section. We don't use hex editors here.

arktyz
August 8th, 2015, 12:28 PM
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

FL
August 9th, 2015, 9:47 AM
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 inPost your changes.

arktyz
August 9th, 2015, 10:24 AM
Post your changes.
This is what i edited for the surf in PokemonHiddenMoves

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

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!

FL
August 15th, 2015, 3:10 PM
After line 'def canUseMoveSurf?' you forget to add:

terrain=Kernel.pbFacingTerrainTag
notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)

fabaaun
August 16th, 2015, 8:03 AM
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

FL
August 16th, 2015, 4:36 PM
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 =PI guess that you only need to copy the content on 'UseInField' and paste into a script event command.

I replied at your thread.

arktyz
August 19th, 2015, 3:26 PM
Thank you for looking through my coding mistake, but that add on seemed to generate another, here is the new problem that occurred:

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

Message: uninitialized constant UseMoveSurf

PokemonItemEffects:978

PokemonItemEffects:977:in `call'

PBEvent:150:in `trigger'

PokemonItems:174:in `triggerUseInField'

PokemonItems:362:in `pbUseKeyItemInField'

PokemonPauseMenu:197:in `pbStartPokemonMenu'

PokemonPauseMenu:142:in `loop'

PokemonPauseMenu:256:in `pbStartPokemonMenu'

Scene_Map:188:in `call_menu'

Scene_Map:159:in `update'



This exception was logged in

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

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


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

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

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

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

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

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

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

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

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

#HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
# terrain=Kernel.pbFacingTerrainTag
# notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
# if !$DEBUG &&
# !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
# Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
# return false
# end
# if $PokemonGlobal.surfing
# Kernel.pbMessage(_INTL("You're already surfing."))
# return false
# end
# if $game_player.pbHasDependentEvents?
# Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
# return false
# end
# if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
# Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
# return false
# end
# if !pbIsWaterTag?(terrain) || !notCliff
# Kernel.pbMessage(_INTL("No surfing here!"))
# return false
# end
# return true
#})

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

FL
August 22nd, 2015, 12:22 PM
Thank you for looking through my coding mistake, but that add on seemed to generate another, here is the new problem that occurred:

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

Message: uninitialized constant UseMoveSurf

PokemonItemEffects:978

PokemonItemEffects:977:in `call'

PBEvent:150:in `trigger'

PokemonItems:174:in `triggerUseInField'

PokemonItems:362:in `pbUseKeyItemInField'

PokemonPauseMenu:197:in `pbStartPokemonMenu'

PokemonPauseMenu:142:in `loop'

PokemonPauseMenu:256:in `pbStartPokemonMenu'

Scene_Map:188:in `call_menu'

Scene_Map:159:in `update'



This exception was logged in

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

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


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

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

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

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

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

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

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

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

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

#HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
# terrain=Kernel.pbFacingTerrainTag
# notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
# if !$DEBUG &&
# !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
# Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
# return false
# end
# if $PokemonGlobal.surfing
# Kernel.pbMessage(_INTL("You're already surfing."))
# return false
# end
# if $game_player.pbHasDependentEvents?
# Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
# return false
# end
# if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
# Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
# return false
# end
# if !pbIsWaterTag?(terrain) || !notCliff
# Kernel.pbMessage(_INTL("No surfing here!"))
# return false
# end
# return true
#})

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

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

Are you sure that you typed 'useMoveSurf' and not 'UseMoveSurf' in both places? Ruby is case sensitive!

fmw
October 3rd, 2015, 5:02 AM
Could you please post the complete script for cut as i do not completely understand where to put it. Thanks!

FL
October 5th, 2015, 4:31 PM
Could you please post the complete script for cut as i do not completely understand where to put it. Thanks!This is already on main thread post, at "example" part.

fmw
October 10th, 2015, 6:07 PM
o I mean like the complete section for cut. Please I'm a terrible script-er! :)

FL
October 11th, 2015, 3:12 AM
o I mean like the complete section for cut. Please I'm a terrible script-er! :)The first code part goes into item.txt, the second goes into PokemonHiddenMoves script section and the last goes into PokemonItemEffects script section. Just copy and paste the code!

dydd90
October 11th, 2015, 4:53 AM
I tried to turn teleport into an item but it is different from others, how can i make it?

FL
October 11th, 2015, 5:13 PM
I tried to turn teleport into an item but it is different from others, how can i make it?The only diference is that the confirmation message show ups twice if you use by item menu. To fix this, change

mapname=pbGetMapNameFromId(healing[0])
if Kernel.pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
return true
end
return false

into 'return true'. And add after 'if healing' (in useMoveTeleport):

mapname=pbGetMapNameFromId(healing[0])
if !Kernel.pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
return false
end

Fazsapphire
March 25th, 2016, 8:19 AM
This works for essentials v16 ? as the scripts are pretty different

FL
April 6th, 2016, 2:13 AM
This works for essentials v16 ? as the scripts are pretty differentI guess so. Some (like Fly) probably need adjustment.

FL
April 10th, 2016, 10:56 AM
I guess so. Some (like Fly) probably need adjustment.After testing, the only adjustment was the plural field when declaring items.

But using Surf from menu won't work in Essentials V16.1, so it won't work here too.

Weedfanatic
April 10th, 2016, 7:54 PM
After testing, the only adjustment was the plural field when declaring items.

But using Surf from menu won't work in Essentials V16.1, so it won't work here too.

Surf will work from the bag. You just need to fix outdated code.
Try out the script below and let me know if it works. It should, it does for me with v16.1


#===============================================================================
# Surf
#===============================================================================
def Kernel.pbSurf
if $game_player.pbHasDependentEvents?
return false
end
if $DEBUG ||
(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
movefinder=Kernel.pbCheckMove(:SURF)
if $DEBUG || $PokemonBag.pbQuantity(PBItems::RAFT)>0
if Kernel.pbConfirmMessage(_INTL("The water is a deep blue, would you like to use the raft?"))
speciesname=!movefinder ? $Trainer.name : movefinder.name
Kernel.pbMessage(_INTL("You started rafting!",speciesname))

surfbgm=pbGetMetadata(0,MetadataSurfBGM)
if surfbgm
pbCueBGM(surfbgm,0.5)
end

pbStartSurfing()
return true
end
end
end
return false
end

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

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

Events.onAction+=proc{|sender,e|
terrain=Kernel.pbFacingTerrainTag
notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
if pbIsWaterTag?(terrain) && !$PokemonGlobal.surfing &&
!pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
Kernel.pbSurf
return
end
}
def canUseMoveSurf?
terrain=Kernel.pbFacingTerrainTag
notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
if !$DEBUG &&
!(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
return false
end
if $PokemonGlobal.surfing
Kernel.pbMessage(_INTL("You're already rafting."))
return false
end
if $game_player.pbHasDependentEvents?
Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
return false
end
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
return false
end
#if !PBTerrain.isSurfable?(terrain) || !notCliff
if !pbIsWaterTag?(terrain) || !notCliff
Kernel.pbMessage(_INTL("No rafting here!"))
return false
end
return true
end

def useMoveSurf
if !pbHiddenMoveAnimation(nil)
Kernel.pbMessage(_INTL("You started rafting!",$Trainer.name,"Surf"))
end
pbStartSurfing()
return true
end

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

Jol the Hedgehog
May 22nd, 2016, 3:12 PM
Can you do a better tutorial? I always get errors.. I'm using essentials 16.1

FL
May 28th, 2016, 8:49 AM
Can you do a better tutorial? I always get errors.. I'm using essentials 16.1I need a better feedback that "do a better tutorial". This isn't an easy modification. You need to know what is a procedure/method start and end. Fortunately, I put an example, so, even if you get confused in some part, you can look in this example.

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

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

EDIT: I detailed the example a little more.

Vernerl
May 31st, 2016, 3:33 AM
Hi I'm getting this error:

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

Here are the things i changed:

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

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

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

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

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

#HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
# terrain=Kernel.pbFacingTerrainTag
# notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
# if !$DEBUG &&
# !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
# Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
# return false
# end
# if $PokemonGlobal.surfing
# Kernel.pbMessage(_INTL("You're already surfing."))
# return false
# end
# if $game_player.pbHasDependentEvents?
# Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
# return false
# end
# if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
# Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
# return false
# end
# if !PBTerrain.isSurfable?(terrain) || !notCliff
# Kernel.pbMessage(_INTL("No surfing here!"))
# return false
# end
# return true
#})

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



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

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

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

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

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

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


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

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

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

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

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

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

FL
June 4th, 2016, 4:44 PM
Hi I'm getting this error:

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

Here are the things i changed:

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

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

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

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

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

#HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
# terrain=Kernel.pbFacingTerrainTag
# notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
# if !$DEBUG &&
# !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
# Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
# return false
# end
# if $PokemonGlobal.surfing
# Kernel.pbMessage(_INTL("You're already surfing."))
# return false
# end
# if $game_player.pbHasDependentEvents?
# Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
# return false
# end
# if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
# Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
# return false
# end
# if !PBTerrain.isSurfable?(terrain) || !notCliff
# Kernel.pbMessage(_INTL("No surfing here!"))
# return false
# end
# return true
#})

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



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

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

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

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

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

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


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

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

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

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

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

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

And please, in the next time, put your code between code tags. I needed a software for auto-indent your code.

Vernerl
June 5th, 2016, 12:39 AM
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
June 5th, 2016, 6:11 AM
(With regards to the code tags.) I know I should've done that, but I don't know how...

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

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

Sorry for the wrong tip. Return line 506. The error root is a missing ')'. Change '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0' into '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0)'.

Vernerl
June 5th, 2016, 7:56 AM
Use "code" tag instead of "spoiler" tag:

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

Sorry for the wrong tip. Return line 506. The error root is a missing ')'. Change '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0' into '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0)'.
Actually... You're wrong.
My code said: '($PokemonBag.pbQuantity(PBItems::SURFBOARD)>0' so i changed it to: '($PokemonBag.pbQuantity(PBItems::SURFBOARD))>0' and now there are no errors. (I applied this fix to Waterfall and Dive aswell.)

Vernerl
June 14th, 2016, 4:35 AM
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:
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
June 17th, 2016, 2:48 AM
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:
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?

Vernerl
June 17th, 2016, 10:54 PM
Do you have the badge for Rock Smash AND HM07?

I turned that requirement off.

FL
June 19th, 2016, 4:10 PM
I turned that requirement off.So, you remove this code part and the item worked?

Vernerl
June 19th, 2016, 11:20 PM
So, you remove this code part and the item worked?
Nope. I turned it off in the settings beforehand. It still doesn't work.

Zeak6464
June 20th, 2016, 2:03 PM
This is 100% Working on version 15+

Item Effect

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

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


Hidden Moves

#===============================================================================
# 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
})

Vernerl
June 20th, 2016, 11:17 PM
This is 100% Working on version 15+

Item Effect

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

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


Hidden Moves

#===============================================================================
# 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
June 25th, 2016, 2:46 PM
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 .

Vernerl
June 26th, 2016, 1:25 AM
Well it's not working here, so...

Zeak6464
June 26th, 2016, 7:15 AM
Well it's not working here, so...
you forgot to "def canUseMoveRocksmash?" & "def canUseMoveRocksmash"

Vernerl
June 29th, 2016, 10:41 PM
you forgot to "def canUseMoveRocksmash?" & "def canUseMoveRocksmash"

What? Where?

max93
July 21st, 2016, 10:56 PM
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 ç_ç

Rot8er_ConeX
July 25th, 2016, 7:23 PM
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 ç_ç

As far as I'm aware this adds the item functionality rather than replacing the moves with the items.

FL
July 26th, 2016, 7:16 AM
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'.