Code:
#Usage: plugin::wa_KillMode();
sub wa_KillMode
{
quest::debug("Killmode begin for " . $npc->GetName() . "");
my @npc_list = $entity_list->GetNPCList();
foreach $npc_ent (@npc_list)
{
#quest::debug("Killmode begin for " . $npc->GetName() . ""); #This debug will repeat for each NPC in the GetNPCList()
next if $npc_ent->GetLevel() > 2; # Enemy level parameters
next if $npc_ent->GetID() == $npc->GetID(); #Lets not kill ourself
next if $npc_ent->GetOwnerID(); #skip pets
next if ($npc_ent->GetSpecialAbility(19) || $npc_ent->GetSpecialAbility(20) || $npc_ent->GetSpecialAbility(24) || $npc_ent->GetSpecialAbility(35)); #Immune to melee / magic / aggro / noharm SKIP
next if $npc_ent->GetBodyType() == 11; #skip untargetable NPCs
next if $npc_ent->IsEngaged(); # Is target in combat?
next if $npc_ent->CalculateDistance($x, $y, $z) > 250; #skip mobs over 250 Distance
#quest::shout("I am coming for you, " . $npc_ent->GetCleanName() . "!");
quest::SetRunning(1);
$npc->AddToHateList($npc_ent, 1); #We now HATE HIM!
last; #we found a valid target jump out of the loop
}
}
return 1; #This line is required at the end of every plugin file in order to use it