• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Possibile to change day/night ?

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
425
Solutions
1
Reaction score
44
Hello!
Possibile to create commands who change day or night on Tibia ?
OR
How to change in sources day light to low?
 
setWorldLight(level, color)

Check this file ;)

config.lua
Lua:
-- World Light
-- NOTE: if defaultWorldLight is set to true the world light algorithm will
-- be handled in the sources. set it to false to avoid conflicts if you wish
-- to make use of the function setWorldLight(level, color)
defaultWorldLight = false
 
setWorldLight(level, color)

Check this file ;)

config.lua
Lua:
-- World Light
-- NOTE: if defaultWorldLight is set to true the world light algorithm will
-- be handled in the sources. set it to false to avoid conflicts if you wish
-- to make use of the function setWorldLight(level, color)
defaultWorldLight = false

I can add this on login.lua on creaturescripts? And how to set dark on game?
 
I can add this on login.lua on creaturescripts? And how to set dark on game?
Since this function affects everyone, it doesn't make sense to call it every time a player starts a section.

the best place is in a globalevent, like for example onStartup or some repeating event with which you can control the time manually.

You must remember that if you disable the defaultWorldLight, then the day and night cycle will no longer happen, you will have to create your own time system
 
Since this function affects everyone, it doesn't make sense to call it every time a player starts a section.

the best place is in a globalevent, like for example onStartup or some repeating event with which you can control the time manually.

You must remember that if you disable the defaultWorldLight, then the day and night cycle will no longer happen, you will have to create your own time system

Hi! Thank you for this lesson! I use this onStartUp.
He does not need his time, he wants to have constant light throughout the game at, for example, 60%.
I don't want the day to be like this all the time.
tell me how to do it?
 
Hi! Thank you for this lesson! I use this onStartUp.
He does not need his time, he wants to have constant light throughout the game at, for example, 60%.
I don't want the day to be like this all the time.
tell me how to do it?
Who's he? Is he with us right now? ;)
Because I don't get it at all, so it has to be constant 60% of light but at the other hand not all the time :eek:
So maybe you want to reduce max brightness with keeping day-night cycle?
 
Who's he? Is he with us right now? ;)
Because I don't get it at all, so it has to be constant 60% of light but at the other hand not all the time :eek:
So maybe you want to reduce max brightness with keeping day-night cycle?

Mainly I mean that the day gives less light, or that it is constant, but not as bright as in full day.
 
Okay I guess that part is hardcoded:
C++:
static constexpr uint8_t LIGHT_DAY = 250;
static constexpr uint8_t LIGHT_NIGHT = 40;


Or you could do it on your own with custom day/night cycle implementation as @Sarah Wesker suggested

But at the beginning you said you want a command (I suppose for admin)
Thank you very much!
Post automatically merged:

Okay I guess that part is hardcoded:
C++:
static constexpr uint8_t LIGHT_DAY = 250;
static constexpr uint8_t LIGHT_NIGHT = 40;


Or you could do it on your own with custom day/night cycle implementation as @Sarah Wesker suggested

But at the beginning you said you want a command (I suppose for admin)

How to change light on undeground?
I can on client set 100% light but i need all time dark on undeground.
Sorry for my eng.
Post automatically merged:

setWorldLight(level, color)

Check this file ;)

config.lua
Lua:
-- World Light
-- NOTE: if defaultWorldLight is set to true the world light algorithm will
-- be handled in the sources. set it to false to avoid conflicts if you wish
-- to make use of the function setWorldLight(level, color)
defaultWorldLight = false
I don't see this function on compat.lua.
On config.lua can change to false.
 
Last edited:
Since this function affects everyone, it doesn't make sense to call it every time a player starts a section.

the best place is in a globalevent, like for example onStartup or some repeating event with which you can control the time manually.

You must remember that if you disable the defaultWorldLight, then the day and night cycle will no longer happen, you will have to create your own time system

Hi!
I found this on game.h.

C++:
static constexpr uint8_t LIGHT_DAY = 40;
    static constexpr uint8_t LIGHT_NIGHT = 40;
    // 1h realtime = 1day worldtime
    // 2.5s realtime = 1min worldtime
    // worldTime is calculated in minutes
    static constexpr int16_t GAME_SUNRISE = 360;
    static constexpr int16_t GAME_DAYTIME = 480;
    static constexpr int16_t GAME_SUNSET = 1080;
    static constexpr int16_t GAME_NIGHTTIME = 1200;
    static constexpr float LIGHT_CHANGE_SUNRISE =
        static_cast<int>(float(float(LIGHT_DAY - LIGHT_NIGHT) / float(GAME_DAYTIME - GAME_SUNRISE)) * 100) / 100.0f;
    static constexpr float LIGHT_CHANGE_SUNSET =
        static_cast<int>(float(float(LIGHT_DAY - LIGHT_NIGHT) / float(GAME_NIGHTTIME - GAME_SUNSET)) * 100) / 100.0f;

    uint8_t lightLevel = LIGHT_DAY;
    uint8_t lightColor = 215;
    int16_t worldTime = 0;

What to change to make it night or sunset all the time.
Alternatively, to make the day very short, the east also short.
East longer and night the longest?
 
Last edited:
C++:
    static constexpr int16_t GAME_SUNRISE = 360;
    static constexpr int16_t GAME_DAYTIME = 480;
    static constexpr int16_t GAME_SUNSET = 1080;
    static constexpr int16_t GAME_NIGHTTIME = 1200;
These are the values for the times when sunrise, day, sunset and night occur in Tibia. You can also edit this function forgottenserver/src/game.cpp at master · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/master/src/game.cpp#L4895) and remove some lines for sunrise and day.

@0lo @lursky @Sarah Wesker
Okay I understand everything.
But why when I move the bar in OT Client light level to 100% it still gets 250 daylight and not for example 70 as I set?
In addition, the same applies to level -8 and lower there as the bar in the client is set to max the light is not at all less than without changes in sources.
 
Last edited:
Back
Top