Modified for use as a "guard" without using faction. Basically you can change the target NPCIDs to have the guard attack specific npcs that come close enough.
Code:
#2211 Enclave_Protector in postorms v.1
sub EVENT_SPAWN {
quest::settimer(1,6);
}
sub EVENT_TIMER {
if($timer == 1) {
my @nlist = $entity_list->GetNPCList();
foreach my $n(@nlist) {
my $typeID = $n->GetNPCTypeID();
if($typeID >= 2213) {
if(plugin::CheckDistBetween2Ents($npc,$n,50)) {
$npc->AddToHateList($n);
}
}
}
}
}