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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2008, 02:43 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default Flee Patch to stop mobs fleeing if other mobs are also in combat against the player

Here is a patch to implement changes to flee such that mobs won't flee if the player at the top of their hatelist
has other mobs on their hatelist which are not green cons, feared/fleeing or mezzed and are within aggro range of the
player.

http://www.rama.demon.co.uk/smartflee.patch

The main change is a new method added to the HateList class:

Code:
int32 HateList::GetHatedCount(Mob *hater, bool CountGreens, bool CountFearedOrMezzed, bool RangeCheck)
I also added Mob::IsFeared which returns the state of the curfp flag.

The final change is to call HateList::GetHatedCount from CheckFlee

Oh, and I added a rule:

Code:
RULE_BOOL ( Combat, FleeIfNotAlone, false) // If false, mobs won't flee if other mobs are in combat with it.
The default value (false) enables the new code. Setting it to true will make the mob flee like at present even
if there are other mobs in combat.

Last edited by KLS; 06-13-2008 at 01:44 AM..
Reply With Quote
  #2  
Old 06-12-2008, 10:05 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

I just caught this one, I'll give it a run, thanks!
Reply With Quote
  #3  
Old 06-13-2008, 12:32 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Nice! The fleeing code is really getting cleaned up and tuned nicely! Thanks for another nice update, Derision! I will give this a shot as well when I get back from vacation.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 06-13-2008, 07:21 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I was just looking at this code again, and I obviously never tested this patch with FleeIfNotAlone
set to true (i.e. the new code disabled). If FleeIfNotAlone==true, then the mobs won't flee at all.

After applying the patch in my original post. change the rule check in fearpath.cpp from:

Code:
if(!RuleB(Combat, FleeIfNotAlone) && hate_top->hate_list.GetHatedCount(hate_top, false, false, true)<=1)
	StartFleeing();
to:

Code:
if(RuleB(Combat, FleeIfNotAlone) || (!RuleB(Combat, FleeIfNotAlone) && hate_top->hate_list.GetHatedCount(hate_top, false, false, true)<=1))
	StartFleeing();
Then the rule should work correctly to disable the new functionality if required when FleeIfNotAlone is set to true.
Reply With Quote
  #5  
Old 06-18-2008, 10:03 AM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default

This will be in version 1113.
__________________
Maybe I should try making one of these servers...
Reply With Quote
  #6  
Old 06-27-2008, 10:52 AM
Aramid
Discordant
 
Join Date: May 2006
Posts: 356
Default

Was looking thru the 1118 code in fearpath.cpp and this is how it is now.
Code:
if( RuleB(Combat, FleeIfNotAlone) 
		  || ( !RuleB(Combat, FleeIfNotAlone) 
		    && hate_top->hate_list.GetHatedCount(hate_top, false, false, true)< 2 ) )
			StartFleeing();
In Derision's code, it's <=1 , not <2. Which is the correct value?
Probably has the same effect no matter which number.
__________________
Random Segments of Code....
Reply With Quote
  #7  
Old 06-27-2008, 02:44 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

<=1 and <2 are equivalent (as the return value being checked is an integer). I don't know why it was changed.
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 08:17 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3