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

02-11-2012, 09:34 PM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
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");
}
|
 |
|
 |

02-11-2012, 09:53 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
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.
|

02-11-2012, 10:00 PM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
Quote:
Originally Posted by joligario
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).
|

02-11-2012, 10:28 PM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,742
|
|
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!");
}
}
|
 |
|
 |

02-11-2012, 10:37 PM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
Quote:
Originally Posted by lerxst2112
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!");
}
}
}
}
|
 |
|
 |

02-12-2012, 01:00 AM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,742
|
|
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.
|

02-12-2012, 12:31 PM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
Doesn't change anything, I tried that before.
|
 |
|
 |

02-12-2012, 12:44 PM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
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!");
}
}
}
}
|
 |
|
 |

02-12-2012, 02:19 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
I would debug the value in distanceCHK and target/client ids to see if it is value problem.
|

02-12-2012, 08:31 PM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
How would I do that?
|

02-13-2012, 12:10 AM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,742
|
|
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.
|

02-13-2012, 01:37 AM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
Quote:
Originally Posted by lerxst2112
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!
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 07:31 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |