View Single Post
  #13  
Old 04-03-2010, 06:11 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, it is completely possible, if you know the formation you want them in. Here is a snippet of a script I made that does just that and has 4 NPCs that follow surrounding the boss mob this script is on:

Code:
#Random Roamer Group Script

my $SpawnDist = 10;

#Save NPC Entity IDs here (4 total)
my $NPCPlusX = 0;
my $NPCMinusX = 0;
my $NPCPlusY = 0;
my $NPCMinusY = 0;

sub EVENT_SPAWN {

	my $StartMove = plugin::RandomRange(10, 30);
	quest::settimer("roam", $StartMove);
	quest::settimer("spawn_guards", 5);
	
}

sub EVENT_TIMER {

	if ($timer eq "roam") {
		quest::stoptimer("roam");
		plugin::RandomRoam(100,100);
		my $GuardX = $npc->GetGuardPointX();
		my $GuardY = $npc->GetGuardPointY();
		my $GuardZ = $npc->GetGuardPointZ();
		my $NPC1 = $entity_list->GetNPCByID($NPCPlusX);
		my $NPC2 = $entity_list->GetNPCByID($NPCMinusX);
		my $NPC3 = $entity_list->GetNPCByID($NPCPlusY);
		my $NPC4 = $entity_list->GetNPCByID($NPCMinusY);
		
		if ($NPC1) {
			$NPC1->MoveTo($GuardX + $SpawnDist, $GuardY, $GuardZ, 0, 1);
		}
		if ($NPC2) {
			$NPC2->MoveTo($GuardX - $SpawnDist, $GuardY, $GuardZ, 0, 1);
		}
		if ($NPC3) {
			$NPC3->MoveTo($GuardX, $GuardY + $SpawnDist, $GuardZ, 0, 1);
		}
		if ($NPC4) {
			$NPC4->MoveTo($GuardX, $GuardY - $SpawnDist, $GuardZ, 0, 1);
		}
		my $NextMove = plugin::RandomRange(5, 30);
		quest::settimer("roam", $NextMove);
	}
	
	if ($timer eq "spawn_guards") {
		quest::stoptimer("spawn_guards");
		my $MyX = $npc->GetSpawnPointX();
		my $MyY = $npc->GetSpawnPointY();
		my $MyZ = $npc->GetSpawnPointZ();
		quest::spawn(2701558,0,0,$MyX + $SpawnDist, $MyY, $MyZ);	#NPCPlusX
		quest::spawn(2701558,0,0,$MyX - $SpawnDist, $MyY, $MyZ);	#NPCMinusX
		quest::spawn(2701558,0,0,$MyX, $MyY + $SpawnDist, $MyZ);	#NPCPlusY
		quest::spawn(2701558,0,0,$MyX, $MyY - $SpawnDist, $MyZ);	#NPCMinusY
		quest::settimer("SetNPCVars", 2);
	}
	
	if ($timer eq "SetNPCVars") {
		quest::stoptimer("SetNPCVars");
		my $MySpawnedX = $npc->GetSpawnPointX();
		my $MySpawnedY = $npc->GetSpawnPointY();

		my @npclist = $entity_list->GetNPCList();
		foreach $ent (@npclist)
		{
			if($ent->GetNPCTypeID() == 2701558) {
				my $GuardianX = $ent->GetX();
				my $GuardianY = $ent->GetY();
				
				if($GuardianX > $MySpawnedX + $SpawnDist - 2) {
					$NPCPlusX = $ent->GetID();
				}
				if($GuardianX < $MySpawnedX - $SpawnDist + 2) {
					$NPCMinusX = $ent->GetID();
				}
				if($GuardianY > $MySpawnedY + $SpawnDist - 2) {
					$NPCPlusY = $ent->GetID();
				}
				if($GuardianY < $MySpawnedY - $SpawnDist + 2) {
					$NPCMinusY = $ent->GetID();
				}
			}
		}
	}

}
There is actually a lot more to my script, but not directly related to moving a group of mobs. This script here should give you the basic idea of what to do.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote