Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-15-2010, 10:16 PM
Wolftousen
Sarnak
 
Join Date: Apr 2008
Posts: 49
Default COMMITTED: Spawn Variance

Was confused as to why a certain spawn kept going off at the same spawn time even though it had variance set in the database entry.

Went and found out that the function that controls spawn time has some minor bugs that prevent variance from working properly:

zone/spawn2.cpp rev 1488:

Code:
int32 Spawn2::resetTimer()
{
	int32 rspawn = respawn_ * 1000;
	
	if (variance_ != 0) {
		int var_over_2 = variance_/2;
		rspawn = MakeRandomInt(rspawn - var_over_2, rspawn + var_over_2);
		
		//put a lower bound on it, not a lot of difference below 100, so set that as the bound.
		if(rspawn < 100)
			rspawn = 100;
	}
	
	return (rspawn);
	
}

this should be:
Code:
int32 Spawn2::resetTimer()
{
	int32 rspawn = respawn_ * 1000;
	
	if (variance_ != 0) {
		int var_over_2 = (variance_ * 1000) / 2;
		rspawn = MakeRandomInt(rspawn - var_over_2, rspawn + var_over_2);
	}
	
	return (rspawn);
	
}

The if statement that tests rspawn < 100 prevents the spawn time from varying to be less than it's base.

Not multiplying variance_ by 1000 means it is not operating in seconds, but something smaller (micro seconds i think, i forget...).
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 03:21 AM.


 

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