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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-20-2007, 08:30 AM
TheLieka
Developer
 
Join Date: Oct 2004
Location: THE ATL (wut wut)
Posts: 325
Default NPC Out of Combat Regen

Request from thread:
http://www.eqemulator.net/forums/showthread.php?t=23824

On Live NPCs regen at a much higher rate when they are out of combat, on Emu they regen at the same rate, inside or outside of combat. Here is my fix for that.

change .\zone\npc.cpp (inside the bool NPC::Process() function)
Code:
		if(GetHP() < GetMaxHP()) {
			if(GetOwnerID()!=0 && !IsEngaged()) //pet
				SetHP(GetHP()+hp_regen+bonus+(GetLevel()/5));
			else
				SetHP(GetHP()+hp_regen+bonus);
		}
to
Code:
		float MobOOCRegen = 0;
		char val[10] = {0};
		if(database.GetVariable("NPCOOCRegen", val, 10)){
		MobOOCRegen = atoi(val);
		MobOOCRegen *= 0.01;
		MobOOCRegen *= GetMaxHP();
		}
		//Lieka Edit:  Fixing NPC regen.  NPCs should regen to full during a set duration, not based on their HPs.  Increase NPC's HPs by % of total HPs / tick.
		if((GetHP() < GetMaxHP()) && !IsPet()) {
			if(!IsEngaged()) //NPC out of combat
				SetHP(GetHP() + hp_regen + MobOOCRegen);
			else
				SetHP(GetHP()+hp_regen);
		} else if(GetHP() < GetMaxHP() && IsPet()) {
			if(!IsEngaged()) //pet
				SetHP(GetHP()+hp_regen+bonus+(GetLevel()/5));
			else
				SetHP(GetHP()+hp_regen+bonus);
		} else SetHP(GetHP()+hp_regen);
Required SQL:
Code:
insert into `variables` values ('NPCOOCRegen', 0, 'Out of Combat Regen % for NPCs. 0 to disable.', '2007-12-20 12:00:00');
Set the Variable "NPCOOCRegen" to whatever percentage of NPC health should be regenerated per tick. By default it is turned off (with this SQL insert).

Dax
__________________
Daxum



Former ServerOp - Vallon Zek / Tallon Zek Emu Server - Legit / Guild PvP - (2007 - 2011 RIP)
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 06:41 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