View Single Post
  #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