• 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.

Swapping tilesets based on the time of day

Skystrike

[i]As old as time itself.[/i]
1,641
Posts
15
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.
     

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen May 16, 2024
    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:

    Ookiiushidesu

    Lead Mapper/Eventer at Gen0
    56
    Posts
    12
    Years
    • Age 33
    • Seen May 27, 2016
    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.
     
    1,224
    Posts
    10
    Years
  • 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).
     

    Ookiiushidesu

    Lead Mapper/Eventer at Gen0
    56
    Posts
    12
    Years
    • Age 33
    • Seen May 27, 2016
    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?
     

    Ookiiushidesu

    Lead Mapper/Eventer at Gen0
    56
    Posts
    12
    Years
    • Age 33
    • Seen May 27, 2016
    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