Normally, in SP modules, I index the game clock 8 hours when the player rests. I am currently looking at implementing this in my Lan PW.
I had a conversation with someone last fall (maybe @Shadooow ) and he gave me this function to Set the campaign time in the OnclientEnter.
void SetCampaignTime()
{
int nDate = GetCampaignInt("NWR_SERVER","TIME");
if(nDate > 0)
{
int nYear = (nDate/8064)+START_YEAR;
int nMonth = (nDate%8064)/672+1;
int nDay = (nDate%672)/24+1;
int nHour = nDate%24;
// WriteTimestampedLogEntry("Y M D H "+IntToString(nYear)+" "+IntToString(nMonth)+" "+IntToString(nDay)+" "+IntToString(nHour));
SetTime(nHour,0,0,0);
SetCalendar(nYear,nMonth,nDay);
}
}
void SaveModuleTimePseudoHB()
{
if(GetFirstPC() != OBJECT_INVALID || STORE_TIME_EVEN_IF_THERE_ARE_NO_PLAYERS)
{
SetCampaignInt("NWR_SERVER","TIME",GetTimeHour()+(GetCalendarDay()-1)*24+(GetCalendarMonth()-1)*672+(GetCalendarYear()-START_YEAR)*8064);
}
DelayCommand(HoursToSeconds(1), SaveModuleTimePseudoHB());
}
I have this block of code I got years ago that I use to index the game clock.
void rs_IndexGameClock(int nHr = 0, int nMin = 0, int nSec = 0, int nMil =0)
{
int nHour = GetTimeHour() + nHr;
int nMinute = GetTimeMinute() + nMin;
int nSecond = GetTimeSecond() + nSec;
int nMillisecond = GetTimeMillisecond() + nMil;
SetTime(nHour, nMinute, nSecond, nMillisecond);
}
Do I need to do something with the stored value for the Campaign Time, or will my current method of indexing persist through a server reset?