OOC Regen Enable/Disable
As a quick idea for a feature request I think that it might be good to have an option to disable the OOC Regen on an NPC. This could either be done by a setting in the NPC_Types table or even better would be via a quest command that could enable or disable it on the fly.
Here is the code that sets the OOC Regen. To disable it, we would just need to add in another check in the if statement to see if the NPC should use the OOC Regen bonus or not. If we were just making a setting in the NPC_Types table, then this could just check that setting in the table. But, if there was a way to make a quest command to change it on the fly, I think it would be best, but am not sure exactly how to do it. Maybe setting a new field in the NPC_Types table and then make a command that can change that field in real time to turn it on or off. npc.cpp Code:
sint32 OOCRegen = 0; |
don't we allready have a rule which set mobs OCC regen? If I set it to 0 - won't that work as disabled?
UPDATE: Ah I see - you want this to be done on the fly. could be usefull PS: Its about time we add PLAYER OOC regeneration =) |
Ya, that too does sound like a fun idea! Though, I would think it would need to be a bit more complex and scale up per level, but shouldn't be too hard to figure out a simple equation. I will see if I can write a rule or 2 for Player OOC regen. Maybe having 1 for the regen amount and another for level scaling. So, you could have it regen a level 1 character to full HPs in 15 seconds, but a level 70 character might take 1 minute or something if you wanted it to scale. Of course with an option to turn both off and use normal regen rates. That should be pretty easy code to write.
But, I would still like to see some ideas for how to disable OOC Regen on NPCs on the fly. There are only a few cases where I would want this, but for some advanced events, the fast OOC regen rates make the event harder to setup properly. For example, if you have a fight that once the NPC gets to 50% health, it goes ABH and whipes the aggro list and then players are supposed to do something else before the mob goes back to normal fight mode. |
Quote:
In main time, the OOC regen for players could be soemthing like (5+Level) per tick as a base with a Rule seting this from 100% and up (setting it to 0% will effectivly turn it to off) |
Quote:
As far as per-mob Out of Combat regen, I think the best way to handle this might be to set this in the Mob class (make it sint32 oocregen or something like that), have it default to whatever the rule is set to, and make a function, say SetOOCRegen, to change it. Then, just wrap it into the quest code so you can trigger it via quest. That way, you can execute it on sub EVENT_SPAWN if you want it on by default instead of setting it in the database, and change it whenever/wherever you want. I think this should just about do it: In zone/mob.h, around line 928, add Code:
sint16 hp_regen; Code:
#include "map.h" Code:
hp_regen = in_hp_regen; in zone/perl_mob.cpp, around line 5569, add Code:
XS(XS_Mob_SetOOCRegen); /* prototype to pass -Wmissing-prototypes */ Code:
newXSproto(strcpy(buf, "ClearFeignMemory"), XS_Mob_ClearFeignMemory, file, "$"); |
I just tried to compile the changes, and it looks like I didn't work the function correctly. If you put it around line 401 & add inline:
Code:
inline virtual void SetHP(sint32 hp) { if (hp >= max_hp) cur_hp = max_hp; else cur_hp = hp;} Of course, I also forgot the most important part: adding the check on whether or not to calculate OOC regen: in zone/npc.cpp, around line 558, change Code:
sint32 OOCRegen = 0; |
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. 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. |
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() { Code:
RULE_INT ( Character, OOCHPRegen, 0) //Regens this % of HPs per tick if not engaged with a mob (Disabled = 0) Optional SQL Code:
Insert into rule_values values (0, 'Character:OOCHPRegen', 0); |
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 |
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. |
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 |
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.
|
Quote:
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) |
Woah, they put OOC regen on live? LOL, they might actually be getting smarter :P
Either way, with the rule, you will be able to easily turn it on or off, or adjust the rate you want them to regen at. By setting the rule to 1, you would regen 1% per tick. So, if you wanted to regen from 0 to full in 3 minutes, you would just take 180/6 = 30, so 30 ticks, and if you set your rules to 3 (3 X 30 = 90), it would be pretty close to 3 minutes to regen full HPs or Mana. I think it is nice to have the option to enable/disable and increase/decrease the OOC Regen rates. As for the code to check if they are engaged, I see in command.cpp from the latest SVN that it uses: Code:
c->IsEngaged() I tried using something like that, but I don't know how to define "c" properly. I think if I could figure out how to do that, that it should probably work. Maybe something like this: Code:
if(c->IsEngaged()) |
Quote:
Note important thing to allow a rule to set diffirent scaling for OCC regen, cuase just setting it at % rate would make OOC regen identical (in time) for all levels and all mana pools. where my originaly proposed formula 5+level would slow down as you go up, to leave some room to force people to buy potions (which is good for economy) another good thing would be be a rule to turn OFF meditation =) The logical reason for this that if you have OOC regen, then casters also havign bonsu from meditation will get MASSIVE and unfair advantage over melees (specialy since in Emu you don't need to sit down to meditate - which means all the time figth goes on- you still meditating at full speed) |
All times are GMT -4. The time now is 08:56 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.