Custom Pokemon Pager HM replacement script

anonfatality91

Rookie
Member
Joined
Apr 21, 2017
Posts
4
This is a rather intricate and advanced sort of add on I've been working on implementing into my game. I'm trying to add in the whole pager system like sun/moon has where you can summon a pokemon to assist you rather than rely on an HM (The whole HM thing has always bothered me, I hate having to keep an HM slave). I considered using the HM to item system but I liked this idea better. I already have a working custom GUI menu (minus the ability to be accessed, or really do anything but move a cursor around).

I lack a few things that I really need. First and foremost, I need a way to call the handler's for the HMs from the menu (will be adding a small trigger to trigger the HM check and use when the player clicks the button). I'm having trouble with this because I want to trigger the check to check badges, terrain, location, and all of that stuff but I want it to skip the pokemon move checks which check to see if a pokemon has a move. It's been tricky, I've played with the handlers some already to see if I got any results but I'm having trouble getting around some of the more intricate ones (dive and fly have been exceedingly bothersome but they are mandatory for my game).

If ridding the script of the movecheck is too bothersome, could someone give me pointers on script to do the terrain and other checks where I can comment out and bypass the original handler? If I can bypass the normal check handler and have my own script run the check then I can tie in the move usage into my own check script. I'm a decent programmer but I am still learning, all of these procedures are a bit more advanced than the ones I have been messing with so far. Also, is there a way I can add a code to check if an in-game switch has been set to on as part of the HM use check. I want a custom menu where you can select a move on the menu and it be used. I want to have each option on the menu to be unlocked in-game (a person adds a chip or programs a pokemon cry in which grants you the new move at a certain point in the game). The only reason I want some of the original checks left in place is to prevent glitches like surf being used on tiles it is not supposed to (same with dive) or cut causing the cut animation to appear anytime it's triggered creating phantom trees. If anyone can help me out with this code that would be wonderful! I'm not yet looking to change any of the animations to it.

Finally, I need to know how to set the shown species when the HM is triggered to a set species (normally it would show whatever pokemon used the move). i.e. When fly is used, pidgeot is always shown since the set pokemon the device calls for that service is pidgeot always.
 

Mr. Gela

Discord: theo#7722
Member
Joined
Jul 19, 2015
Posts
188
What's the structure of your code so far? I can't work on it until Monday or so, but I'd just do "for i in $Trainer.party.length" and then check what HM moves each Pokémon has learnt, then push them into an array (to get their icons, maybe it's redundant?) and then terrain beneath and in front of the player (water etc) along with events (for Cut) then display all HM moves with Pokémon icons in the scene and gray them out based on whether it's usable or not.

Not sure if I was of much help, maybe if you were lacking organization? I'll mess with it next week if you haven't figured it out yet. Good luck!
 

anonfatality91

Rookie
Member
Joined
Apr 21, 2017
Posts
4
I undid the changes I had to the move handlers because it was crashing the game and after reviewing it it was not stable code. I'll post the code I have so far up here soon, it's mostly just gui. I don't want it dependant on if a pokemon in the party has the move or not, this is designed to work like the ride pager in sun and moon which calls a pokemon from a remote location rather than using a party pokemon.

To unlock, I'm trying to turn the move handlers into item handlers. Whether or not the move can be used will be based on if the player has recieved a 'chip' (for storyline purposes, the chip allows the device to emit a frequency calling the pokemon for assistance. i.e. To use fly, they player would need to have the proper badge, be outdoors, and own a pidgeot chip.) I am able to get as far as altering the text display and some of the settings in the move handlers, I just can't edit the CanUseMove function to the point it checks for the item instead of the learned HM move, and then trigger it from my custom menu instead of the party menu. I can probably figure out the whole trigger thing, it doesn't look all that daunting (just have to call the right part of the code) it's the alteration of the check that scrambled all of my code up (cut and surf didn't seem to be glitched out all that bad, it was dive and fly which use different handling codes that were filled with glitches and runtime errors.)

I'll get that code posted up this weekend and some screenshots of the gui and such to give an idea of what I'm going for. My gui code is based off of a tutorial in pokecommunity so it's a bit different than the one used for the pokegear and pokedex. Thank you! I appreciate any and all assistance with this little project!
 

anonfatality91

Rookie
Member
Joined
Apr 21, 2017
Posts
4
Code:
#===============================================================================
# Cut
#===============================================================================
 
####Cut's CanUseMove handler####
def Kernel.pbCut
  if $DEBUG ||
	 ####Badge check, keep in tact####
	 (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
	 ####Party move check, need's changed to an item check####
	movefinder=Kernel.pbCheckMove(:CUT)
	####Needs altered to be compatible with item check####
	if $DEBUG || movefinder
	  ####Leave alone####
	  Kernel.pbMessage(_INTL("This tree looks like it can be cut down!\1"))
	  if Kernel.pbConfirmMessage(_INTL("Would you like to cut it?"))
		####Needs altered or removed, species check. Needs to be confirmed to not have further function####
		speciesname=!movefinder ? $Trainer.name : movefinder.name
		####Alterations made already####
		Kernel.pbMessage(_INTL("Scyther was called, Scyther used cut!"))
		####Animation is fine, need movefinder section manually set to use cut's animation with scyther's
		#sprite####
		pbHiddenMoveAnimation(movefinder)
		return true
	  end
	else
	  Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))
	end
  else
	Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))
  end
  return false
end
 
####Needs altered to read from new CanUseMove handler (^above^)####
HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn|
   ####Leave in tact, Badge check. Tied to Badge count setting in settings.####
   if !$DEBUG &&
	  !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
	 Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
	 return false
   end
   ####Leave in tact, player position check.####
   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(pokemon)
	 ####Pokemon name needs manually set to Scyther rather than reading from pokemon.name#
	 #PBMove.getName(move) needs to be manually set to cut.
	 Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
   end
   ####Leave alone####
   facingEvent=$game_player.pbFacingEvent
   if facingEvent
	 facingEvent.erase
	 $PokemonMap.addErasedEvent(facingEvent.id)
   end
   return true
})
 
#===============================================================================
# Headbutt
#===============================================================================
def Kernel.pbHeadbuttEffect(event)
  a=((event.x*event.y+event.x*event.y)/5)%10
  b=($Trainer.id&0xFFFF)%10
  chance=1
  if a==b
	chance=8
  elsif a>b && (a-b).abs<5
	chance=5
  elsif a<b && (a-b).abs>5
	chance=5
  end
  if rand(10)>=chance
	Kernel.pbMessage(_INTL("Nope. Nothing..."))
  else
	if !pbEncounter(chance==1 ? EncounterTypes::HeadbuttLow : EncounterTypes::HeadbuttHigh)
	  Kernel.pbMessage(_INTL("Nope. Nothing..."))
	end
  end
end
 
def Kernel.pbHeadbutt(event)
  movefinder=Kernel.pbCheckMove(:HEADBUTT)
  if $DEBUG || movefinder
	if Kernel.pbConfirmMessage(_INTL("A Pokémon could be in this tree. Would you like to use Headbutt?"))
	  speciesname=!movefinder ? $Trainer.name : movefinder.name
	  Kernel.pbMessage(_INTL("{1} used Headbutt!",speciesname))
	  pbHiddenMoveAnimation(movefinder)
	  Kernel.pbHeadbuttEffect(event)
	end
  else
	Kernel.pbMessage(_INTL("A Pokémon could be in this tree. Maybe a Pokémon could shake it."))
  end
  Input.update
  return
end
 
HiddenMoveHandlers::CanUseMove.add(:HEADBUTT,proc{|move,pkmn|
   facingEvent=$game_player.pbFacingEvent
   if !facingEvent || facingEvent.name!="HeadbuttTree"
	 Kernel.pbMessage(_INTL("Can't use that here."))
	 return false
   end
   return true
})
 
HiddenMoveHandlers::UseMove.add(:HEADBUTT,proc{|move,pokemon|
   if !pbHiddenMoveAnimation(pokemon)
	 Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
   end
   facingEvent=$game_player.pbFacingEvent
   Kernel.pbHeadbuttEffect(facingEvent)
})
 
#===============================================================================
# Rock Smash
#===============================================================================
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 || movefinder
	  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
})

Code:
#===============================================================================
# Surf
#===============================================================================
####Leave alone, dependant event check####
def Kernel.pbSurf
  if $game_player.pbHasDependentEvents?
	return false
  end
  if $DEBUG ||
	####Badge check, leave alone####
	(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
	####Needs changed to an item check, currently checks for party move####
	movefinder=Kernel.pbCheckMove(:SURF)
	####Needs altered to work with an item check, not the movefinder####
	if $DEBUG || movefinder
	  ####Leave alone, easy alterations####
	  if Kernel.pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
		####Needs altered or removed, moverfinder speciesname insert checker####
		speciesname=!movefinder ? $Trainer.name : movefinder.name
		####Alterations made####
		Kernel.pbMessage(_INTL("Wailmer was called, Wailmer used Surf!"))
		####Need manually set to surf HiddenMoveAnimation, remove movefinder####
		pbHiddenMoveAnimation(movefinder)
		####Leave alone, Surf code####
		surfbgm=pbGetMetadata(0,MetadataSurfBGM)
		pbCueBGM(surfbgm,0.5) if surfbgm
		pbStartSurfing()
		return true
	  end
	end
  end
  return false
end
 
####Leave alone, surf code####
def pbStartSurfing()
  Kernel.pbCancelVehicles
  $PokemonEncounters.clearStepCount
  $PokemonGlobal.surfing=true
  Kernel.pbUpdateVehicle
  Kernel.pbJumpToward
  Kernel.pbUpdateVehicle
  $game_player.check_event_trigger_here([1,2])
end
 
####Leave alone, end surf code####
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
 
####Leave alone, important surf code####
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
 
####Leave alone, terrain codes####
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
}
 
####Needs set to new CanUseMove (^above^)
HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|
   if !$DEBUG &&
	 ####Badge check, leave alone####
	  !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
	 Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
	 return false
   end
   ####Already surfing message, leave alone####
   if $PokemonGlobal.surfing
	 Kernel.pbMessage(_INTL("You're already surfing."))
	 return false
   end
   ####Leave alone, dependant event check####
   if $game_player.pbHasDependentEvents?
	 Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
	 return false
   end
   ####Not sure what this is, leave alone.####
   if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
	 Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
	 return false
   end
   terrain=Kernel.pbFacingTerrainTag
   notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
   if !PBTerrain.isSurfable?(terrain) || !notCliff
	 Kernel.pbMessage(_INTL("No surfing here!"))
	 return false
   end
   return true
})
 
####Needs set for new CanUseMove (2 of them ^above^)####
HiddenMoveHandlers::UseMove.add(:SURF,proc{|move,pokemon|
   $game_temp.in_menu=false
   if !pbHiddenMoveAnimation(pokemon)
	 ####Needs manually set to Wailmer (instead of pokemon.name), and surf (instead of pbmoves read script####
	 Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
   end
   surfbgm=pbGetMetadata(0,MetadataSurfBGM)
   pbCueBGM(surfbgm,0.5) if surfbgm
   pbStartSurfing()
   return true
})

Code:
#===============================================================================
# Dive
#===============================================================================
####Leave alone, map metadata lookup####
def Kernel.pbDive
  divemap=pbGetMetadata($game_map.map_id,MetadataDiveMap)
  return false if !divemap
  if $DEBUG ||
	####Badge count, leave alone####
	(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE])
	####needs altered, party move check. Needs changed to an item check####
	movefinder=Kernel.pbCheckMove(:DIVE)
	if $DEBUG || movefinder
	  ####Leave alone####
	  if Kernel.pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
		####Needs altered or removed####
		speciesname=!movefinder ? $Trainer.name : movefinder.name
		####Alterations made, leave alone####
		Kernel.pbMessage(_INTL("Mantine Was Called, Mantine used Dive!"))
		####Animation needs manually set to dive, movefinder needs removed.####
		pbHiddenMoveAnimation(movefinder)
		####Leave alone,map switch code####
		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
 
####leave alone####
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
  ####Needs changed to a check item####
  movefinder=Kernel.pbCheckMove(:DIVE)
  ####needs changed to a checkitem &&####
  if $DEBUG || (movefinder &&
	####Badge check, leave alone####
	(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE]) )
	####Leave alone####
	if Kernel.pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
	  ####Needs altered or removed.####
	  speciesname=!movefinder ? $Trainer.name : movefinder.name
	  ####Alterations made, leave alone.####
	  Kernel.pbMessage(_INTL("Mantine used Dive!"))
	  ####Leave alone####
	  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
	####Leave alone.####
	Kernel.pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
  end
  return false
end
 
####Leave alone####
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
 
####Leave alone.####
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
}
 
####Needs altered to an item check.####
HiddenMoveHandlers::CanUseMove.add(:DIVE,proc{|move,pkmn|
   if !$DEBUG &&
	 ####Leave alone.####
	  !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORDIVE : $Trainer.badges[BADGEFORDIVE])
	 Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
	 return false
   end
   ####Leave alone, map meta check.####
   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
})
 
####Needs altered to work with CanUseMove ^above^ (2))####
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)
	 ####Needs manually set to Mantine used Dive####
	 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
})

Code:
#===============================================================================
# Fly
#===============================================================================
####Needs set to an item check.####
HiddenMoveHandlers::CanUseMove.add(:FLY,proc{|move,pkmn|
   if !$DEBUG &&
	 ####Leave alone.####
	  !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLY : $Trainer.badges[BADGEFORFLY])
	 Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
	 return false
   end
   ####Leave Alone####
   if $game_player.pbHasDependentEvents?
	 Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
	 return false
   end
   ####Leave alone, map meta check.####
   if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
	 Kernel.pbMessage(_INTL("Can't use that here."))
	 return false
   end
   return true
})
 
####Needs changed to work with new CanUseMove (^above^)####
HiddenMoveHandlers::UseMove.add(:FLY,proc{|move,pokemon|
   ####Leave alone.####
   if !$PokemonTemp.flydata
	 Kernel.pbMessage(_INTL("Can't use that here."))
   end
   ####Needs altered to say "Pidgeot used Fly"####
   if !pbHiddenMoveAnimation(pokemon)
	 Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
   end
   ####Leave alone####
   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
})

The above codes are the move handler codes for the 4 moves I need edited. I have alot of it commented to mark what I'm trying to change. Any other moves I decide to add later, I will just copy over the changes applied to these over to those. These are the main moves I need active by the time I release a demo. I'm still working out some of the kinks with them on my end.

Code:
class RidePager
#####Menu initialization and setup#####
  def Initialize
	@viewport1=viewport.new(0,0,512,384)
	@viewport1.z=700
	@sprites {}
	@sprites ["backgroundrp"]=Sprite.new(@viewport1)
	@sprites ["backgroundrp"].bitmap=Bitmap.new("Graphics/Pictures/ridepagerbg")
	@viewport2=viewport.new(0,0,512,384)
	@viewport2.z=701
	@sprites2 {}
	@sprites2 ["cutbutton"]=Sprite.new(@viewport2)
	@sprites2 ["cutbutton"].bitmap=Bitmap.new("Graphics/Pictures/rideselbutton1")
	@sprites2 ["cutbutton"].x=31
	@sprites2 ["cutbutton"].y=60
	@sprites2 ["surfbutton"]=Sprite.new(@viewport2)
	@sprites2 ["surfbutton"].bitmap=Bitmap.new("Graphics/Pictures/rideselbutton2")
	@sprites2 ["surfbutton"].x=31
	@sprites2 ["surfbutton"].y=81
	@sprites2 ["flybutton"]=Sprite.new(@viewport2)
	@sprites2 ["flybutton"].bitmap=Bitmap.new("Graphics/Pictures/rideselbutton3")
	@sprites2 ["flybutton"].x=31
	@sprites2 ["flybutton"].y=101
	@sprites2 ["divebutton"]=Sprite.new(@viewport2)
	@sprites2 ["divebutton"].bitmap=Bitmap.new("Graphics/Pictures/rideselbutton3")
	@sprites2 ["divebutton"].x=31
	@sprites2 ["divebutton"].y=121
	@sprites2 ["optionselect"]=Sprite.new(@viewport2)
	@sprites2 ["optionselect"].bitmap=Bitmap.new("Graphics/Pictures/selmarker")
	@sprites2 ["optionselect"].x=23
	@sprites2 ["optionselect"].y=60
	@selection=0
  end
  #####Menu controls and functions#####
  def rpmain
	loop do
	  Graphics.update
	  if Input.trigger?(Input::DOWN) &&@selection==0
		@selection=1
		@sprites2 ["optionselect"].y=81
	  end
	  if Input.trigger?(Input::DOWN) &&@selection==1
		@selection=2
		@sprites2 ["optionselect"].y=101
	  end
	  if Input.trigger?(Input::DOWN) &&@selection==2
		@selection=3
		@sprites2 ["optionselect".y=121
	  end
	  if Input.trigger?(Input::UP) &&@selection==3
		@selection=2
		@sprites2 ["optionselect"].y=101
	  end
	  if Input.trigger?(Input::UP) &&@selection==2
		@selection=1
		@sprites2 ["optionselect"].y=81
	  end
	  if Input.trigger?(Input::UP) &&@selection==1
		@selection=0
		@sprites2 ["optionselect"].y=60
	  end  
	 if Input.trigger?(Input::C) &&@selection==0 &&$DEBUG || $PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)>0

The above code is for the GUI menu that I want to use to trigger the HM moves. The below graphics are the menu graphics. With the above code, I need the selected button to trigger the modified CanUseMove and UseMove scripts when the button is selected (the Input.trigger(Input::C) code for the button the player currently has the cursor on.). I also need a call script to be able to pull this menu up from an item in the Key Items menu but I may be able to manage that borrowing code from another key item script and modifying it to work with this system. If any further details are needed, just let me know and I will gladly offer them over. I'll be doing some tinkering with it on my end and see if I can get it to work. I modified all of the codes with comments to help point out the different code sections and single out the sections needing alterations. It helped me alot in breaking down the code, I hope it makes things slightly easier.















Those are the graphics for the menu. These are just the basic graphics I made to get the system up and running. I'm going to be editing them further once I actually have the operational code working properly. Currently, the buttons all line up vertically and the small orange cursor scrolls between them. I plan to leave the scrolling cursor but I'll probably be adding button highlighting for the selected button as well and a darkened button for when a button is selected.
 

anonfatality91

Rookie
Member
Joined
Apr 21, 2017
Posts
4
Yes, after a few alterations. I want to clean it up a bit and make the buttons a little easier to customize before it's released as a public resources. I also want to add further commenting in the code to make it easier for others to use in their games. Others may want to use their own preset pokemon or make changes to the code or menu for their games and it needs a little more altering and fine tuning for that.

Once it is both stable, tested, and made ready for a public release, I will release it as a public resource for others to use.
 
Top