Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-09-2010, 09:44 PM
nenelan
Hill Giant
 
Join Date: Feb 2008
Posts: 116
Default Marching In Formations

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.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:09 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3