Code:
sub EVENT_COMBAT {
# a 1 second leash timer.
if($combat_state == 1)
{
quest::settimer(1,1);
}
else
{
quest::stoptimer(1); #we left combat stop timer
}
}
sub EVENT_SAY {
$client->Message(315, "you are $faction level faction");
#This was for resting :p
}
sub EVENT_TIMER {
if ($timer == 1)
{
#quest::say("timer set");
my @hate_list = $npc->GetHateList();
my $hate_count = @hate_list;
if ($hate_count > 0)
{
#quest::say("hate count >0");
foreach $ent (@hate_list)
{
my $h_ent = $ent->GetEnt();
if ($h_ent->IsClient())
{
#quest::say("Is Client named $h_ent hate list is $hate_count ");
$h_ent = $h_ent->CastToClient(); #h_ent WAS a client CASTING to client now!
my $FACTION = $h_ent->GetFactionLevel($h_ent->CharacterID(), $npc->GetID(), $h_ent->GetRace(), $h_ent->GetClass(), $h_ent->GetDeity(), $npc->GetPrimaryFaction(), $npc); #Holy crap that is long (thats what she said)
if ($FACTION != 9) # We are not READY TO ATTACK
{
#we are faction 6-9 .. aka they wanna keel us (at least dubious
quest::ze(0,"You are not my enemy! ");
$h_ent->MovePC(34,823.3,1373.4,10.33,0);
#id suggest moving them to a new zone :)
}
}
}
}
else
{
WIPE_AGGRO();
}
}
}
sub WIPE_AGGRO {
#might wanna add some wipe aggro code here :)
quest::stoptimer(1);
}
Thats how you seem to get faction level when its not in a client activated script.
Code:
my $FACTION = $h_ent->GetFactionLevel($h_ent->CharacterID(), $npc->GetID(), $h_ent->GetRace(), $h_ent->GetClass(), $h_ent->GetDeity(), $npc->GetPrimaryFaction(), $npc);