View Single Post
  #4  
Old 08-17-2010, 12:41 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

Here is a script I use for similar situations that doesnt require globals. This assumes that you want the NPCs to respawn when the last is dead(regardless of kill credit), however the mobs can still respawn normally as well.

You would have an invis controller NPC with this script...

Code:
sub EVENT_SPAWN
{
	quest::settimer("start", 6);
}

sub EVENT_TIMER
{
	if ($timer eq "start") {
		quest::stoptimer("start");
		my $counter = 0;
		## Get all NPCs in zone
		my @npcList = $entity_list->GetNPCList();
		foreach $npcs(@npcList) {
			## NPC ID you want to be all dead
			if($npcs->GetNPCTypeID() == 999999) {
				$counter = 1;
			}
		}
		if($counter == 0) {
			## NPCs to respawn
			quest::spawn2(888888,0,0,x,y,z,h);
			quest::spawn2(888888,0,0,x,y,z,h);
			quest::spawn2(888888,0,0,x,y,z,h);
			quest::spawn2(888888,0,0,x,y,z,h);
		}
		quest::settimer("start", 6);
	}
}
Reply With Quote