• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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.

[Scripting Question] How do you change The Overworld's Loaded TileSets via Script?

  • 413
    Posts
    5
    Years
    Remember how the Sinnoh Underground mirrored the overworld? I had this idea for a "Dimension Changer" Key Item that changes the TileSet of all overworld maps when activated, making them all load TileSet Number 69. Use the item again, and it switches back to TileSet 25.

    Is this possible in the Pokemon Essentials Engine? I know I can alter a switch to make normal NPCs invisible and load in NPCs who are only supposed to show up in the changed dimension. That part's already working in my game. But dynamically changing tileset on the fly via script... I don't know if that's possible. Is it possible?

    Or would I need to make a separate copypaste of the entire game's region with the tileset changed, and change the Dimension Changer to an overworld object in each Pokemon Center that will warp you between the main world and tileset-changed world?
     
    Short answer is yes. In the script section called Game_Map, theres a portion that looks like this (should be around line 45):
    Code:
    def setup(map_id)
        @map_id = map_id
        @map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
        tileset = $data_tilesets[@map.tileset_id]
        updateTileset

    Add a couple lines to the script to make it look like this:

    Code:
    def setup(map_id)
        @map_id = map_id
        @map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
        tileset = $data_tilesets[@map.tileset_id]
        if $game_switches[65] && @map.tileset_id = 1
         then @map.tileset_id = 3
        end
        updateTileset

    The first map id is the original tileset, while the second is the new one, and the switch can be any switch you want.


    The long answer is that this is both difficult and finicky to make work. First off, the code I wrote doesn't automatically update the map you are on, so the thing that triggers the switch should be somewhere that doesn't change (like inside a building or wherever). You could possibly find a way to make it refresh the tileset you are standing on, but I don't know what the command would be.
    Second, when you change tilesets, you have to have every single tile in use and its counterpart on the same spot on the tileset. In my opinion, the easiest way to do that would be to start with a copy of the original tileset, then replace each tile out with its counterpart. This would guarantee that the tiles are in the correct spot when it switches.
     
    Back
    Top