- 17
- Posts
- 6
- Years
- Seen Feb 21, 2021
Hello Everyone! I recently finished a thread where I inquired about progressively revealing the region map to the player, i.e., the player starts with a blank map without any routes or towns, and as the player travels to each new area, the map gets updated to reveal each new location on the map. With the suggestions of a few great people in this community, I managed to code a working solution to this. This script modify's Marin's Better Region Map script. If you don't already have it, I highly suggest using it! This is for Pokemon Essentials 17.2 but I imagine it will work with other versions of Essentials.
With this guide I'll go over all the details of what my modification does as well as provide some tips at the end with using it. If you have any questions, feel free to send me a message or reply to this thread. I'll be more than happy to help out where I can!
To start off, you need to go to Settings to create a new setting for your game. This is an array that will store all of the necessary route info, modeled after the REGIONMAPEXTRAS setting already existing, which is the Hidden Island feature (Berth and Faraday Islands) that are in base Essentials. Marin's script doesn't use this feature, so I made a new variable for my own modification. In Settings, I placed this under the REGIONMAPEXTRAS (Line 280):
I've set out the different variables in the array there. The Map ID is the map id that triggers the route to appear once the player enters it. You can do some interesting things with this variable, more about this in the tips at the end. I've also added a Game Switch functionality. If you want to show a far away location to the player, simply set the switch (in my example, switch 67) via an event script and the location will now be displayed on the player's map. This can be turned off later too, hiding the location on the map (see tips below). Setting this to 0 removes this feature for that particular location, as there is no "switch 0."
You will now need to create a new folder in your Graphics/Pictures Folder called "Routes" where you'll be placing all the individual routes and towns. I've included some personal examples of two towns and a route that connects them. You can view my example towns and routes here. As well as my blank region map where the routes and towns will be added in later.
Now that the setting is complete, the rest of the modifications will all be in Marin's BetterRegionMap script.
We first need to redefine what region to display. Replace this line (line 48):
with this:
Next, below this line: "@window["player"] = Sprite.new(@mapvp)" (line 72)
Paste this:
You will also need to modify the "if @show_player" statement a little bit too.
Below this line: "@window["player"].y = TileHeight * player[2] + (TileHeight / 2.0)"
Paste this:
And lastly, at around line 360 you will need to replace the entire "def update_text" routine with this slightly modified version in order to hide the information text that appears on the map until the player has visited the map ID outlined in the HIDDENROUTES array.
Replace the full "def update_text" with this:
And that's it! Your routes will now display progressively as the player adventures forth into your wide wide region! Every time the player steps onto a new map, the map id is saved by Essentials as a "visited map" something Essentials keeps track of naturally. Here are some screenshots to show what I mean using my example pictures provided above. As the player moves from Newbreeze Town to Route 4 then to Oldpark Town, each route and town gets revealed along with some trees that I included in the images with each.
This will then reveal the visited route or town when the player steps onto the map. This code completely overhauls how routes are displayed, so every single town and route needs to be listed in the HIDDENROUTES array. It sounds like a lot, but as long as you keep up with it as you create new maps, it isn't as much work. The hardest part is cutting up your routes individually, but that is really just time consuming.
Some tips:
The same effect can be done with base Essentials if you don't wish to use Better Region Maps. Simply add the routes and towns into the REGIONMAPEXTRAS array in Settings to take advantage of the Hidden Islands feature. This method uses switches, so you'll need to dedicate a large number of switches for each route and town.
If you wish for a town or route, or whatever custom feature you want on the map, to be visible from the very beginning, in the HIDDENROUTES array, make the Map ID 1 (the intro map) instead of whatever map id the place actually is. This will make the place appear on the map right from the very beginning of the game. You can also do this for a series of towns and routes you want to appear all at once, simply make the map id of each entry in the HIDDENROUTES array to be the same, then they will all appear on the map together once the player enters that one Map ID. By doing this for all routes and towns, you can essentially have a fully loaded in map, opening up the possibility to use a Hidden Island-like feature in Marin's Better Region Map.
This code will even allow you to change a route on the fly (say a landslide happens and the route now goes South instead of East). If you set the map ID in the HIDDENROUTES array to a location that the player can't visit (like creating a dumby map that's only one tile big, just for this purpose) and use a Switch to show the route when the player first visits, the route will display on the map. When the landslide happens, simply use an event to turn the switch off for the Eastbound route and turn the switch on for the Southbound route. The map will change to show the Southbound route instead!
With the Game Switch variable in HIDDENROUTES, you can set a location to Switch 14, the s:PBDayNight.isDay? switch to check whether or not it's day. By tying this to a location, say some mysterious cave with a legendary in it, you can display the cave on the player's map only when it's day time. Likewise, you can tie this to Switch 19 to check if it's a certain weekday. If you set the map ID for the location in HIDDENROUTES to be a map id the player can't visit then this location will always be hidden on the map even after the player has visited the mysterious cave. By playing around with the map ID and Switches, you can create some pretty awesome living maps that change as the player explores your world!
That's everything! I was thinking of making a more "light" version of this where the map appears normal without you having to create all of the points in the HIDDENROUTES array but still have the ability to hide some routes from the player until they discover them. This would be exactly what the Hidden Islands feature in base Essentials was, just with Better Region Maps. If someone would like this, I'll look into modifying my code to get it working. But for now, Enjoy!
With this guide I'll go over all the details of what my modification does as well as provide some tips at the end with using it. If you have any questions, feel free to send me a message or reply to this thread. I'll be more than happy to help out where I can!
To start off, you need to go to Settings to create a new setting for your game. This is an array that will store all of the necessary route info, modeled after the REGIONMAPEXTRAS setting already existing, which is the Hidden Island feature (Berth and Faraday Islands) that are in base Essentials. Marin's script doesn't use this feature, so I made a new variable for my own modification. In Settings, I placed this under the REGIONMAPEXTRAS (Line 280):
Code:
#===============================================================================
# * A set of arrays for hidden routes and towns that will be shown when the
# player enters the map. Each Array must contain the following:
# - Region number.
# - Map ID.
# - X coordinate of the graphic on the map (pixel)
# - Y coordinate of the graphic on the map (pixel)
# - Name of the graphic, found in the Graphics/Pictures/Routes folder.
# - Name of Route/Town in townmap.txt
# - (optional, set=0 for no switch) Game Switch to reveal this
# map location to player (can't fly to location)
#===============================================================================
HIDDENROUTES = [
[0,81,80,160,"townNewbreezeTown","Newbreeze Town",0],
[0,32,64,160,"route4","Route 4",0],
[0,48,160,192,"townOldparkTown","Oldpark Town",67]
]
I've set out the different variables in the array there. The Map ID is the map id that triggers the route to appear once the player enters it. You can do some interesting things with this variable, more about this in the tips at the end. I've also added a Game Switch functionality. If you want to show a far away location to the player, simply set the switch (in my example, switch 67) via an event script and the location will now be displayed on the player's map. This can be turned off later too, hiding the location on the map (see tips below). Setting this to 0 removes this feature for that particular location, as there is no "switch 0."
You will now need to create a new folder in your Graphics/Pictures Folder called "Routes" where you'll be placing all the individual routes and towns. I've included some personal examples of two towns and a route that connects them. You can view my example towns and routes here. As well as my blank region map where the routes and towns will be added in later.
Now that the setting is complete, the rest of the modifications will all be in Marin's BetterRegionMap script.
We first need to redefine what region to display. Replace this line (line 48):
Code:
@region = region || $PokemonGlobal.region
with this:
Code:
if region == nil
@region = pbGetMetadata($game_map.map_id,MetadataMapPosition)[0]
else
@region = region || $PokemonGlobal.region
end
Next, below this line: "@window["player"] = Sprite.new(@mapvp)" (line 72)
Paste this:
Code:
#-----------------------------------
#-----------------------------------
for route in HIDDENROUTES
if ($PokemonGlobal.visitedMaps[route[1]] && @region == route[0]) ||
($game_switches[route[6]] && @region == route[0])
@window[route[4]] = Sprite.new(@mapvp)
@window[route[4]].bmp("Graphics/Pictures/Routes/#{route[4]}")
@window[route[4]].x = route[2] - 4 #Not sure why, but there is an offset of 4
@window[route[4]].y = route[3] - 4
end
end
#-----------------------------------
#-----------------------------------
You will also need to modify the "if @show_player" statement a little bit too.
Below this line: "@window["player"].y = TileHeight * player[2] + (TileHeight / 2.0)"
Paste this:
Code:
@window["player"].z = 1 #so the player icon shows above routes
And lastly, at around line 360 you will need to replace the entire "def update_text" routine with this slightly modified version in order to hide the information text that appears on the map until the player has visited the map ID outlined in the HIDDENROUTES array.
Replace the full "def update_text" with this:
Code:
#-----------------------------------
#-----------------------------------
def update_text
location = @data[2].find do |e|
e[0] == $PokemonGlobal.regionMapSel[0] &&
e[1] == $PokemonGlobal.regionMapSel[1]
end
text = ""
poi = ""
for route in HIDDENROUTES
if ($PokemonGlobal.visitedMaps[route[1]] && @region == route[0]) ||
($game_switches[route[6]] && @region == route[0])
text = location[2] if location && (location[2] == route[5])
poi = location[3] if location && location[3] && (location[2] == route[5])
end
end
@sprites["txt"].draw([
[pbGetMessage(MessageTypes::RegionNames,@region), 16, 0, 0,
Color.new(255,255,255), Color.new(0,0,0)],
[text, 16, 354, 0, Color.new(255,255,255), Color.new(0,0,0)],
[poi, 496, 354, 1, Color.new(255,255,255), Color.new(0,0,0)]
], true)
end
#-----------------------------------
#-----------------------------------
And that's it! Your routes will now display progressively as the player adventures forth into your wide wide region! Every time the player steps onto a new map, the map id is saved by Essentials as a "visited map" something Essentials keeps track of naturally. Here are some screenshots to show what I mean using my example pictures provided above. As the player moves from Newbreeze Town to Route 4 then to Oldpark Town, each route and town gets revealed along with some trees that I included in the images with each.
This will then reveal the visited route or town when the player steps onto the map. This code completely overhauls how routes are displayed, so every single town and route needs to be listed in the HIDDENROUTES array. It sounds like a lot, but as long as you keep up with it as you create new maps, it isn't as much work. The hardest part is cutting up your routes individually, but that is really just time consuming.
Some tips:
The same effect can be done with base Essentials if you don't wish to use Better Region Maps. Simply add the routes and towns into the REGIONMAPEXTRAS array in Settings to take advantage of the Hidden Islands feature. This method uses switches, so you'll need to dedicate a large number of switches for each route and town.
If you wish for a town or route, or whatever custom feature you want on the map, to be visible from the very beginning, in the HIDDENROUTES array, make the Map ID 1 (the intro map) instead of whatever map id the place actually is. This will make the place appear on the map right from the very beginning of the game. You can also do this for a series of towns and routes you want to appear all at once, simply make the map id of each entry in the HIDDENROUTES array to be the same, then they will all appear on the map together once the player enters that one Map ID. By doing this for all routes and towns, you can essentially have a fully loaded in map, opening up the possibility to use a Hidden Island-like feature in Marin's Better Region Map.
This code will even allow you to change a route on the fly (say a landslide happens and the route now goes South instead of East). If you set the map ID in the HIDDENROUTES array to a location that the player can't visit (like creating a dumby map that's only one tile big, just for this purpose) and use a Switch to show the route when the player first visits, the route will display on the map. When the landslide happens, simply use an event to turn the switch off for the Eastbound route and turn the switch on for the Southbound route. The map will change to show the Southbound route instead!
With the Game Switch variable in HIDDENROUTES, you can set a location to Switch 14, the s:PBDayNight.isDay? switch to check whether or not it's day. By tying this to a location, say some mysterious cave with a legendary in it, you can display the cave on the player's map only when it's day time. Likewise, you can tie this to Switch 19 to check if it's a certain weekday. If you set the map ID for the location in HIDDENROUTES to be a map id the player can't visit then this location will always be hidden on the map even after the player has visited the mysterious cave. By playing around with the map ID and Switches, you can create some pretty awesome living maps that change as the player explores your world!
That's everything! I was thinking of making a more "light" version of this where the map appears normal without you having to create all of the points in the HIDDENROUTES array but still have the ability to hide some routes from the player until they discover them. This would be exactly what the Hidden Islands feature in base Essentials was, just with Better Region Maps. If someone would like this, I'll look into modifying my code to get it working. But for now, Enjoy!
Last edited: