Hello, I want to use it. It didn't need a sunrise light but it's even better like that. Im not sure how to use it, besides importing the script
Hi Imc7r,
I would recommend you to take a look at the demo game to see how the module can be used.
do I need to add this piece of code below to the global script like when the game starts or where?
// Setup/start
{
DayNight.SetTime(1, 4, 55);
DayNight.SetTimeSpeed(40);
DayNight.SetTimeRunning(true);
}
Yes, you need something like that to initialize the module. Whether it should be in game_start() really depends on your game. Probably in most cases you wouldn't actually start the clock until some specific point in the game (e.g. after an intro cutscene), so that's where you should call SetTimeRunning().
And speaking of the night, I tested in GIMP, basically a RGB 0,0,16 is the darkness I need where I can change opacity to 75 of 100, the Tint Screen code that makes it like that only allows 50% and that's not enough to make dark enough. So which one should I change to achieve the 75 of 100 effect?
There are a few different ways to create a night effect (tinting, overlays, palette effects, alternate backgrounds...). The demo game just uses the simplest possible one: an overlay (in the form of a full-screen, non-clickable GUI). In your case, I would create an image the size of your game resolution, fill it with 0,0,16 blue, and import it into AGS as a sprite. Create a GUI called gNightOverlay. Make it the size of your screen with x,y coordinates 0,0. Set it to non-clickable and its background to that sprite.
Once you've done that, you just need to display the GUI at 75% opacity when it's night, which...
Do I need to add this code and where:
// Add an overlay to make the screen darker at night
{
DayNight_TimeOfDay timeOfDay = DayNight.GetTimeOfDay();
if(timeOfDay == DayNight_Night)
{
gNightOverlay.Visible = true;
}
}
Yes. You also need to add a line
gNightOverlay.Transparency = 25; so that it's at 75% opacity. I would probably make a function for it, say
drawNightOverlay(), and call it from repeatedly_execute_always(). That's how it's done in the demo game.
Once you've got that working, you can take a look at the drawNightOverlay() function there (it's in the GlobalScript) to see how you can also fade the darkness in and out during evening and morning. But I would take it one step at a time. If you can make it be dark at night and light during the day, that's a great first step.
If you have trouble defining and calling functions, I recommend you go through the tutorial and intro to scripting in the manual. Good luck!