Here's what I was able to come up with using Knightly's '$zonetime' and Derision's 'zone->GetTimeSync();' fix.
This is the most effective and less intrusive way to spawn the day/night NPCs. This originally was Qadar's idea (use EVENT_WAYPOINT), while we were working on the boat system, I just ported it over to the day/night spawns.
You need one npc, preferably invisible , untrackable, etc. and you need to assign him two waypoints at the same spawnpoint. Example: Lets say I spawned my LakeRathe NPC at 0,0,0 (X,Y,Z); I then make two more grid/waypoints at the same 0,0,0 ( no need to make it move around, it will still move from WP to WP), and give each WP a pausetime of 45. Then comes the script, which I see is different from Knightlys, but probably arrives at the same conclusion , if you just change EVENT_ENTER or EXIT to EVENT_WAYPOINT.
Code:
#lakerathe night and day spawns
#Angelox
sub EVENT_WAYPOINT{
if (($zonetime >= 0)&&($zonetime <= 800)){ #nighttime
quest::spawn_condition(lakerathe, 2,0); #live are 2
quest::spawn_condition(lakerathe, 1,1);} #undead are 1
elsif (($zonetime >= 2000)&&($zonetime <= 2359)){ #nighttime
quest::spawn_condition(lakerathe, 2,0); #live are 2
quest::spawn_condition(lakerathe, 1,1);} #undead are 1
else{ #daytime
quest::spawn_condition(lakerathe,2,1);
quest::spawn_condition(lakerathe,1,0);}}
## End spawn Script
Now, the only way this truly works is if you follow Derisions simple instructions for the 'zone->GetTimeSync();' fix, and add the insert - once the insert is in, there will be no need for time syncs, timers, or anything else. All zones will have the same time exactly: static or dynamic. The only thing I saw was, my server will start up at 4:00am instead of the original 8:00am (EQ Time), which is no big deal because it continues on to cycle the 24 hours in all zones.
Here's a pointer on using EVENT_WAYPOINT (Something we figured out while doing the boat work); Although the zone may be static, Perl scripts will not work, unless a PC is there (in the zone) too - This was a big problem with the boats, but solved.
Now that I think of it, I see where I can throw in an EVENT_SPAWN to the above script and that will easily fix any waypoint delays when you first zone in.
This will be the next script to try out;
Code:
#lakerathe night and day spawns
#Angelox
sub EVENT_SPAWN{
if (($zonetime >= 0)&&($zonetime <= 800)){ #nighttime
quest::spawn_condition(lakerathe, 2,0); #live are 2
quest::spawn_condition(lakerathe, 1,1);} #undead are 1
elsif (($zonetime >= 2000)&&($zonetime <= 2359)){ #nighttime
quest::spawn_condition(lakerathe, 2,0); #live are 2
quest::spawn_condition(lakerathe, 1,1);} #undead are 1
else{ #daytime
quest::spawn_condition(lakerathe,2,1);
quest::spawn_condition(lakerathe,1,0);}}
sub EVENT_WAYPOINT{
if (($zonetime >= 0)&&($zonetime <= 800)){ #nighttime
quest::spawn_condition(lakerathe, 2,0); #live are 2
quest::spawn_condition(lakerathe, 1,1);} #undead are 1
elsif (($zonetime >= 2000)&&($zonetime <= 2359)){ #nighttime
quest::spawn_condition(lakerathe, 2,0); #live are 2
quest::spawn_condition(lakerathe, 1,1);} #undead are 1
else{ #daytime
quest::spawn_condition(lakerathe,2,1);
quest::spawn_condition(lakerathe,1,0);}}
## End spawn Script
EVENT_SPAWN will instantly set the right spawn when you Zone in, and EVENT_WAYPOINT will keep checks on what mob should be up.
If you use the same NPC i placed for day/night, you only need but one of these spawns attached to the above PL per zone, so you can delete all the other ones, where I used proximity - this should be easy, as I always 'hand spawn' my NPCs under the same spawngroup. In places like Kithicor and Commons, I had put in numerous spawns.