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