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 05-05-2011, 05:41 AM
Astal
Hill Giant
 
Join Date: Mar 2010
Posts: 236
Default Can anyone help me with this script (calling npcs in to attack player)

It doesnt call all of the NPCs of with the ID in $NPCToRespond, sometimes it will call 3 sometimes 7. Its random also, it doesnt call the same ones each time.

Im not sure whats going on with it.


Code:
sub EVENT_HP {

	if ($hpevent == 90) { #call the odel tal demons
		quest::shout("Destroy The Humans!!");
		quest::setnexthpevent(80);
		my $NPCToRespond = 2700235; # NPCID to call in to assist 146337
		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.
				}
			}
		}
	}
	
	elsif ($hpevent == 80) { #call illryia minions 1
		quest::shout("Attack You Lazy Maggots!!");
		quest::setnexthpevent(70);
		my $NPCToRespond = 2700234; # NPCID to call in to assist 146337
		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.
				}
			}
		}
	}
	
	elsif ($hpevent == 70) {
		quest::shout("Dont Just Sit There....HELP ME!!");
		quest::setnexthpevent(60);
		my $NPCToRespond = 2700239; # NPCID to call in to assist 146337
		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.
				}
			}
		}
	}
	
	elsif ($hpevent == 60) {
		quest::shout("Are You Demons or PUSSIES!!??");
		quest::setnexthpevent(50);
		my $NPCToRespond = 2700244; # NPCID to call in to assist 146337
		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.
				}
			}
		}
	}

	elsif ($hpevent == 50) {
		quest::shout("Time For A MOSH PIT!!!");
		quest::setnexthpevent(40);
		my $NPCToRespond = 2700240; # NPCID to call in to assist 146337
		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.
				}
			}
		}
	}
	
	elsif ($hpevent == 40) {
		quest::shout("The Drugs Arent Working I Still Feel The Pain!");
		quest::setnexthpevent(30);
		my $NPCToRespond = 2700241; # NPCID to call in to assist 146337
		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.
				}
			}
		}
	}

	elsif ($hpevent == 30) {
		quest::shout("Unleash Hell My Brethren!!");
		my $NPCToRespond = 2700242; # NPCID to call in to assist 146337
		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.
				}
			}
		}
	}

}
Reply With Quote
  #2  
Old 05-05-2011, 07:06 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

Just a cursory glance.

I noticed your NPCID is really high. Is that definitely the correct NPCID?

When selecting a random NPC, you go from 0 to $HateCount. You probably want $HateCount -1.
Reply With Quote
  #3  
Old 05-05-2011, 07:34 AM
Astal
Hill Giant
 
Join Date: Mar 2010
Posts: 236
Default

Quote:
Originally Posted by joligario View Post
Just a cursory glance.

I noticed your NPCID is really high. Is that definitely the correct NPCID?

When selecting a random NPC, you go from 0 to $HateCount. You probably want $HateCount -1.
yeah its the right npcid, thats what it set it to when i created em for some reason /shrug


Awesome that works man, thanks
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 08:02 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3