• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • 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.

Swapping tilesets based on the time of day

Skystrike

[i]As old as time itself.[/i]
  • 1,640
    Posts
    16
    Years
    The title says it all: is there a way to swap tilesets based on the time of day ala Pokemon Gold, Silver and Crystal? It is a very cool effect.


    For example: I draw the map using a tileset (externally) called "Outside.png". Something could modify it upon loading the map or something to make it load "Night_Outside.png" if it's nightime.

    I might be overcomplicating it though.
     
    Change the lines at Game_Map_ and PokemonMap 'tileset=$data_tilesets[@map.tileset_id]' to 'tileset=$data_tilesets[getTilesetID(@map.tileset_id)]'. Change the line at PerspectiveTilemap: 'tileset=$data_tilesets[map.tileset_id]' to 'tileset=$data_tilesets[getTilesetID(map.tileset_id)]'. In PokemonMap, before line 'class Game_Map' add:

    Code:
    TIMESENSITIVETILESETS = {
      20 => 19
      23 => 21
    }
    
    def getTilesetID(id)
      if(TIMESENSITIVETILESETS.include?(id) && PBDayNight.isNight?(pbGetTimeNow))
        return TIMESENSITIVETILESETS[id]
      else
        return id
      end
    end
    In this example, if the tileset ID is 20 and is night, the tileset with ID 19 is loaded, same with ID 23 (to 21). Totally untested.

    EDIT: I can made the way that you suggested (using tileset_name), but this needs additional cheking for autotiles.
     
    Last edited:
    Oooooh, this is what I am looking for as well. So it grabs the IDs from the tileset list in the Database, right?

    Could you write up something for when it is Morning Afternoon and Evening? Switches 16, 17, and 18. So, for instance, It would grab tileset 12 on Morning, 13 in Afternoon and 14 in Evening. Autotiles would be the same on each one, so that wouldn't be an issue.
     
    Oooooh, this is what I am looking for as well. So it grabs the IDs from the tileset list in the Database, right?

    Could you write up something for when it is Morning Afternoon and Evening? Switches 16, 17, and 18. So, for instance, It would grab tileset 12 on Morning, 13 in Afternoon and 14 in Evening. Autotiles would be the same on each one, so that wouldn't be an issue.

    Lets say your base tile is your afternoon tile.

    Code:
    TIMESENSITIVETILESETSMORN = {
      13 => 12
    }
    TIMESENSITIVETILESETSEVENING = {
      13 => 14
    }
    
    def getTilesetID(id)
      if(TIMESENSITIVETILESETSMORN.include?(id) && PBDayNight.isMorning?(pbGetTimeNow))
        return TIMESENSITIVETILESETSMORN[id]
    elsif (TIMESENSITIVETILESETSEVENING.include?(id) && PBDayNight.isEvening?(pbGetTimeNow))
        return TIMESENSITIVETILESETSEVENING[id]
     else
        return id
      end
    end

    If it is neither Morning nor Evening, it will return your afternoon tileset (13).
     
    Change the lines at Game_Map_ and PokemonMap 'tileset=$data_tilesets[@map.tileset_id]' to 'tileset=$data_tilesets[getTilesetID(@map.tileset_id)]'. Change the line at PerspectiveTilemap: 'tileset=$data_tilesets[map.tileset_id]' to 'tileset=$data_tilesets[getTilesetID(map.tileset_id)]'. In PokemonMap, before line 'class Game_Map' add:

    So I just follow these directions but add the code you gave me, mej71?
     
    Thanks again!!! I almost forgot about this(so many things to update and do lol). Now that I have a coder and have been adding more features, I'll have to look into adding this as well soon :D
     
    Back
    Top