how can i make auto change day and night when character login

Yes, it's possible. Take a look at these script commands:

*day;*night;These two commands will switch the entire server between day and night moderespectively. If your server is set to cycle between day and night byconfiguration, it will eventually return to that cycle.Example:- script DayNight -1,{OnClock0600: day; end;OnInit: // setting correct mode upon server start-up if(gettime(3)>=6 && gettime(3)<18) end;OnClock1800: night; end;}This script allows to emulate the day/night cycle as the server does, but alsoallows triggering additional effects upon change, like announces, gifts, etc.The day/night cycle set by configuration should be disabled when this script is used.
 
Your script would be like this one (change Name_of_the_character to the name of the character you want this script to run with):

- script nightanday -1,{OnPCLoginEvent: if(strcharinfo(0) == "Name_of_the_character") night; end;OnPCLogoutEvent: if(strcharinfo(0) == "Name_of_the_character") day; end;}

Remember to disable the day and night cycle on your conf/battle/misc.conf file to make this work properly:

// Choose if server begin with night (yes) or day (no)night_at_start: no// Define duration in msec of the day (default: 7200000 = 2 hours)// Set to 0 to disable day cycle (but not @day GM command).// Except 0, minimum is 60000 (1 minute)day_duration: 0// Define duration in msec of the night (default: 1800000 = 30 min)// Set to 0 to disable night cycle (but not @night GM command).// Except 0, minimum is 60000 (1 minute)night_duration: 0
This basic script should work with these configurations. Any further modifications are up to you.

 
Back
Top