• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Windows Map light

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
hello as we know on tibia is day and night .

but on my server there is mostly night...

is there any way i can change that map stays on day or something like that ?

bumpz please help

Please help with it :(
 
Last edited by a moderator:
There is a enum in Game.h
Code:
enum LightState_t
{
    LIGHT_STATE_DAY,
    LIGHT_STATE_NIGHT,
    LIGHT_STATE_SUNSET,
    LIGHT_STATE_SUNRISE
};


And then in game.cpp
Code:
void Game::checkLight()
{
    Scheduler::getInstance().addEvent(createSchedulerTask(EVENT_LIGHTINTERVAL,
        boost::bind(&Game::checkLight, this)));

    lightHour = lightHour + lightHourDelta;
    if(lightHour > 1440)
        lightHour = lightHour - 1440;

    if(std::abs(lightHour - SUNRISE) < 2 * lightHourDelta)
        lightState = LIGHT_STATE_SUNRISE;
    else if(std::abs(lightHour - SUNSET) < 2 * lightHourDelta)
        lightState = LIGHT_STATE_SUNSET;

    int32_t newLightLevel = lightLevel;
    bool lightChange = false;
    switch(lightState)
    {
        case LIGHT_STATE_SUNRISE:
        {
            newLightLevel += (LIGHT_LEVEL_DAY - LIGHT_LEVEL_NIGHT) / 30;
            lightChange = true;
            break;
        }
        case LIGHT_STATE_SUNSET:
        {
            newLightLevel -= (LIGHT_LEVEL_DAY - LIGHT_LEVEL_NIGHT) / 30;
            lightChange = true;
            break;
        }
        default:
            break;
    }

    if(newLightLevel <= LIGHT_LEVEL_NIGHT)
    {
        lightLevel = LIGHT_LEVEL_NIGHT;
        lightState = LIGHT_STATE_NIGHT;
    }
    else if(newLightLevel >= LIGHT_LEVEL_DAY)
    {
        lightLevel = LIGHT_LEVEL_DAY;
        lightState = LIGHT_STATE_DAY;
    }
    else
        lightLevel = newLightLevel;

    if(lightChange)
    {
        LightInfo lightInfo;
        getWorldLightInfo(lightInfo);
        for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
            it->second->sendWorldLight(lightInfo);
    }
}


If you undersstand code this will be easy for you to edit.

If not, just change the lightState = something to LIGHT_STATE_DAY. I'm actually not sure about this so do it with care haha
 
Can't everyone just turn Ambient Light to 100% on their client?

Lighting hasn't been an issue for a LONG time on tibia.

If you honestly want it 100% light at all times for everyone then just change this:

game.cpp
Code:
void Game::getWorldLightInfo(LightInfo& lightInfo)
{
lightInfo.level = lightLevel;
 lightInfo.color = lightColor;
}

to this

Code:
void Game::getWorldLightInfo(LightInfo& lightInfo)
{
lightInfo.level = 245;
 lightInfo.color = 215;
}
 
Last edited:
Back
Top