Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##This is npc's spawned x, y location and leash length
- $leashlength = 200;
- sub EVENT_SPAWN
- {
- $startingx = $npc->GetX();
- $startingy = $npc->GetY();
- $startingz = $npc->GetZ();
- $startingh = $npc->GetHeading();
- }
- sub EVENT_COMBAT
- {
- if ($combat_state == 1)
- {
- quest::settimer("Rampage", 8);
- quest::settimer("checkleash",5);
- }
- if ($combat_state == 0)
- {
- $npc->SetHP($npc->GetMaxHP());
- $npc->WipeHateList();
- quest::stoptimer("Rampage");
- quest::stoptimer("getclients");
- }
- }
- sub EVENT_TIMER {
- $currentx = $npc->GetX();
- $currenty = $npc->GetY() ;
- $currentz = $npc->GetZ();
- if($timer eq "checkleash")
- {
- ###This is just the equation for a sphere
- ###(x - x_0 )^2 + (y - y_0 )^2 + ( z - z_0 )^2 = r^2.
- ###
- $leftside = ((($currentx - $startingx)*($currentx-$startingx)) + (($currenty - $startingy)*($currenty -$startingy)) + (($currentz - $startingz)*($currentz - $startingz)));
- $rightside = ($leashlength * $leashlength);
- if($leftside > $rightside)
- {
- $currentx = undef;
- $currenty = undef;
- $currentz = undef;
- $npc->WipeHateList();
- $npc->GMMove($startingx, $startingy, $startingz, $startingh);
- quest::stoptimer("checkleash");
- quest::settimer("checkleash",5);
- }
- }
- elsif ($timer eq "Rampage") {
- quest::stoptimer("Rampage");
- my $TimeRA = quest::ChooseRandom(8);
- quest::settimer("getclientsRAMPAGE", $TimeRA);
- }
- elsif ($timer eq "getclientsRAMPAGE") {
- $MaxDam = $npc->GetMaxDMG();
- $ShieldMaxDam = ($MaxDam * 0.35);
- $ShieldMinDam = $ShieldMaxDam / 2;
- $DamageVar = ($npc->GetMaxDMG() * .35) - (($npc->GetMaxDMG() * .35) / 2);
- $entity_list->MessageClose($npc, 1, 200, 13, "".$npc->GetCleanName()." goes on a WILD KMRA RAMPAGE");
- @client_list = $entity_list->GetClientList();
- foreach $single_client (@client_list) {
- if ($single_client->CalculateDistance ($x, $y, $z) <= 57) {
- $RampDamageVar = (int ( rand($DamageVar) + $ShieldMinDam));
- $single_client->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
- $single_client->Message(13, "".$npc->GetCleanName()." hits YOU for $RampDamageVar points of damage");
- if ($single_client->GetPetID()) {
- $pet_to_dmg = $entity_list->GetMobByID($single_client->GetPetID());
- $pet_to_dmg->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement