• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Custom Feature Question] Progressively revealing region maps?

AenaonDusky

DeliveryBoy
315
Posts
6
Years
    • Seen Apr 28, 2024
    That's a nice idea!
    So basically, it comes down to these options:



    1) Draw each possible distinct combination of routes, and call each respective picture based on variables/switches

    2) Implement the vanilla hidden island system into Marin's script (why not contact Marin?)

    3) Find a way to use some kinda bitmap bamboozlery to produce a "fow" effect, either through shaders (haha, this is old ruby we're talking about) or by manipulating a particular area of the picture (quite the undertaking).

    4) Like badges on the trainer card, you start with a "blank" region map and add icons, with their position being relative to a certain point in the map (e.g. the center, a fixed position once you've figured out your map's exact size) in case you're having coordinate problems. This should be possible. Bear in mind that the icon doesn't need to be a single "white line" route, it can also be a "crossroads", or a bigger icon with any combination. You get what I'm saying?

    OR

    you do the opposite; your standard map has every route drawn on it (including the "dynamic" routes that change later) and you now draw icon/ other pics that COVER these areas, which you remove after the player discovers the part. What I'm saying here is, instead of ADDING routes, you give the illusion of addition by having "empty" areas drawn on top of these, and removing them based on progression. The main difference here is possible workload for your artist/you, instead of making separate pictures for each route, you draw each combination of layers that cover the actual map, (which might also be easier /less annoying to do)

    5) Use events and a tileset instead of a picture, as you've already said. Elaborating on this: This can actually be as big as you want (Well, figuratively speaking). Fade out screen, disable menu access, disable running, and any other tricky input, Change the player's outfit into a map marker, transfer player into a faux region map drawn with a tileset, change visible routes via events activated on variables or switches (variables might be better cause of different "stages" ((in your case, combos of routes, altered routes etc)) of being activated). When a route/town has been discovered during gameplay, you activate a switch, and when during the map "screen", the "marker" goes on top of it, you make the event (which activates via action button or player touch) ask whether to simply transfer the player there, you don't even need the flying mechanic already in Essentials that way. Screen fade out, enable menu and running, change outfit into default or previously stored if multiple outfits exist. Done! As for the encounters and the pokedex, that's a bit trickier, but the same could be done with these theoretically. Or at the very least, store which parts of the map have been explored in larger groups using option number 3) above (e.g. general areas where these mons can be found) so you won't have to draw an insane amount of combos, and provide more of a "low-res" caricature of the real n' true map, because...uh... well, let's just say you got an old model (sweats)

    What's even funnier is that you can turn this into a soaring mechanic like in ORAS. lol!
     
    Last edited:
    17
    Posts
    5
    Years
    • Seen Feb 21, 2021
    EVERYONE!!! I found a solution! But there's a little more work to be done to fully implement the feature.

    First off, I'd like to say thank you all so much for the help! It's been quite the adventure with all of this and all of your suggestions have been fantastic. BUT I FINALLY DID IT! I was toying around with Swdfm's idea to positions the individual route sprites behind the map in order to position them for a sort of picture. I wasn't able to figure out the whole printing thing to save the map, however, I was able to fix a graphical bug that I was having before I posted this thread. All it took was changing the place where the route sprites were being drawn upon, I honestly have no idea how I overlooked this rather simple thing! This solution uses Marin's Better Region Maps script and it's technically custom as I take advantage of another Essential's feature for my own personal preferance, so not quite plug-and-play. I'll explain more about this below.

    Basically I was drawing sprites to the window, which made the routes "float" above the map as it panned underneath it. But as I was trying to figure out how to put the sprites behind the map with the z value and, I accidentally pasted the sprites ON the map and they stuck! No floating or anything weird aside from a small offset of 4 pixels in height (but that could be due to my graphics). Once I realized this, I quickly got to work looking at how to adapt the Hidden Island feature into Marin's wonderful script.

    So here's my solution! For those who have Marin's Better Region Maps script, I pasted this above "if @show_player" at around line 74.

    Code:
    #-----------------------------------------------------------------
    #-----------------------------------------------------------------    
        for route in REGIONMAPEXTRAS
          if $PokemonGlobal.visitedMaps[route[1]]
            @window[route[4]] = Sprite.new(@mapvp)
            @window[route[4]].bmp("Graphics/Pictures/routes/#{route[4]}")
            @window[route[4]].x = route[2]*TileWidth
            @window[route[4]].y = route[3]*TileHeight - 4   #Not sure why, but there was an offset of 4
          end
        end
    #-----------------------------------------------------------------
    #-----------------------------------------------------------------

    Yep, that's it! 8 lines of code, solves this whole question. I'm sure it's possible to shrink this down or make it more efficient, so I welcome anyone who's got the know-how to. I take advantage of how REGIONMAPEXTRAS (the Hidden Island feature in Essentials) store's it's array and basically copy it, but this could easily be done with a custom Constant. I think I'll create a new Constant myself because I'm not using the true/false statement at the end of REGIONMAPEXTRAS as well as I'm not using any Game Switches at all to handle this. Instead of switches, I'm using another feature in Essentials that tracks which maps have been visited! The $PokemonGlobal.visitedMaps, with the route[1] that it's checking for is a reference to the map id (NOT a switch, that the normal REGIONMAPEXTRAS has in that place of the array). That way, once a player steps on a map, I don't need any one-time event to trigger a switch. Essentials does this all for you. I've also created a folder in my graphics folder called "routes" where I'll store all the individual towns and routes pictures.

    Now what to do next? Streamlining the code would be what I want to try doing next, and I think I'll need help with this. As well as a little more testing to figure out if lag is an issue when looking at the map (I tested up to 10 routes, so far it looked good, but who knows). Another thing that needs to be done to fully implement this feature would be hiding the text that appears when hovering the cursor on the map until the route has been visited. Right now, all of the routes and town names are visible even when the picture isn't. I'll try modifying the draw text part of Marin's script to only draw when a route has been visited. I was just too excited to figure it out yet, but I think taking advantage of the $PokemonGlobal.visitedMaps would do the trick again. I'll update this post (and my first one) once this is implemented as I thiiiiiink this would be everything that needs to happen in order for this to work.

    Thanks again everyone! I just saw AenaonDusky post but I guess I was a little too quick with my troubleshooting today to need your suggestions. Although flying around a map like ORAS would be sweet if that could be done!
     
    Last edited:
    17
    Posts
    5
    Years
    • Seen Feb 21, 2021
    Rather than editing my last post, I thought I better do a full new post explaining everything I've done to add progressively revealing region maps to the game (using Marin's Better Region Maps script), now that I found a solution to the text display! The only thing left to do is check whether lag is an issue. In all my testing, I hadn't come across any lag issues, but it could entirely be possible that some lag will occur if you are using a massive map with many many routes and towns. My codeing skills are limited as well, so I welcome anyone who might be able to make this better! Or if you have any questions or bugs to report, please let me know! I'll be happy to answer anything or squash some pesky bugs.

    Some notes before we get started: This code is a modification of Marin's amazing Better Region Map script. It is a necessary script if you want to use any map larger than 480x320. If you are using the base essentials essentials map, I recommend taking advantage of the Hidden Islands feature to reveal your routes one at a time. To do so, you would need to dedicate switches to each and every route and town that are triggered by in game events. It'll work, but I think it would be a little messy and uses way too many switches. Besides, Marin's script works even on small maps too and you no longer have to deal with wall maps being different than the town map, so I definitely recommend it if you want to take advantage of this code!

    In settings, you will need to first add a new Constant. In Settings, I placed this under the REGIONMAPEXTRAS (the hidden island feature):

    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
    #===============================================================================
    HIDDENROUTES = [
       [0,81,80,160,"townNewbreezeTown","Newbreeze Town"],
       [0,32,64,160,"route4","Route 4"],
       [0,48,160,192,"townOldparkTown","Oldpark Town"]
    ]

    I've included some personal examples of two towns and a route that connects them. Be sure to add a new folder in your Graphics folder called "Routes"!

    Next in Marin's BetterRegionMap script, below the "@window["player"] = Sprite.new(@mapvp)" (line 72) paste this:

    Code:
    #-----------------------------------
    #-----------------------------------    
        for route in HIDDENROUTES
          if $PokemonGlobal.visitedMaps[route[1]] && $PokemonGlobal.region = route[0]
            @window[route[4]] = Sprite.new(@mapvp)
            @window[route[4]].bmp("Graphics/Pictures/Routes/#{route[4]}")
            @window[route[4]].x = route[2]
            @window[route[4]].y = route[3] - 4   #Not sure why, but there is an offset of 4
          end
        end
    #-----------------------------------
    #-----------------------------------

    You will also need to modify the "if @show_player" statement a little bit by adding this below "@window["player"].y = TileHeight * player[2] + (TileHeight / 2.0)"

    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 modified version:

    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]] && $PokemonGlobal.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 that! Your routes will now display progressively as the player adventures forth into your wide wide region! If you stylize your map, I think this feature would look amazing a sort of "hand drawn" kind of map.

    Some tips:
    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.

    This code won't allow you to replace any routes on the map with a new one (say some landslide happens and the route now goes South instead of East). However! A good workaround I found for this was to have the route picture file not have a transparent background, but instead have the background included (the map's terrain). By placing the new layout of the route lower in the HIDDENROUTES array, it will cover over the previous route when loaded in. You can literally move mountains with this code!

    Let me know what you all think! And I'm still relatively new to PokéCommunity, so should I post this solution in another thread now that it's solved? Like in the Scripts, Tutorials and tools section? I'm not sure on the etiquette of that on here.

    Thanks again to everyone, I couldn't have done this without your great suggestions!
     
    Last edited:
    153
    Posts
    4
    Years
    • Seen Feb 4, 2020
    Wow so happy for you man!

    Your investment really brought many people on this thread and it was really nice to see.
    I can't try the all thing now but I added it to my script and will let you know when I take the time to draw my own map.

    You can definitely create a script section where you copy your above message and add some pictures to show the result.

    Again congrats
     
    Back
    Top