View Single Post
  #17  
Old 08-18-2008, 08:51 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

Quote:
Originally Posted by Striat View Post
The point of a looped timer would be so that if faction or whatever changed while players are killing in a zone, they'd be stripped of buffs. Or if their faction takes over, they'd be given the buff. That is why I used a timer in my example. On the if($timer eq "check") thingy...You can add it. But, you don't have to. if a timer check is not specified (such as in my script under EVENT_TIMER as you mention), it should trigger everything under EVENT_TIMER.
I see. Thanks. Now that I have it complete it's crashing the zone, so I'm sure I've misinterpreted something. Here is the entire script:
Quote:
sub EVENT_ENTERZONE
##checks is player has item; if so, is added to hate list of NPCID 999243
##if not, checks for kingdom faction
{
if(plugin::check_hasitem($client, 13732))
{
$client->SetPVP(1);
quest::settimer("aggro",20);
}

else
{
quest::settimer("check",1);
}
}


sub EVENT_TIMER
{
if($timername == "aggro")
{
my $guard_one = $entity_list->GetMobByNpcTypeID(999243);

if ($guard_one)
{
my $hate_guard_one = $guard_one->CastToNPC();
$hate_guard_one->AddToHateList($client, 1);
}
quest::stoptimer("aggro");
}
elsif($timername == "check")

{

my $factioncheck = undef;
if ($qglobals{kingdomfaction})
{ #global is defined

# #FactionA
if ($qglobals{kingdomfaction} eq "FactionA")
{ #FactionA has control
$factioncheck = $client->GetCharacterFaction(19927);
if ($factioncheck >= 850)
{ #FactionA and character faction over 850
if (!$client->FindBuff(9000))
{ #No Buff? Then cast
quest::selfcast(9000);
}
}
else
{
if ($client->FindBuff(9000))
{ #Has buff but not enough faction. Fade buff
$client->BuffFadeBySpellID(9000);
}
}
}

# #FactionB faction
elsif ($qglobals{kingdomfaction} eq "FactionB")
{ #FactionB has control
$factioncheck = $client->GetCharacterFaction(19928 ); #space added to prevent emoticon in post, does not appear in script
if ($factioncheck >= 850)
{ #FactionB and character faction over 850
if (!$client->FindBuff(9000))
{ #No Buff? Then cast
quest::selfcast(9000);
}
}
else
{
if ($client->FindBuff(9000))
{ #Has buff but not enough faction. Fade buff
$client->BuffFadeBySpellID(9000);
}
}
}

# #FactionC faction
elsif($qglobals{kingdomfaction} eq "FactionC")
{ #FactionC has control
$factioncheck = $client->GetCharacterFaction(19930);
if ($factioncheck >= 850)
{ #FactionC and character faction over 850
if (!$client->FindBuff(9000))
{ #No Buff? Then cast
quest::selfcast(9000);
}
}
else
{
if ($client->FindBuff(9000))
{ #Has buff but not enough faction. Fade buff
$client->BuffFadeBySpellID(9000);
}
}
}

# #FactionD faction
elsif($qglobals{kingdomfaction} eq "FactionD")
{ #FactionD has control
$factioncheck = $client->GetCharacterFaction(19931);
if ($factioncheck >= 850)
{ #FactionD and character faction over 850
if (!$client->FindBuff(9000))
{ #No Buff? Then cast
quest::selfcast(9000);
}
}
else
{
if ($client->FindBuff(9000))
{ #Has buff but not enough faction. Fade buff
$client->BuffFadeBySpellID(9000);
}
}
}
else
{
if ($client->FindBuff(9000))
{ #Global not set but has buff
$client->BuffFadeBySpellID(9000);
}
}
}
}
}
I ran this through a perl cmd line and it returned no errors. But when I put it in the quest/zone folder it crashed the zone. Any thoughts?
Reply With Quote