View Single Post
  #4  
Old 01-15-2008, 11:26 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

That script you are looking at does two things: spawns night or day creatures and sets the zone time. The full 20250.pl script is broken in three parts;EVENT_SPAWN- set time on zone boot/spawn, and spawn the proper NPCs . Next, I had set invisible "Watcher" NPC's in key areas around the zone that check $shifter when there's PC movement (EVENT_ENTER and EVENT_EXIT), they update what NPCs should be up.

What you have is very good and needed, my shifter scripts are sort of a hack to satisfy what I want. They work fine, but should be merged into the code.
I think for this, we need two things to work;

1st and most important> Time always be synchronized across the zones, even dynamic: when a dynamic zone loads and a static zone says it 1:00pm, then the dynamic zone needs to catch that and set the same time - there should be some sort of "main time" that starts at EQ8:00am on EqEmu boot up, regardless if we have statics or not. Another words, when a static loads, it looks at this "central time" and synchronizes with it. This way, if a zone reboots (static or not), it finds the proper time again. The shifter scripts already do this, but in a rather awkward way - so awkward to me (and I made them), I thought was too stupid to mention, so I kept it to myself tell Cavedude saw and liked.

2nd > "Central time" will always have a variable available for time checks via Perl scripts ($zonetime).

If you all could create a Central time that applies on zone boot up to any zone (dynamic or not), then all we would need for day and night creatures is something like you said;
Code:
if ($zonetime < 800 || $zonetime > 1999) {
	quest::spawn_condition(kithicor, 2,0); #live are 2
	quest::spawn_condition(kithicor, 1,1); #undead are 1
}
else {
	quest::spawn_condition(kithicor,2,1); #live are 2
	quest::spawn_condition(kithicor,1,0); #undead are 1
}
And even the above code could be debatable if needed; you could create a general setting in spawn2 table, that would define night or day npcs, and you know the rest.

Also, there's many more watchers across the zones - look in "server/quests/templates" there are the PoD and Nexus_Scion scripts which end in this;
Code:
# Night and Day checker
#Angelox's 
#This script will re-sync zone time 
sub EVENT_SPAWN { 
if ($shifter==20) {quest::settime(20,0);}
elsif ($shifter==21){quest::settime(21,0);}
elsif ($shifter==22){quest::settime(22,0);}
elsif ($shifter==23){quest::settime(23,0);}
elsif ($shifter==24){quest::settime(24,0);}
elsif ($shifter==1){quest::settime(1,0);}
elsif ($shifter==2){quest::settime(2,0);}
elsif ($shifter==3){quest::settime(3,0);}
elsif ($shifter==4){quest::settime(4,0);}
elsif ($shifter==5){quest::settime(5,0);}
elsif ($shifter==6){quest::settime(6,0);}
elsif ($shifter==7){quest::settime(7,0);}
elsif ($shifter==8){quest::settime(8,0);}
elsif ($shifter==9){quest::settime(9,0);}
elsif ($shifter==10){quest::settime(10,0);}
elsif ($shifter==11){quest::settime(11,0);}
elsif ($shifter==12){quest::settime(12,0);}
elsif ($shifter==13){quest::settime(13,0);}
elsif ($shifter==14){quest::settime(14,0);}
elsif ($shifter==15){quest::settime(15,0);}
elsif ($shifter==16){quest::settime(16,0);}
elsif ($shifter==17){quest::settime(17,0);}
elsif ($shifter==18){quest::settime(18,0);}
elsif ($shifter==19){quest::settime(19,0); }
}
This applies to any zone with a Nexus Scion or PoD.
Reply With Quote