NatedogEZ
03-13-2013, 12:42 AM
if ($timer eq "fear")
{
my $hate_target = $npc->GetHateRandom();
my $hate_name = $hate_target->GetName();
my $hate_id = $hate_target->GetID();
quest::shout("Burn in HELL $hate_name");
$npc->CastSpell(27418, $hate_id);
undef $hate_target;
}
The timer is working.. it is correctly casting the spell..
But.. heres the problem
2 Players on Hatelist will only NUKE 1 player never the other...
3 Players on Hatelist will ONLY Nuke 2 of the players .. never the 3rd...
and so on...
Tested with 4 and it only would nuke 3 out of the 4.
Is there something wrong with the GetHateRandom?
Mob *HateList::GetRandom()
{
int count = 0;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
iterator.Advance();
count++;
}
if(!count)
return NULL;
int random = MakeRandomInt(0, count-1);
iterator.Reset();
for (int i = 0; i < random-1; i++)
iterator.Advance();
return iterator.GetData()->ent;
}
the Random seems to be (Count -1)
Then the For loop ... Removes another 1 from Random?
Is this possibly why it always cuts 1 player off the list?
{
my $hate_target = $npc->GetHateRandom();
my $hate_name = $hate_target->GetName();
my $hate_id = $hate_target->GetID();
quest::shout("Burn in HELL $hate_name");
$npc->CastSpell(27418, $hate_id);
undef $hate_target;
}
The timer is working.. it is correctly casting the spell..
But.. heres the problem
2 Players on Hatelist will only NUKE 1 player never the other...
3 Players on Hatelist will ONLY Nuke 2 of the players .. never the 3rd...
and so on...
Tested with 4 and it only would nuke 3 out of the 4.
Is there something wrong with the GetHateRandom?
Mob *HateList::GetRandom()
{
int count = 0;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
iterator.Advance();
count++;
}
if(!count)
return NULL;
int random = MakeRandomInt(0, count-1);
iterator.Reset();
for (int i = 0; i < random-1; i++)
iterator.Advance();
return iterator.GetData()->ent;
}
the Random seems to be (Count -1)
Then the For loop ... Removes another 1 from Random?
Is this possibly why it always cuts 1 player off the list?