Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2012, 09:34 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default Simulated AE Rampage Script

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");
   }
Reply With Quote
  #2  
Old 02-11-2012, 09:53 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Just a quick glance, but I would assume it has something to do with hardcoding 0 and 2000 rather than getting a true client count. Haven't done it in a while, but is there truly a client with ID of 0? Another thing to think of is what happens when you get beyond the actual list of clients.
Reply With Quote
  #3  
Old 02-11-2012, 10:00 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

Quote:
Originally Posted by joligario View Post
Just a quick glance, but I would assume it has something to do with hardcoding 0 and 2000 rather than getting a true client count. Haven't done it in a while, but is there truly a client with ID of 0? Another thing to think of is what happens when you get beyond the actual list of clients.
Not sure why that would cause any issue, it never did before (and is how it was written by Kayen).
Reply With Quote
  #4  
Old 02-11-2012, 10:28 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Something like this might work, and it'd be more efficient since it's not going to try and retrieve 2000 clients.

Code:
my @clientlist = $entity_list->GetClientList();
foreach $ent (@clientlist)
{
    my $x = $npc->GetX();
    my $y = $npc->GetY();
    my $z = $npc->GetZ();
    my $distanceCHK = $ent->CalculateDistance($x, $y, $z);
    my $PLTarget = $npc->GetTarget();
    my $TargID = $PLTarget->GetID();
    my $ClID = $ent->GetID();
    my $RampDamageVar = (int(rand($DamageVar ))) + (int($ShieldMinDam));
    if (($distanceCHK <= 2000) && ($TargID != $ClID))
    {
        $ent->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
        $ent->Message(13, "$cmname hits YOU for $RampDamageVar points of damage!");
    }
}
Reply With Quote
  #5  
Old 02-11-2012, 10:37 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

Quote:
Originally Posted by lerxst2112 View Post
Something like this might work, and it'd be more efficient since it's not going to try and retrieve 2000 clients.

Code:
my @clientlist = $entity_list->GetClientList();
foreach $ent (@clientlist)
{
    my $x = $npc->GetX();
    my $y = $npc->GetY();
    my $z = $npc->GetZ();
    my $distanceCHK = $ent->CalculateDistance($x, $y, $z);
    my $PLTarget = $npc->GetTarget();
    my $TargID = $PLTarget->GetID();
    my $ClID = $ent->GetID();
    my $RampDamageVar = (int(rand($DamageVar ))) + (int($ShieldMinDam));
    if (($distanceCHK <= 2000) && ($TargID != $ClID))
    {
        $ent->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
        $ent->Message(13, "$cmname hits YOU for $RampDamageVar points of damage!");
    }
}
Like this? (still doesn't get to the damage portion)

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) 
			{
			my $x = $npc->GetX();
			my $y = $npc->GetY();
			my $z = $npc->GetZ();
			my $distanceCHK = $ent->CalculateDistance($x, $y, $z);
			my $PLTarget = $npc->GetTarget();
			my $TargID = $PLTarget->GetID();
			my $ClID = $ent->GetID();
			my $RampDamageVar = (int(rand($DamageVar ))) + (int($ShieldMinDam));
			if (($distanceCHK <= 2000) && ($TargID != $ClID))
				{
				$ent->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
				$ent->Message(13, "$cmname hits YOU for $RampDamageVar points of damage!");
				}
			}	
		}
   }
Reply With Quote
  #6  
Old 02-12-2012, 01:00 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

You have:

my $x;
my $y;
my $z;
my $h;

at the top of the script and then you have

my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();

inside the loop, where it stops working. I'm not a perl expert, but that may be the problem. I would remove the ones at the top.
Reply With Quote
  #7  
Old 02-12-2012, 12:31 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

Doesn't change anything, I tried that before.
Reply With Quote
  #8  
Old 02-12-2012, 12:44 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

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!");
				}
			}	
		}
   }
Reply With Quote
  #9  
Old 02-12-2012, 02:19 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

I would debug the value in distanceCHK and target/client ids to see if it is value problem.
Reply With Quote
  #10  
Old 02-12-2012, 08:31 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

How would I do that?
Reply With Quote
  #11  
Old 02-13-2012, 12:10 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Consider what would happen if both IDs were the same.

Change your 7th shout to this:
Code:
quest::shout("7 $TargID, $ClID");
The reason I mention this is that when testing the script alone, the IDs are the same and the if fails.
Reply With Quote
  #12  
Old 02-13-2012, 01:37 AM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

Quote:
Originally Posted by lerxst2112 View Post
Consider what would happen if both IDs were the same.

Change your 7th shout to this:
Code:
quest::shout("7 $TargID, $ClID");
The reason I mention this is that when testing the script alone, the IDs are the same and the if fails.
I see what you're saying. I brought another char out to help with this. Any time the TargID and ClID were the same, the script failed, any time they were different, it worked. I removed the && ($TargID != $ClID)) part of the script and now it fires all the time.

Issue resolved. Thanks for the help!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:20 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3