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

Maybe a nice addition

Oxious

Amateur Mapper & Scripter
Joined
Jan 25, 2009
Messages
89
Reaction score
0
Location
Germany
Greetings :)

What about making a the day-night cycle configurable in the config.lua?

You would be able to set intervals of the cycle and intensity of darkness. It would easily allow people to create the day/night cycle they want, optimized on their server theme.
I could imagine an RPG server would be much better with adjusted values.

To think the idea even further, you could maybe add lua functions that let you set the light strenght for a player in a certain area. That way you could for instance make a graveyard area have less sunlight than other areas.

This could really improve rpg abilities for a server.

What do you think? :blink:
 
Would be great.
Or even on future map editors, maybe some 'Light Area' and 'Dark Area' zone :D
I don't think they will implement it, but would be great!

\\
 
Last edited:
I've not yet seen a single OT distro with an adjustable day-night-cycle so you could set an example here.

I don't know much about coding but I think with all the other things configurable in config.lua adding the day-night-cycle shouldn't be that hard. ^^
 
I've not yet seen a single OT distro with an adjustable day-night-cycle so you could set an example here.

I don't know much about coding but I think with all the other things configurable in config.lua adding the day-night-cycle shouldn't be that hard. ^^

it wouldn't be hard at all, just changing the config files and i believe its game.cpp/h
 
game.cpp:
Code:
	lightHourDelta = 1440 * 10 / 3600;
	lightHour = SUNRISE + (SUNSET - SUNRISE) / 2;
	lightLevel = LIGHT_LEVEL_DAY;
	lightState = LIGHT_STATE_DAY;

Code:
void Game::checkLight()
{
	Scheduler::getScheduler().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>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it)
			(*it).second->sendWorldLight(lightInfo);
	}
}

Have fun playing around 8D
 
To think the idea even further, you could maybe add lua functions that let you set the light strenght for a player in a certain area. That way you could for instance make a graveyard area have less sunlight than other areas.

Nice idea!
It will be really good for some rpg servers.
 
They should implement on OTBM v4 this Dark or Light area, like, temples and churches would be light areas, and graveyards or 'dark' places would be darker :p

\\
 
I don't know enough about C coding and compiling to do it myself, Rudolf.
 
This would create dark and light areas, like, during midday, dark areas would like night, and during night, light areas would look like day, got it? :p

\\
 
Like I explained before. During daytime you could create dark lighted areas (like a undead forest or a cemetery).

The basic idea, though, was to make it possible to adjust day-night-cycle settings in the config.lua file.
 
Back
Top