Using this version 1-7 fires, 8 never fires:
Code:
sub EVENT_TIMER
{
if ($timer eq "rampage")
{
quest::stoptimer("rampage");
my $TimeRA = quest::ChooseRandom(15);
quest::settimer("getclients", $TimeRA);
}
if ($timer eq "getclients")
{
$cmname = $npc->GetCleanName();
my $MaxDam = $npc->GetMaxDMG();
my $ShieldMaxDam = ($MaxDam * .80);
my $ShieldMinDam = $ShieldMaxDam / 2;
my $DamageVar = ($ShieldMaxDam - $ShieldMinDam);
$entity_list->MessageClose($npc, 1, 2000, 13, "$cmname SLAMS his hammer into the ground!");
my $list_check = 0;
for ($list_check = 0; $list_check < 2000; $list_check++)
{
$client_search = $entity_list->GetClientByID($list_check);
if ($client_search)
{
quest::shout("1");
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
quest::shout("2");
my $distanceCHK = $client_search->CalculateDistance($x, $y, $z);
quest::shout("3");
my $PLTarget = $npc->GetTarget();
quest::shout("4");
my $TargID = $PLTarget->GetID();
quest::shout("5");
my $ClID = $client_search->GetID();
quest::shout("6");
my $RampDamageVar = (int(rand($DamageVar ))) + (int($ShieldMinDam));
quest::shout("7");
if (($distanceCHK <= 2000) && ($TargID != $ClID))
{
quest::shout("8");
$client_search->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
$client_search->Message(13, "$cmname hits YOU for $RampDamageVar points of damage!");
}
}
}
}
}
Using this version 1-7 fires, 8 never fires:
Code:
sub EVENT_TIMER
{
if ($timer eq "rampage")
{
quest::stoptimer("rampage");
my $TimeRA = quest::ChooseRandom(15);
quest::settimer("getclients", $TimeRA);
}
if ($timer eq "getclients")
{
$cmname = $npc->GetCleanName();
my $MaxDam = $npc->GetMaxDMG();
my $ShieldMaxDam = ($MaxDam * .80);
my $ShieldMinDam = $ShieldMaxDam / 2;
my $DamageVar = ($ShieldMaxDam - $ShieldMinDam);
$entity_list->MessageClose($npc, 1, 2000, 13, "$cmname SLAMS his hammer into the ground!");
my @clientlist = $entity_list->GetClientList();
foreach $ent (@clientlist)
{
quest::shout("1");
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
quest::shout("2");
my $distanceCHK = $ent->CalculateDistance($x, $y, $z);
quest::shout("3");
my $PLTarget = $npc->GetTarget();
quest::shout("4");
my $TargID = $PLTarget->GetID();
quest::shout("5");
my $ClID = $ent->GetID();
quest::shout("6");
my $RampDamageVar = (int(rand($DamageVar ))) + (int($ShieldMinDam));
quest::shout("7");
if (($distanceCHK <= 2000) && ($TargID != $ClID))
{
quest::shout("8");
$ent->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
$ent->Message(13, "$cmname hits YOU for $RampDamageVar points of damage!");
}
}
}
}