Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-16-2003, 02:39 AM
Armanthuz
Sarnak
 
Join Date: Apr 2003
Posts: 72
Default fixed aggro and z-radius bug from 5/5 CVS compile

from module zone/mobai.cpp

starts at line 201


Code:
Mob* EntityList::AICheckCloseArrgo(Mob* sender, float iArrgoRange, float iAssistRange) {
	if (sender->GetPrimaryFaction() == 0)
		return 0; // well, if we dont have a faction set, we're gonna be indiff to everybody
    LinkedListIterator<Entity*> iterator(list);
	iterator.Reset();
	int8 RandRoll = rand()%100;
	float dist,distZ;
	int leveldif;
    while(iterator.MoreElements()) {
		if (iterator.GetData()->IsMob() && !iterator.GetData()->IsCorpse() && iterator.GetData() != sender) {
			Mob* mob = iterator.GetData()->CastToMob();
			FACTION_VALUE fv = FACTION_INDIFFERENT;
			fv = mob->GetFactionCon(sender);
			dist = mob->Dist(sender);
			distZ = sender->GetZ()-mob->GetZ();
			leveldif = mob->GetLevel() - sender->GetLevel();
			if (leveldif < 0){
				leveldif=0;
			}
			if (fv <= FACTION_AMIABLE
				&& mob->IsEngaged()
				&& mob->GetTarget()
				&& dist <= (iAssistRange-leveldif)
				&& (mob->GetINT() <= 100 || mob->GetTarget()->GetLevelCon(sender->GetLevel()) != CON_GREEN)
				&& sender->Dist(mob->GetTarget()) <= (iAssistRange * 2)
				) {
				return mob->GetTarget();
			}
			else if (
				!(mob->IsClient() && mob->CastToClient()->GetGM())
				&& mob->InZone()
				&& (fv == FACTION_SCOWLS || (fv == FACTION_THREATENLY && RandRoll < THREATENLY_ARRGO_CHANCE))
				&& !mob->IsInvisible() 
				&& dist <= (iArrgoRange - leveldif)
				&& (distZ > -10 && distZ < 10)
				&& (sender->GetINT() <= 75 || mob->GetLevelCon(sender->GetLevel()) != CON_GREEN)
				) {
				return mob;
			}			
		}
		iterator.Advance();
	}
	return 0;
}


I also reduced all aggroradius on mobs to 65 from 85. I feel this is a good compromise given that you cant do LOS checks and chain aggro gets silly otherwise....
Reply With Quote
  #2  
Old 05-19-2003, 02:51 PM
Bigpull
Discordant
 
Join Date: Feb 2003
Posts: 305
Default

So uhm basicly what you did was removed everything you didn't understand, slowed down the proccessing and removed a whole bunch of checks that really need to be there. (invisable, for instance). And after all that still use my screwed up zaxis formula!

There needs tobe a zone flag (indoor/outdoor) it's not there yet.
There needs tobe a zAgro added to npc_types.

You check the zone flag when you spawn a mob from the db, if the mob has a no zAgro set (-1 for default, 0 none ect) it gets a default formula.

In an outdoor zone z agro is basicly agro radius extended around to make a sphere, you can set the zAgro of an npc so it will not extend thru floors. For example if you wanted to remove the chain agro from a Guard in the top of a tower when the lower one was pulled, Or makeing the bandits on the highpass ramp agro from far ahead on the path, and not agro people walking up the gorge (they aren't paratroopers afterall). You need this for zones like blackburrow, city of mist and cazicthule.

If its an indoor zone it will get another default, something like 5-10 should keep most mobs from comeing thru floors and ceilings. In these zones you may want to tweak the zAgro up for mobs guarding stairs and ramps. Then you can do fun stuff like only agro an pc standing outside tormax with that uber rare spawn dog that agros from below >=)

anyways..

Code:
distZ = sender->DistZ(mob);
and
Code:
float Mob::DistZ(Mob* other){
 return sqrt((double)(pow(other->z_pos-z_pos, 2)));
}
or
Code:
distZ = sender->Dist(mob) - sender->DistNoZ(mob);
Is what you were looking for
Reply With Quote
  #3  
Old 05-20-2003, 10:26 AM
Armanthuz
Sarnak
 
Join Date: Apr 2003
Posts: 72
Default

sorry if i offended anyone... i was frustrated with not having working aggro so i decided to try my best..


My abilities are severely limited yes, this is a learning project for me..

the zaxis formula i pretty much came up with myself, if i ended up copying yours.. its not rocket science...


There is an invis check there and i tested it in sebilis, it seems to work....

the code is prolly slow as molasses yes, i dont have a clue there...




I understand how and why aggro works pretty well. I couldnt understand your code well at all no. So i went back and pulled old code that was easier to read and re wrote sections of it to fix the problem i was having.


/shrug this was meant to be more of a temporary fix until people have time to do it right, better whatever....
Reply With Quote
Reply


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 05:30 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