View Single Post
  #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