|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum) |
 |
|
 |

10-07-2008, 05:27 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I think that code looks really good accept I don't think you want this:
npc.cpp
Code:
//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() && oocregen > 0) //NPC out of combat
SetHP(GetHP() + hp_regen + OOCRegen);
Because with that set, NPCs wouldn't regen at all out combat even with their natural regen setting unless oocregen was set. I think you would need to check which is higher and use that instead. Maybe something like this:
Code:
//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
if(hp_regen > OOCRegen)
SetHP(GetHP() + hp_regen);
else
SetHP(GetHP() + OOCRegen);
} else
SetHP(GetHP()+hp_regen);
} else if(GetHP() < GetMaxHP() && GetOwnerID() !=0) {
if(!IsEngaged()) //pet
SetHP(GetHP()+hp_regen+bonus+(GetLevel()/5));
else
SetHP(GetHP()+hp_regen+bonus);
} else
SetHP(GetHP()+hp_regen);
if(GetMana() < GetMaxMana()) {
SetMana(GetMana()+mana_regen+bonus);
}
I think that should work for almost any scenario. The only thing I can think of that might be worth considering would be a way to make an NPC stop regening completely when out of combat but still regen while in combat by the amount set in the npc_types table. But, if you absolutely had to do that, you could still do it via current quest commands fairly easily when needed.
|
 |
|
 |
 |
|
 |

10-07-2008, 06:53 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I am not sure if the IsEngaged() check works for players, but if so, I think this code might work for character OOC regen:
client_process.cpp
Code:
void Client::DoHPRegen() {
if(GetHP() < GetMaxHP()) { //Don't do HP regen if HPs are full
int32 level=GetLevel();
int32 oochpregen = 0;
int8 oocwaittime = 0;
sint32 normal_regen = LevelRegen();
sint32 item_regen = itembonuses.HPRegen;
sint32 spell_regen = spellbonuses.HPRegen;
sint32 total_regen = normal_regen + item_regen + spell_regen;
if(IsEngaged()) {
oochpregen = 0;
oocwaittime = 0;
}
if(IsCasting() && RuleB(Character, OOCRegenCastCheck)) {
oochpregen = 0;
oocwaittime = 0;
} else {
if(oocwaittime >= RuleI(Character, OOCRegenWaitTicks)) {
oochpregen += GetMaxHP() * RuleI(Character, OOCHPRegen) / 100;
oochpregen -= level / RuleI(Character, MaxLevel) * oochpregen * RuleI(Character, OOCRegenLevelScale) / 100;
} else
oocwaittime = oocwaittime++;
}
total_regen = ((total_regen * RuleI(Character, HPRegenMultiplier)) / 100) + oochpregen;
SetHP(GetHP() + total_regen);
SendHPUpdate();
}
}
void Client::DoManaRegen() {
if(GetMana() < GetMaxMana()) { //Don't do mana regen if mana is full
int32 level=GetLevel();
int32 regen = 0;
int8 oocwaittime = 0;
int32 oocmanaregen = 0;
if(IsEngaged()) {
oocmanaregen = 0;
oocwaittime = 0;
}
if(IsCasting() && RuleB(Character, OOCRegenCastCheck)) {
oocmanaregen = 0;
oocwaittime = 0;
} else {
if(oocwaittime >= RuleI(Character, OOCRegenWaitTicks)) {
oocwaittime = oocwaittime++;
oocmanaregen += GetMaxMana() * RuleI(Character, OOCManaRegen) / 100;
oocmanaregen -= level / RuleI(Character, MaxLevel) * oocmanaregen * RuleI(Character, OOCRegenLevelScale) / 100;
} else
oocwaittime = oocwaittime++;
}
if (IsSitting() ||(GetHorseId() != 0)) { //this should be changed so we dont med while camping, etc...
if(HasSkill(MEDITATE)) {
medding = true;
regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
CheckIncreaseSkill(MEDITATE, -10);
}
else
regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
}
else {
medding = false;
regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
}
//AAs
regen += GetAA(aaMentalClarity) + GetAA(aaBodyAndMindRejuvenation);
regen = ((regen * RuleI(Character, ManaRegenMultiplier)) / 100) + oocmanaregen;
SetMana(GetMana() + regen);
SendManaUpdatePacket();
}
}
ruletypes.h
Code:
RULE_INT ( Character, OOCHPRegen, 0) //Regens this % of HPs per tick if not engaged with a mob (Disabled = 0)
RULE_INT ( Character, OOCManaRegen, 0) //Regens this % of Mana per tick if not engaged with a mob (Disabled = 0)
RULE_INT ( Character, OOCRegenLevelScale, 0) //OOC Regen will scale down per level (0 = scaling disabled, 1 = least scaling, 100 = most)
RULE_INT ( Character, OOCRegenWaitTicks, 0) //OOC Regen will wait this many ticks after combat before starting Out of Combat Regen
RULE_BOOL ( Character, OOCRegenCastCheck, false) //OOC Regen will be stopped if player is casting and this rule is set to true
Note that setting OOCRegenLevelScale to 100 will make it so that a max level character will not get any OOC Regen bonus at all, but a level 1 will still get almost the full bonus and as they level up the bonus will get less and less.
Optional SQL
Code:
Insert into rule_values values (0, 'Character:OOCHPRegen', 0);
Insert into rule_values values (0, 'Character:OOCManaRegen', 0);
Insert into rule_values values (0, 'Character:OOCRegenLevelScale', 0);
Insert into rule_values values (0, 'Character:OOCRegenWaitTicks', 0);
Insert into rule_values values (0, 'Character:OOCRegenCastCheck', false);
I will try this out and post back on how this and the code AndMetal posted work if at all 
Last edited by trevius; 11-16-2008 at 04:15 PM..
|
 |
|
 |
 |
|
 |

10-07-2008, 08:44 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Good and bad news!
The code I wrote for player OOC HP and Mana regen does work, but it doesn't seem to actually check if you are engaged or not. So, the !IsEngaged check isn't working. If someone knows how to check that for players, then it should be able to be added and get this code working right away. It did compile just fine, but the way it is now, it will regen at the OOC rates whether you are engaged or not.
The good news is that AndMetal's code with my modifications works perfectly! Here is an example quest that I tested and that works exactly as intended:
Code:
#OOC Regen Test
sub EVENT_SAY {
if ($text=~ /Hail/i){
quest::say("I can set the OOC regen rates to 0, 5, 10, or 20. Just ask for the number and I will set it right now.");}
if ($text=~ /^0$/i ){
$npc->SetOOCRegen(0);
quest::say("Setting OOC Regen to 0");}
if ($text=~ /5/i){
$npc->SetOOCRegen(5);
quest::say("Setting OOC Regen to 5");}
if ($text=~ /10/i){
$npc->SetOOCRegen(10);
quest::say("Setting OOC Regen to 10");}
if ($text=~ /20/i){
$npc->SetOOCRegen(20);
quest::say("Setting OOC Regen to 20");}
}
Using this quest, I was able to set the regen rates in real time while the mob was out of combat. If it is set to 0, the NPC will regen at whatever normal amount it is set to from the npc_types table. If it is in combat, the OOC code will not effect it at all. Note that it won't set the OOC higher than a certain amount. I tried setting it to 50 and it was the same as setting it to 0, so there may be some kind of cap.
Last edited by trevius; 10-07-2008 at 04:51 PM..
|
 |
|
 |

10-07-2008, 10:36 AM
|
Dragon
|
|
Join Date: Feb 2007
Posts: 659
|
|
PC OOC regen on live is done like so:
Take total mana pool and divide it by 30. That gives you three minutes to go to full mana from 0. There are 30 "ticks" in 3 minutes. Nice thing is it scales based on the size of the mana pool.
|

10-07-2008, 12:09 PM
|
Demi-God
|
|
Join Date: May 2007
Posts: 1,032
|
|
Trev, for players you would prabobly need to check if player is on any mob hate list.
Andrew80k, 3 min for any player of any lev to get to FM is bad imho, it would be better for gameplay if high lev player ooc downtime would stil be greater than for low lev player. But I guess if we figure out player occ regen at all, the rules can handle the rest
|

10-07-2008, 12:11 PM
|
Dragon
|
|
Join Date: Feb 2007
Posts: 659
|
|
Chaos, I think you'd be surprised at how long 3 minutes is in game. But indeed a rule for that would handle it. It's just a matter of figuring out the formula and applying the rule.
|

10-07-2008, 12:35 PM
|
Demi-God
|
|
Join Date: May 2007
Posts: 1,032
|
|
Quote:
Originally Posted by Andrew80k
Chaos, I think you'd be surprised at how long 3 minutes is in game. But indeed a rule for that would handle it. It's just a matter of figuring out the formula and applying the rule.
|
considering that i used to sit on my but for 15-20 min back on live -3 min gona be a breeze =)
i havent played on eq1 when they implemented OCC regen, but on EQ2 under lev 5 you regenerate from almost 0 (hp and mana) to full in about 30 seconds, but it starts to slow down as you level (the numbers of hp and mana pool on eq2 are MUCH larger however. My lev 35 druid had like 2k hp and 4k mana and that was considered poor). I think at lev 80 it takes like 10 min.
But thats what hp/mn regene foods are for
ANorher thing that on eq2 there is no meditation (not during combat not ever) all classes melee or caster all regen hp and mana at same rate in and out of combat (not counting buffs and items of course)
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 01:05 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |