- 24
- Posts
- 6
- Years
- Seen Jul 24, 2023
Hi all.
I've been trying to figure out how to switch tilesets based on the in-game time of day. Specifically, I'd like my maps to switch to a tileset at night where the windows are colored yellow, like in GSC.
What I've done is created a new tileset graphic that is the same as Outside, but with the windows yellow instead of blue. I wasn't having any luck getting it to switch tileset graphics based on time of day, so instead I am having it switch Tilesets (as in, the ones defined in the Data tab of RPGMXP)
In the Game_Map script section, I've altered the "tileset = $data_tilesets[@map.tileset_id]" line under def updateTileset to be the following:
This is working just fine. In the Data tab, Outside Night is Tileset #41, so when the player is on a map that uses Tileset #1 (Outside) and the time is correct, it switches to Tileset #41 and shows the nighttime tileset graphics associated with that Tileset.
Where I'm stuck is in trying to get it to only add 40 to the Tileset number when the player is on a map with tilesets so I don't have to make a separate "night" Tileset for everything (Inside, Pokecenter, etc). I've tried the following:
And it works fine. The issue is if I try to add anything in addition to 1 (@map.tileset_id == 1 || 10) it treats every single map as adding 40 to @map.tileset_id.
I hope this all made sense, if anyone has any ideas as to what's going wrong, or what I can do differently, I'd love to hear them.
I've been trying to figure out how to switch tilesets based on the in-game time of day. Specifically, I'd like my maps to switch to a tileset at night where the windows are colored yellow, like in GSC.
What I've done is created a new tileset graphic that is the same as Outside, but with the windows yellow instead of blue. I wasn't having any luck getting it to switch tileset graphics based on time of day, so instead I am having it switch Tilesets (as in, the ones defined in the Data tab of RPGMXP)
In the Game_Map script section, I've altered the "tileset = $data_tilesets[@map.tileset_id]" line under def updateTileset to be the following:
Code:
def updateTileset
if pbGetTimeNow.hour >= 20 || pbGetTimeNow.hour < 5
tileset = $data_tilesets[@map.tileset_id+40]
end
else
tileset = $data_tilesets[@map.tileset_id]
end
This is working just fine. In the Data tab, Outside Night is Tileset #41, so when the player is on a map that uses Tileset #1 (Outside) and the time is correct, it switches to Tileset #41 and shows the nighttime tileset graphics associated with that Tileset.
Where I'm stuck is in trying to get it to only add 40 to the Tileset number when the player is on a map with tilesets so I don't have to make a separate "night" Tileset for everything (Inside, Pokecenter, etc). I've tried the following:
Code:
def updateTileset
if @map.tileset_id == 1
if pbGetTimeNow.hour >= 20 || pbGetTimeNow.hour < 5
tileset = $data_tilesets[@map.tileset_id+40]
else
tileset = $data_tilesets[@map.tileset_id]
end
else
tileset = $data_tilesets[@map.tileset_id]
end
And it works fine. The issue is if I try to add anything in addition to 1 (@map.tileset_id == 1 || 10) it treats every single map as adding 40 to @map.tileset_id.
I hope this all made sense, if anyone has any ideas as to what's going wrong, or what I can do differently, I'd love to hear them.