I know there's now a special attack code for Wild Rampage, but I liked using this on an old NPC of mine because of the customizable damage and delivery messages. This is the exact same script I used before, however now it doesn't work. I'm assuming some thing has changed to break this script as it fires all the way up to the if ($client_search) part and stops. Any help is appreciated.
Code:
my $x;
my $y;
my $z;
my $h;
sub EVENT_COMBAT
{
if ($combat_state == 1)
{
quest::settimer("rampage",15);
}
if ($combat_state == 0)
{
$npc->WipeHateList();
quest::stoptimer("rampage");
quest::stoptimer("getclients");
#$npc->SetHP($npc->GetMaxHP() * 1);
}
}
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)
{
###The script stops here
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $distanceCHK = $client_search->CalculateDistance($x, $y, $z);
my $PLTarget = $npc->GetTarget();
my $TargID = $PLTarget->GetID();
my $ClID = $client_search->GetID();
my $RampDamageVar = (int(rand($DamageVar ))) + (int($ShieldMinDam));
if (($distanceCHK <= 2000) && ($TargID != $ClID))
{
$client_search->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
$client_search->Message(13, "$cmname hits YOU for $RampDamageVar points of damage!");
}
}
}
}
}
sub EVENT_DEATH
{
quest::stoptimer("rampage");
quest::stoptimer("getclients");
}