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 12-25-2010, 01:27 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by Astal View Post
I mean all my npcs have the same npcid. I would need to move em via theyre spawnID no?

Cant find any quest code to do that
Here, this should help you out a bit.

This could probably most appropriately be used on a controller NPC or a boss hp event to control the other NPC's.

Code:
my @NPCLIST = $entity_list->GetNPCList();
			my $NPCToRespond = 555; #NPCID to respond
			my $NPCToBeAttacked = 556; #NPCID to be attacked
			foreach $entity (@NPCLIST){
				if($entity->GetNPCTypeID() == $NPCToRespond) {
				$entity->AddToHateList($NPCToBeAttacked, 1);
				}
			}
Reply With Quote
  #2  
Old 12-25-2010, 01:57 AM
Astal
Hill Giant
 
Join Date: Mar 2010
Posts: 236
Default

Quote:
Originally Posted by Akkadius View Post
Here, this should help you out a bit.

This could probably most appropriately be used on a controller NPC or a boss hp event to control the other NPC's.

Code:
my @NPCLIST = $entity_list->GetNPCList();
			my $NPCToRespond = 555; #NPCID to respond
			my $NPCToBeAttacked = 556; #NPCID to be attacked
			foreach $entity (@NPCLIST){
				if($entity->GetNPCTypeID() == $NPCToRespond) {
				$entity->AddToHateList($NPCToBeAttacked, 1);
				}
			}

K ill have to look into it, im not as good at perl as you guys.
Reply With Quote
  #3  
Old 12-27-2010, 11:29 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I haven't tested the script below, but it should work as-is I think. It is similar to what Akkadius posted, but this tells the NPCs to attack a random mob on the boss' hate list. This should let it attack players or pets. The only thing you should need to adjust is the NPCID that you want to assist in your event. Also, note that this script requires the RandomRange() plugin, which I don't think is included in the standard PEQ quests distribution. You can find that plugin in the plugins section of these forums if you don't already have it.

Code:
sub EVENT_SPAWN {

	quest::setnexthpevent(50);
}

sub EVENT_HP {

	if ($hpevent == 50) {
		my $NPCToRespond = 555555; # NPCID to call in to assist
		my @hatelist = $npc->GetHateList();	# Get the NPC's current Hate List
		my $HateCount = @hatelist;	# Total mobs on the NPC's hate list
		my @npclist = $entity_list->GetNPCList();	# Get the full NPC list for the zone
		foreach $ent (@npclist)
		{
			if($ent->GetNPCTypeID() == $NPCToRespond)	# Verify that the current NPC being checked is the NPCID we want
			{
				my $RandomHateNum = plugin::RandomRange(0, $HateCount);	# Choose a random mob in the Hate List array
				my $RandomHateEnt = $hatelist[$RandomHateNum];	# Get the Hate list entry for the selected number of the array
				if ($RandomHateEnt && $RandomHateEnt->GetEnt())	# Verify that the hate entry exists and that we can get the entity
				{
					my $HateEnt = $RandomHateEnt->GetEnt();	# Get the hated entity
					$ent->AddToHateList($HateEnt, 1);	# Tell the current NPC to attack the random mob on the boss' hate list.
				}
			}
		}
	}

}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 12-27-2010, 09:59 PM
Astal
Hill Giant
 
Join Date: Mar 2010
Posts: 236
Default

thanks a ton ill try implementing it soon as im not so sick
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:50 PM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3