FL
Pokémon Island Creator
- 2,545
- Posts
- 14
- Years
- Seen today
In this tutorial I explain how to turn HMs and/or other moves that work outside of battle to items.
First, in PokemonHiddenMoves script section comment the 'HiddenMoveHandlers::CanUseMove' proc (all the code, inclusive the '})'). Change the line '(!$DEBUG && !movefinder)' (there's one for each move that can be used outside menu) to '(!$DEBUG && $PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)==0)'. Before line 'speciesname = (movefinder) ? movefinder.name : $Trainer.name', add line 'movefinder=nil' for won't show pokémon name and animation. There's a item example for item.txt PBS:
Adding the move in the "Use" item command
At this point, the item is already working except the "Use" command. This command is almost unnecessary for some moves like Cut and Surf, but is vital for others like Fly and Flash.
In item PBS data change the '0,0,6' to '2,0,6'. Copy the content of 'HiddenMoveHandlers::CanUseMove' proc (the code between the first line and the '})') and put between a method who start in the first line like 'def canUseMoveSurf?' and ends with 'end'. After method first line (the one who starts with "def"), add line 'showmsg = true'. Do the same with 'HiddenMoveHandlers::UseMove' and name the method something like 'def useMoveSurf'. For this last one remember to change pokemon.name to $Trainer.name, pbHiddenMoveAnimation(pokemon) to pbHiddenMoveAnimation(nil) and PBMoves.getName(move) to the move name (e. g. "Surf"). In PokemonItemEffects script section, add the two item handlers:
I suggest to change the text like "used Surf" to "used Surfboard". Mark HIDDENMOVESCOUNTBADGES as true and all badges to 0 to remove the badge requirements.
Example
I will made an example of the adding in the "use" item command using a knife item for Cut. First, I changed the eighth value to 2.
I copied the two HiddenMoveHandlers below (these are in base Essentials):
For making the two methods below. I added after the handlers:
And I added at PokemonItemEffects script section:
First, in PokemonHiddenMoves script section comment the 'HiddenMoveHandlers::CanUseMove' proc (all the code, inclusive the '})'). Change the line '(!$DEBUG && !movefinder)' (there's one for each move that can be used outside menu) to '(!$DEBUG && $PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)==0)'. Before line 'speciesname = (movefinder) ? movefinder.name : $Trainer.name', add line 'movefinder=nil' for won't show pokémon name and animation. There's a item example for item.txt PBS:
Code:
601,SURFBOARD,Surfboard,Surfboards,8,0,"Insert description here.",0,0,6
Adding the move in the "Use" item command
At this point, the item is already working except the "Use" command. This command is almost unnecessary for some moves like Cut and Surf, but is vital for others like Fly and Flash.
In item PBS data change the '0,0,6' to '2,0,6'. Copy the content of 'HiddenMoveHandlers::CanUseMove' proc (the code between the first line and the '})') and put between a method who start in the first line like 'def canUseMoveSurf?' and ends with 'end'. After method first line (the one who starts with "def"), add line 'showmsg = true'. Do the same with 'HiddenMoveHandlers::UseMove' and name the method something like 'def useMoveSurf'. For this last one remember to change pokemon.name to $Trainer.name, pbHiddenMoveAnimation(pokemon) to pbHiddenMoveAnimation(nil) and PBMoves.getName(move) to the move name (e. g. "Surf"). In PokemonItemEffects script section, add the two item handlers:
Code:
ItemHandlers::UseFromBag.add(:YOURITEMINTERNALNAME,proc{|item|
next canUseMoveSurf? ? 2 : 0
})
ItemHandlers::UseInField.add(:YOURITEMINTERNALNAME,proc{|item|
useMoveSurf if canUseMoveSurf?
})
I suggest to change the text like "used Surf" to "used Surfboard". Mark HIDDENMOVESCOUNTBADGES as true and all badges to 0 to remove the badge requirements.
Example
I will made an example of the adding in the "use" item command using a knife item for Cut. First, I changed the eighth value to 2.
Code:
602,KNIFE,Knife,Knifes,8,0,"Cut down thin trees.",2,0,6
I copied the two HiddenMoveHandlers below (these are in base Essentials):
Code:
HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn,showmsg|
return false if !pbCheckHiddenMoveBadge(BADGEFORCUT,showmsg)
facingEvent = $game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="Tree"
Kernel.pbMessage(_INTL("Can't use that here.")) if showmsg
return false
end
return true
})
HiddenMoveHandlers::UseMove.add(:CUT,proc{|move,pokemon|
if !pbHiddenMoveAnimation(pokemon)
Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
end
facingEvent = $game_player.pbFacingEvent
if facingEvent
pbSmashEvent(facingEvent)
end
return true
})
For making the two methods below. I added after the handlers:
Code:
def canUseMoveCut?
showmsg = true
return false if !pbCheckHiddenMoveBadge(BADGEFORCUT,showmsg)
facingEvent = $game_player.pbFacingEvent
if !facingEvent || facingEvent.name!="Tree"
Kernel.pbMessage(_INTL("Can't use that here.")) if showmsg
return false
end
return true
end
def useMoveCut
if !pbHiddenMoveAnimation(nil)
Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Cut"))
end
facingEvent = $game_player.pbFacingEvent
if facingEvent
pbSmashEvent(facingEvent)
end
return true
end
And I added at PokemonItemEffects script section:
Code:
ItemHandlers::UseFromBag.add(:KNIFE,proc{|item|
next canUseMoveCut? ? 2 : 0
})
ItemHandlers::UseInField.add(:KNIFE,proc{|item|
useMoveCut if canUseMoveCut?
})
Last edited: