Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 10-23-2009, 09:46 AM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default binding NPCs to other NPCs

ok this is kinda difficult to explain, but i'll do the best I can. basically i'm wanting to know, how do you take 1 NPC, and bind them to another NPC, like they are in thier own grp? kinda like NPC A is group leader, NPC B will follow him around, and protect him LIKE a pet, but I don't want the randomized names. this is for a quest.
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #2  
Old 10-23-2009, 11:36 AM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

I suppose you could give the "pets" or "minions" npcs a follow order, and make a script which would automatically put them on agro list of each other with signals.

some examples here:

http://www.eqemulator.net/forums/sho...ghlight=follow
Reply With Quote
  #3  
Old 10-23-2009, 11:45 AM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

yea thats how I have them right now, infact thats the post I used to get it started hehe, but they bunch up behind the main NPC, and it just looks crappy. I was hoping to find something along the lines of how i've seen orcs in live a while back, walking in formation together.
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #4  
Old 10-23-2009, 11:57 AM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

too bad we don't have eq2 style "npc packs"
but walking in formation most likely achieved by giving those npcs very precise walking grids. But those grids do not hold for very long - with slightest interruption- like momentary agro - their perfect walk pattern will be broken.
You could do it very tricky way, where you continuously check along the walk grid that all npcs are at appropriate position before continuing to the next grid point, and tell them to stop and wait if necessary, while others catch up.
Reply With Quote
  #5  
Old 10-23-2009, 12:07 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

one of the ways i'm tryin to see will work, is during each EVENT_WAYPOINT the main NPC will signal to each minion, and the minion will check itself in relation to its position to the main NPC and readjust. but i'm still learning the perl functions, so still difficult for me.

something along the lines of NPC A signals NPC B. NPC B checks NPC A's $x,$y then checks its own $x,$y. and if they aren't at $x,$y+10, then moveto $x,$y+10. but I can't figure out how to find NPC A's coords with NPC B.
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #6  
Old 10-23-2009, 01:44 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

Code:
if($signal == 5){
		quest::say("Thanks arias, i'm following you.");
		my $revoltldrID = 189490;
		my $getmobbynpctype = $entity_list->GetMobByNpcTypeID($revoltldrID);
		my $follow_target = $getmobbynpctype->GetID();
		my $x = $npc->GetX();
		my $y = $npc->GetY();
                my $z = $npc->GetZ();
		my $ldrX = $follow_target->getX();
		my $ldrY = $follow_target->getY();
		my $partywalk = $qglobals{$name."partywalk"};
		quest::say("ldrs coords is $ldrX,$ldrY");
		quest::SetRunning(1);
			while($partywalk == 1) {
				if($x == $ldrX && $y != $ldrY+10) {
					quest::moveto($x,$ldrY+10,$z);
				}
			quest::SetRunning(0);
			}
	}
heres what i've come up with, tho I don't think it is getting $ldrX and $ldrY. the global is being defined by another NPC, and it is being defined. seems only hang up is getting the other NPC's coords. any help would be greatly appreciated.
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #7  
Old 10-23-2009, 02:47 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

I redid it, cause after looking at it, it didn't look right to me. noticed a few errors.

Code:
if($signal == 5){
		quest::say("Thanks arias, i'm following you.");
		my $revoltldrID = 189490;
		my $getmobbynpctype = $entity_list->GetMobByNpcTypeID($revoltldrID);
		my $follow_target = $getmobbynpctype->GetID();
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		quest::say("my coords are $x,$y");
		my $ldrX = $follow_target->getX();
		my $ldrY = $follow_target->getY();
		my $partywalk = $qglobals{$name."partywalk"};
		quest::say("ldrs coords is $ldrX,$ldrY");
		quest::SetRunning(1);
			while($partywalk == 1) {
				if($x != $ldrX || $y != $ldrY+10) {
					$npc->moveto($ldrX,$ldrY+10,$z);
				}
			quest::SetRunning(0);
			}
	}
now i'm certain the only problem is having NPC B find NPC A's coords, cause NPC B will tell me his, but won't tell me NPC A's.
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #8  
Old 10-23-2009, 06:23 PM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

I'd do something like this. But of course tweak to your liking.

Actually, I think all you would need is:
Code:
if($signal == 5){
		quest::say("Thanks arias, i'm following you.");

		$npc->SetFollowID($entity_list->GetMobByNpcTypeID(189490)->GetID());
	}
but here's something I wrote up for vindi pets. I need to remove the signal add hate trick, it's too powerful and sees through FD.

Code:
#Shin: Added pet support to Vindi

sub EVENT_SPAWN {
    quest::settimer(1, 1); #Initial spawn of pets
}

sub EVENT_TIMER {
    if ($timer eq "1") { #initial spawn.
        $vindipets[0] = quest::spawn2(113120,0,0,$x,$y,$z,$h);
        $vindipets[1] = quest::spawn2(113120,0,0,$x,$y,$z,$h);
        $entity_list->GetMobID($vindipets[0])->SetFollowID($npc->GetID()); #make new spawned pet follow Vindi.
        $entity_list->GetMobID($vindipets[1])->SetFollowID($npc->GetID()); #make new spawned pet follow Vindi.
        quest::stoptimer(1);
        quest::settimer(2, 120); #This is the respawn for pet delay
    }
    if ($timer eq "2") {
        if (!defined @vindipets) { #this happens if someone #reloadpl's. I don't really have a good solution.
            $vindipets[0] = quest::spawn2(113120,0,0,$x,$y,$z,$h);
            $vindipets[1] = quest::spawn2(113120,0,0,$x,$y,$z,$h);
            $entity_list->GetMobID($vindipets[0])->SetFollowID($npc->GetID()); #make new spawned pet follow Vindi.
            $entity_list->GetMobID($vindipets[1])->SetFollowID($npc->GetID()); #make new spawned pet follow Vindi.
        }
        for ($i = 0; $i < scalar @vindipets; $i++) {  #Pet check
            if (defined $vindipets[$i]) { #I find this a silly check but scalar size is wierd.
                if (!defined $entity_list->GetMobID($vindipets[$i])) {
                    $vindipets[$i] = quest::spawn2(113120,0,0,$x,$y,$z,$h); #respawn pet.
                    $entity_list->GetMobID($vindipets[$i])->SetFollowID($npc->GetID()); #set vindi owner.
                }
            }
        }
    }
}

sub EVENT_COMBAT {
    if ($combat == 1) {
        quest::signalwith(113120,$client->GetID(),0); #there's more than pets with this name, need a new npc type id. And this is working too well, I think FD is being seen thru with "pets".
    }
}
sub EVENT_ATTACK {
  quest::shout("Your kind will not defile the temple of Rallos Zek!");
}

# Quest by mystic414

sub EVENT_SIGNAL { #Pet Aggro'd, this is more uber than EQ live. Put in guardian
    $mob->AddToHateList($signal, 1, 0) #This is too much though
}
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #9  
Old 10-23-2009, 07:10 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

i'm looking to make a formation, because I have 5 NPC's that will be following 1, and follow bunches them all up behind him, and looks crappy. thats why i'm wanting to have them around the NPC and update thier position based on the main NPC moving. i'm just having trouble finding the main NPC's loc, and updating it to its "minions" so they can update thier position.
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #10  
Old 10-23-2009, 09:18 PM
Wesell
Sarnak
 
Join Date: Mar 2009
Location: none
Posts: 30
Default

Try calling GetX and GetY on the mob returned by GetMobByNPCTypeID instead of on the ID returned by GetID.

Code:
my $revoltldrID = 189490;
my $ldrMob = $entity_list->GetMobByNpcTypeID($revoltldrID);
my $ldrX = $ldrMob->GetX();
my $ldrY = $ldrMob->GetY();
Reply With Quote
  #11  
Old 10-23-2009, 09:41 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

Code:
if($signal == 5){
		quest::say("Thanks arias, i'm following you.");
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		my $x_loc = 0;
		my $y_loc = 0;
		my $z_loc = 0;
		quest::say("checking for mob");
		my $target_to_follow = $entity_list->GetMobByNpcTypeID(189490);
		if($target_to_follow){
			quest::say("found mob, get coords");
			$x_loc = $target_to_follow->GetX();
			$y_loc = $target_to_follow->GetY();
			$z_loc = $target_to_follow->GetZ();
			quest::say("mobs coords is $x_loc, $y_loc, $z_loc");
		}
		quest::say("setting run mode to 1");
		quest::SetRunning(1);
			quest::say("while state executing");
			while($x != $x_loc && $y != $y_loc + 10) {
					$npc->moveto($x_loc,$y_loc + 10,$z);
			}
		quest::SetRunning(0);
		quest::signalwith(189490,12,0);
	}
heres what I have now. it makes it all the way to the while statement, including giving correct coords for the npc (thanks KLS and wesell) but the mob doesn't move. obviously a problem with the while statement, but I don't know what. (i'm thinking its the moveto, but not sure.) can anyone provide some enlightenment for this learning mind?
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #12  
Old 10-23-2009, 10:29 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

MoveTo not moveto (yes they're case sensitive).
Reply With Quote
  #13  
Old 10-23-2009, 10:32 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

ok i'm done for the night, i'm gonna post what I got, and how its working, maybe someone can tell what i'm doin wrong.

NPC A

Code:
if($signal == 12) {
		if(defined($qglobals{$name."partywalk"})) {
			quest::signalwith(189492,11,0);
		}
	}
used to loop NPC B's moveto.

NPC B part 1
Code:
if($signal == 5){
		quest::say("Thanks arias, i'm following you.");
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		my $h = $npc->GetHeading();
		my $x_loc = 0;
		my $y_loc = 0;
		my $z_loc = 0;
		my $h_loc = 0;
		#quest::say("checking for mob");
		my $target_to_follow = $entity_list->GetMobByNpcTypeID(189490);
		if($target_to_follow){
		#	quest::say("found mob, get coords");
			$x_loc = $target_to_follow->GetX();
			$y_loc = $target_to_follow->GetY();
			$z_loc = $target_to_follow->GetZ();
			$h_loc = $target_to_follow->GetHeading();
		#	quest::say("mobs coords is $x_loc, $y_loc, $z_loc");
		}
	#	quest::say("setting run mode to 1");
		quest::SetRunning(1);
		#	quest::say("while state executing");
			if($x != $x_loc && $y != $y_loc + 10) {
					quest::moveto($x_loc,$y_loc + 10,$z,$h,1);
			}
		quest::say("sending signal");
		quest::signalwith(189490,12,0);
	}
gets signal 5 from NPC A, starts everything up. (not included here, as it works.)

NPC B part 2
Code:
if($signal == 11) {
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		my $h = $npc->GetHeading();
		my $x_loc = 0;
		my $y_loc = 0;
		my $z_loc = 0;
		my $h_loc = 0;
	#	quest::say("checking for mob");
		my $target_to_follow = $entity_list->GetMobByNpcTypeID(189490);
		if($target_to_follow){
			quest::say("found mob, get coords");
			$x_loc = $target_to_follow->GetX();
			$y_loc = $target_to_follow->GetY();
			$z_loc = $target_to_follow->GetZ();
			$h_loc = $target_to_follow->getHeading();
		}
		if($x != $x_loc && $y != $y_loc - 10) {
			quest::moveto($x_loc,$y_loc - 10,$z_loc,$h_loc,1);
			}
		quest::say("sending signal");
		quest::signalwith(189490,12,0);
	}
this is to continue the loop, when recieving signal 11 from NPC A (code above).


all globals are defined, and everything starts up, NPC moves one time, to first coords it finds when inital script is started. then nothing. npc just stands there. I really hope someone can help me figure this out. thanks
__________________
Server Op of Bonds of Strength(custom-Legit)
Reply With Quote
  #14  
Old 10-23-2009, 11:34 PM
Wesell
Sarnak
 
Join Date: Mar 2009
Location: none
Posts: 30
Default

Just glanced at it, but it may just be improper capitalization on the GetHeading method.
Reply With Quote
  #15  
Old 10-23-2009, 11:43 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I would agree.
Reply With Quote
Reply


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 10:34 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