Fleeing MOBs
			 
			 
			
		
		
		
		If your feeling adventurous, here's a hack to enable fleeing MOBs that uses the existing Fear spell code. The Z axis pathing isn't that great (probably very bad for dungeons). 
Line numbers are approximate! 
 
 
Source/zone/features.h 
Line: 108 
< //#define ENABLE_FEAR_PATHING 1 
--- 
> #define ENABLE_FEAR_PATHING 1 
 
 
 
Source/zone/mob.h 
Line: 1874 
< 	uint8 fear_state; 
--- 
> 	uint8 fear_state; 
>	uint8 flee_state; 
 
 
 
Source/zone/mob.h 
Line: 219 
< 	fearStateStuck 
< }; 
--- 
>	fearStateStuck 
> }; 
 
> enum {	//flee states 
> 	fleeStateNotFleeing = 0,		 
>	fleeStateFleeing 
> }; 
 
 
 
Source/zone/mob.cpp 
Line: 313 
<	fear_state = fearStateNotFeared; 
--- 
>	fear_state = fearStateNotFeared; 
> 	flee_state = fleeStateNotFleeing;  
 
 
 
Source/zone/attack.cpp 
Line: 3515 
< 	//unsigned char test[sizeof(Action_Struct)]; 
--- 
> //#ifdef ENABLE_FEAR_PATHING 	 
 
>	//flee if HP low 
>	if ((flee_state == fleeStateNotFleeing) && (GetHPRatio() <= 20)) 
> 	{		 
>		SetFeared(other, 600 ); 
> 		flee_state = fleeStateFleeing; 
> 	} 
 
> //#endif 
	 
>	//unsigned char test[sizeof(Action_Struct)]; 
 
 
 
MobAI.cpp 
Line: 485 
<	if(fear_state != fearStateNotFeared) { 
--- 
>	if(fear_state != fearStateNotFeared) { 
		 
>		//stop fleeing if HP recovered 
>		if (flee_state != fleeStateNotFleeing && GetHPRatio() > 20)  
>		{ 
>			flee_state = fleeStateNotFleeing; 
>			fear_state = fearStateNotFeared; 
>		} 
 
 
 
Isues: 
-Some MOBs on the current DB have no regen therefore their HP will never recover and they will never stop fleeing. 
-A high level MOB will flee from a low level PC. 
-Assisted MOBs will flee. 
-MOBs flee at full speed regardless of HP. 
-Some MOBs should never flee. 
-Z axis pathing is incorrect. 
		
	
		
		
		
		
		
		
		
		
		
	
		
			
			
			
			
				 
			
			
			
			
			
			
				
			
			
			
		 
		
	
	
	 |