I remember reading a while back that people hadn't been able to get a few mobs to march in formation. Going to post a bit of code that you can tinker with to your own liking.
For mine, I have one mob in zone called Strike Commander, here is the code for him.
Code:
sub EVENT_SPAWN {
$targetid = 999666; # What NPCID we are sending the patrol at.
$minionid = 999671; # ID of the mob that follows the commander
}
sub EVENT_SAY {
my $summon = quest::saylink("summon");
my $attack = quest::saylink("attack");
if ($text =~ /Hail/i) {
quest::say("Greetings, $name. Shall I [$summon] my minions for you to command?");
}
if ($text =~ /summon/i) {
quest::depopall($minionid);
quest::spawn2($minionid,0,0,$x+5,$y,$z,$h);
quest::spawn2($minionid,0,0,$x+5,$y-10,$z,$h);
quest::spawn2($minionid,0,0,$x+5,$y+10,$z,$h);
quest::spawn2($minionid,0,0,$x+5,$y-5,$z,$h);
quest::spawn2($minionid,0,0,$x+5,$y+5,$z,$h);
quest::say("Minions spawned, shall we [$attack]?");
}
if ($text =~ /attack/i) {
quest::shout("FOR HONOR! MOVE OUT!");
quest::signalwith($minionid,$targetid);
my $x_loc = 0;
my $y_loc = 0;
my $z_loc = 0;
my $opponent = $entity_list->GetMobByNpcTypeID($targetid);
if($opponent)
{
$x_loc = $opponent->GetX();
$y_loc = $opponent->GetY();
$z_loc = $opponent->GetZ();
quest::moveto($x_loc,$y_loc,$z_loc);
}
}
}
sub EVENT_WAYPOINT_ARRIVE {
quest::attacknpctype($targetid);
}
Next, we have our minions. All we need is a DB entry for them, as there should be none of them in zone, we spawn them when we need them. Any more in zone would send them to the target as well. Here is the code for my Strike Warriors.
Code:
sub EVENT_SIGNAL {
### This block of code to get my difference in location from my commander
my $cid = 999670; ## Commander's ID
$x_dif = 0;
$y_dif = 0;
my $x = $npc->GetX();
my $y = $npc->GetY();
my $commander = $entity_list->GetMobByNpcTypeID($cid);
if($commander)
{
$x_dif = $commander->GetX();
$x_dif = $x - $x_dif;
$y_dif = $commander->GetY();
$y_dif = $y - $y_dif;
}
### This block of code to send me at the NPCID that was passed as $signal.
my $x_loc = 0;
my $y_loc = 0;
my $z_loc = 0;
my $opponent = $entity_list->GetMobByNpcTypeID($signal);
if($opponent)
{
$x_loc = $opponent->GetX();
$y_loc = $opponent->GetY();
$z_loc = $opponent->GetZ();
$x_loc += $x_dif;
$y_loc += $y_dif;
quest::moveto($x_loc,$y_loc,$z_loc);
}
}
Merely change the IDs in green to suit your task. You may also want to tinker with where the mobs spawn in relation to the Commander as well. This was used as my proof of concept and has since changed to, path them to several invisible NPCs (without attacking as this does), around the zone as a patrol would do. The only issue is that they keep their initial orientation, which does look odd if you have them go diagonally. Also, unless you spawn the commander at the center of the pack, and instead have him to a side as you have here, he will sometimes be before, to the side, or the diagonal of his troops. This does look fairly nice as one mob in the center of 8 more as a diamond formation though.
If anyone feels like cleaning this up, please do. It is quite messy and inelegant, but gets the job done for what I wanted it to. I would much rather have them follow the commander out, or lead him out, but I could not for the life of me get that to work.