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
  #2  
Old 03-13-2013, 02:17 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by NatedogEZ View Post
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?
Yes, that's actually why. If there's 6 people in a group, random = 5, 0-5 would be chosen.

Then, it chooses between 0-4 when it does the for loop.

That is precisely why.
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 12:49 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