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

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-13-2013, 12:42 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default Get Hate Random bugged?

Code:
	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?

Code:
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?
Reply With Quote
 


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 02:18 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