PDA

View Full Version : NPC Formations


Figback65
02-06-2014, 07:34 PM
Hey guys. I am working with the spawninformation trying to get those plugins to work properly. I searched forums for "formation" and found a few helpful topics. I copied information from those and the formation spawning works but everything spawns at a random spot in the zone instead of right beside the leadernpc. Any idea why they wouldn't be spawning beside the leader?

I am using Trev's example.
http://www.eqemulator.org/forums/showthread.php?t=32586&highlight=formation

my $LeaderNPCID = 1000041;
my $SquadNPCID = 452005;
my $SpawnDist = 10;

sub EVENT_SPAWN {

quest::depopall($SquadNPCID);
quest::settimer("spawn_guards", 2);

}

sub EVENT_TIMER {

if ($timer eq "spawn_guards") {
quest::stoptimer("spawn_guards");
#Usage: plugin::SpawnInFormation(NPCID, LeaderMob, Distance, Columns, Rows, [LeadDist, MaxZDiff]);
plugin::SpawnInFormation($SquadNPCID, $npc, $SpawnDist, 2, 2, 10, 10);
#Usage: plugin::MoveInFormation(NPCID, [$npc = 0, OnGrid = 0, MoveToX = 0, MoveToY = 0, NoSpeedBuffs = false]);
plugin::MoveInFormation($SquadNPCID, $npc , 1);
}

if ($timer eq "WPArrive") {
quest::stoptimer("WPArrive");
plugin::MoveInFormation($SquadNPCID, $npc, 1);
}

}

my $MoveSquad = 1;
sub EVENT_WAYPOINT_DEPART {

if ($MoveSquad)
{
quest::settimer("WPArrive", 0);
}
else {
quest::stop();
}

}


Thanks all!

trevius
02-10-2014, 10:39 AM
If you have more than 1 of the same NPC you are using for the squad leader in the same zone, it would probably cause issues. Also, if you are missing the .map file for the zone, it probably wouldn't work due to no LoS. It's also possible some function(s) changed since these plugins were written, and there may need to be an update for them to correct it.

sorvani
02-10-2014, 02:46 PM
I am not sure if they are static or not, but there are mobs on live that spawn like this now. If it is static, the plugin is not really needed, but if they spawn a bit dynamically, this would be a good thing to have working.

trevius
02-11-2014, 09:21 AM
I am not sure if they are static or not, but there are mobs on live that spawn like this now. If it is static, the plugin is not really needed, but if they spawn a bit dynamically, this would be a good thing to have working.

Yeah, I think those are all static. The collector tool could get the pathing, but it is not 100% accurate. The pathing might look ok right after a repop of the zone, but after a while the patrols might get out of sync of one another.

At the very least, we could use the existing pathing for the leader NPC, and then just script the others to follow in formation. That would ensure that they all stay in sync. Though, once the leader is dead, the rest stop following (which is why I normally use an invis NPC as the real leader).

roonibrice
02-23-2014, 04:04 AM
im still playing around with it... ill let you know if i find out anything

Figback65
03-06-2014, 06:23 AM
Sorry for late response, work work work lol.
I did notice I do not have any map files for the zones I am trying to get it working in. I will test it today on a zone with a mapfile and post results.

Figback65
03-12-2014, 02:07 PM
ok, so I used azone2 and made a map file for oldfieldofbone and it worked.
The npcs spawn on the leader correctly.

Thanks for your help !