I actually use a different method of formation, and I will show how one of my mini-events are done. I choose to use quest::moveto instead of the more complex ways of doing it, because I have noticed that a lot of formations tend to group up together which just looks crappy. They start out nice and smooth, but later end up all together or out of formation...
Here his how I do a little event in Old Commands, on my server. (The text and quests stuff has been removed, this only shows how the pathing works.)
a rescue soldier leader:
Code:
my $sx = undef; #spawn location x
my $sy = undef; #spawn location y
my $sz = undef; #spawn location z
my $sh = undef; #spawn location h
my $evstar = undef; #is event started
my $dervcount = undef; #cutthroat death count
sub EVENT_SPAWN {
$sx = $npc->GetSpawnPointX(); #spawn location x
$sy = $npc->GetSpawnPointY(); #spawn location y
$sz = $npc->GetSpawnPointZ(); #spawn location z
$sh = $npc->GetSpawnPointH(); #spawn location h
$evstar = 0;
$dervcount = 0;
quest::spawn2(952,0,0,$x+5,$y-3,$z,$h);
quest::spawn2(954,0,0,$x-5,$y,$z,$h);
}
sub EVENT_SIGNAL {
if ($signal == 1) {
if ($evstar == 1) {
$dervcount++;
if ($dervcount == 3) {
quest::moveto($sx+50,$sy+50,$sz-9,$sh,1);
quest::signalwith(952,2,0);
quest::signalwith(954,2,0);
}
if ($dervcount == 5) {
quest::moveto($sx+250,$sy+50,$sz-87,$sh,1);
quest::signalwith(952,3,0);
quest::signalwith(954,3,0);
}
if ($dervcount == 7) {
quest::moveto($sx+225,$sy+250,$sz-62,$sh,1);
quest::signalwith(952,4,0);
quest::signalwith(954,4,0);
}
if ($dervcount == 10) {
quest::moveto($sx+200,$sy+400,$sz+25,$sh,1);
quest::signalwith(952,5,0);
quest::signalwith(954,5,0);
}
if ($dervcount == 14) {
quest::moveto($sx+210,$sy+475,$sz+5,$sh,1);
quest::signalwith(952,6,0);
quest::signalwith(954,6,0);
quest::signalwith(955,1,10);
quest::settimer(1,13);
quest::settimer(2,300);
$evstar = 2;
}
}
}
}
sub EVENT_TIMER {
if ($timer == 1) {
quest::shout("Let's head back, soldiers!");
quest::moveto($sx,$sy,$sz,$sh,1);
quest::signalwith(952,7,0);
quest::signalwith(954,7,0);
quest::stoptimer(1);
}
if ($timer == 2) {
quest::depopall(952);
quest::depopall(954);
quest::depopall(955);
quest::depop();
quest::stoptimer(2);
}
}
sub EVENT_DEATH {
quest::depopall(952);
quest::depopall(954);
quest::depopall(955);
}
(NPCID) 952.pl & 954.pl
Code:
my $sx = undef; #spawn location x
my $sy = undef; #spawn location y
my $sz = undef; #spawn location z
my $sh = undef; #spawn location h
sub EVENT_SPAWN {
$sx = $npc->GetSpawnPointX();
$sy = $npc->GetSpawnPointY();
$sz = $npc->GetSpawnPointZ();
$sh = $npc->GetSpawnPointH();
}
sub EVENT_SIGNAL {
if ($signal == 1) {
quest::moveto($sx,$sy,$sz,$sh,1);
}
if ($signal == 2) {
quest::moveto($sx+50,$sy+50,$sz-9,$sh,1);
}
if ($signal == 3) {
quest::moveto($sx+250,$sy+50,$sz-87,$sh,1);
}
if ($signal == 4) {
quest::moveto($sx+225,$sy+250,$sz-62,$sh,1);
}
if ($signal == 5) {
quest::moveto($sx+200,$sy+400,$sz+25,$sh,1);
}
if ($signal == 6) {
quest::moveto($sx+210,$sy+475,$sz+5,$sh,1);
}
if ($signal == 7) {
quest::moveto($sx,$sy,$sz,$sh,1);
}
}
a dervish cutthroad
Code:
sub EVENT_DEATH {
quest::signalwith(953,1,0);
}
How this works, is that when the players are on the quest (and the event can only be triggered if the player is on the quest) their task is to kill 15 dervish. As you can see, each time they kill one - it sends a signal that is counted. On count X the NPCs will walk to a closer location (in formation).
This is only a 3 NPC formation, but can be applied in as many numbers as you would like. I find this method much more simple than the other methods that are out there.
Enjoy!