Kicking the World Clock when it Stops
This scripting forum is to discuss scripting and for those needing help scripting to get help from others.

Moderators: Mermut, rdjparadis

Post Reply
User avatar
Winterhawk99
Posts: 1442
Joined: Thu Oct 08, 2009 12:00 am
ctp: Yes
nwnihof: Yes
Location: Pa.
Contact:

Kicking the World Clock when it Stops

Post by Winterhawk99 »

I wanted to put this function in for some time. It's a very simple function for a pw problem.

When you build a Pw you quickly find out that after you make about 350 to 400 areas that the clock tends to stop after your world has been up for awhile. This will cause great problems for casters that want to rest and get their spells back. That is because spell regeneration is attached directly to the world clock. I'm sure there have been a lot of fixes from many pws so if you already have something like this ignore it. It may not be the best solution.

This function is called Semi-Beat. What it does is check every 10 minutes to see if the clock as stopped and if so gives it a kick in the butt. So it doesn't make the clock start all the way to the beginning but instead nudges to start where it left off. You put the function within the On_Mod_Load script.

Here is my On_Load_Mod script for Harvest Moon. You can see the whole function and how to use it. Notice that it is a heartbeat like function so fires every ten minutes. It is a small function so should not add too much load to your module.

Code: Select all

void SemiBeat();
void main()
{
SetLocalString(GetModule(),"EPICCOORDINATOR","Winterhawk1");
DelayCommand(0.1,ExecuteScript("24_spell_modload",OBJECT_SELF));
DelayCommand(1.0,ExecuteScript("24_act_encounter",OBJECT_SELF));
DelayCommand(1.2,ExecuteScript("lds_module_load", GetModule()));
// Set Module Switches
SetModuleSwitch (MODULE_SWITCH_ENABLE_UMD_SCROLLS, TRUE);
SetModuleSwitch (MODULE_SWITCH_AOE_HURT_NEUTRAL_NPCS, TRUE);
SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, TRUE);
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
SetMaxHenchmen(5);
/* Initilize APS/NWNX ODBC connection */
SQLInit();
// Semi-Beat that runs every 10 minutes
// Currently it only manually sets the time gets tired
DelayCommand(600.0, SemiBeat());
}
void SemiBeat()
{
int iHour = GetTimeHour();
int iMilli = GetTimeMillisecond();
int iMinute = GetTimeMinute();
int iSecond = GetTimeSecond();
SetTime(iHour, iMinute, iSecond, iMilli);
DelayCommand(600.0, SemiBeat());
}
CTP team member
http://www.harvestmoonconsortium.com
Chief cook and bottle washer for Harvest Moon

Post Reply