Closed MetalES closed 7 years ago
Great - thanks for the tips! I tested those changes and everything works, plus the tone transitions much better. It looks (even more) awesome!
@MetalES Any more to this one, or shall I close it?
I'm stil testing the project to see if there are some bugs within this script, but it seems that there are no more bugs, so you can close it, if I find something else i'll open another issue
Ok now try to wait sunset and go to other maps, does the tone counter restart ? I am testing things and I see that between maps the tone isn't saved, you must call on_tone_system_saving() when you change a map to parse the real current tone, else it wil get the value from creation time
I believe that is the case - I've noticed when changing maps there can be a sudden change in tone. Do you happen to know where that call would be added?
This is what I did in your tone_maager:on_map_changed()
if game:get_map() ~= nil then
local map = game:get_map()
game:on_tone_system_saving()
local previous_time_system = time_system
time_system = game:is_in_outside_world() or (map:get_id() == "20" or map:get_id() == "21" or map:get_id() == "22")
if time_system ~= previous_time_system then mr = nil end
cr, cg, cb = game:get_value("cr"), game:get_value("cg"), game:get_value("cb")
tr, tg, tb = game:get_value("tr"), game:get_value("tg"), game:get_value("tb")
-- Make map tone stick for this map and only this one.
mr, mg, mb, ma = game:get_value("mr"), game:get_value("mg"), game:get_value("mb"), game:get_value("ma")
game:set_value("mr", nil); game:set_value("mg", nil); game:set_value("mb", nil); game:set_value("ma", nil)
if cr == nil then game:set_value("cr", 255); cr = 255 end
if cg == nil then game:set_value("cg", 255); cg = 255 end
if cb == nil then game:set_value("cb", 255); cb = 255 end
if tr == nil then game:set_value("tr", 255); tr = 255 end
if tg == nil then game:set_value("tg", 255); tg = 255 end
if tb == nil then game:set_value("tb", 255); tb = 255 end
self:get_new_tone()
self:check()
end
Yet, there is a glitch, sometimes, the tone would cease to update, might be related to your code
Wait until I fix all problems in your project, it seems there are more than I expected So far, I see all inconstencies listed bellow
I see that you reworked the day night system I use. Let me help you to make the script to work properly
in the check() function
Do not use game:set_time(game:get_value()). Increment the hour using game:set_value(game:get_value()) and reset the minute variable from here, when you call set_time(), you are setting the next cycle's tone, it is useful for time passing event (sleeping, etc), not to increment the hour in the normal way, so this is immediate, not progressive.
so in the set_time finction, you can delete if hour == 24 then hour = 0 end
in the get_new_tone() function
if you plan to use a different time flow, then the d variable need to have a algorythm that include game.time_flow, if you use the same time flow during the whole game, just do
d = 1800 Also, if you don't use a weather system, you can delete game.raining
and not self.d, it doesn't exist