FANDOM


Adding an icon for player's position in map
This tutorial is deprecated. It is no longer relevant to the latest version of Pokémon Essentials.

This tutorial was written by Martinixon. Please give credit.

Click here for more tutorials!


PlayerIcon

Using a Pokeball as an icon for the player.

Adding an icon to the player's position in map

A "clean" kit of Pokémon Essentials already comes with the Pokégear function with a map in it, however this map doesn't show the current location of the player (although the cursor starts there). This small tutorial will help you add your own icon that shows the current location of the player and will use a different icon depending on the player selected. You need to have the metadata file edited according to your game or the icon won't show correctly, see Maps for info on doing this.

In the script section PokemonRegionMap, find the class PokemonRegionMapScene and then the def pbStartScene in it. Around 25 lines below you should see the following code, add the highlighted part:

if !@map
  Kernel.pbMessage(_INTL("The map data cannot be found."))
  return false
end
@sprites["map"]=IconSprite.new(0,0,@viewport)
@sprites["map"].setBitmap("Graphics/Pictures/#{@map[1]}")
@sprites["player"]=IconSprite.new(@viewport)
@sprites["player"].setBitmap(sprintf("Graphics/Pictures/playerpos%03d",$Trainer.trainertype))
@sprites["cursor"]=AnimatedSprite.create("Graphics/Pictures/mapcursor",2,15)
@sprites["cursor"].viewport=@viewport
@sprites["cursor"].play
@sprites["mapbottombm"]=IconSprite.new(0,Graphics.height-32,@viewport)
@sprites["mapbottombm"].setBitmap("Graphics/Pictures/mapbottom")
@sprites["mapbottom"]=MapBottomSprite.new(@viewport)
@sprites["mapbottom"].mapname=pbGetMessage(MessageTypes::RegionNames,mapindex)
@sprites["cursor"].x=-8+(@mapX*16)
@sprites["cursor"].y=-8+(@mapY*16)
@sprites["player"].x=-8+(@mapX*16)
@sprites["player"].y=-8+(@mapY*16)
@changed=false
pbFadeInAndShow(@sprites){ pbUpdate }
return true

Then create up to 4 png images of 32x32px with the name "playerpos00x" and add it to the folder "Pictures" which is located inside the "Graphics" folder within your project.

Replace "x" with numbers from 0 to 3, one for each player in your game that was set in the metadata.

"0" being PlayerA, "1" being PlayerB, "2" being PlayerC, "3" being PlayerD.

Notes

  • You may have to play a little bit with the image size to get it centered in the map.
  • It is not necessary to add images of players you don't have set in the metadata.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.