Page 1 of 1

Method to execute script when vitals are regened

Posted: Fri Apr 28, 2006 11:18 am
by tekproxy
How difficult would it be to implement some sort of function that is called when a stat point is gained? Meditation is suposed to increase whenever a player gains a point of mana and it is also suposed to increase the rate at which the player regenerates.

Currently I understand that it would only be possible to affect the rate gain. Perhaps by calling RecalcVitals() on a player whenever they gain a point of intelligence or meditation, which then checks the regen rate of that stat, which could then be changed to reflect the new skill/stat. But getting Meditation to have a chance to increase whenever a point of mana is regenerated wouldn't be easy. The only way I can think of would be to have some sort of script sitting on the player checking every second and if it notices a change in mana from the time before, award some points.

Is there a way a more elegant solution could be afforded by the core? Something like defining a regen function in vitals.cfg that is called whenever that point is regenerated. This could also help in implementing Focus, which is the same thing except more for strength and stamina (but also affects meditation).

If I'm incorrect in any of this, please let me know.

Posted: Fri Apr 28, 2006 8:11 pm
by MuadDib
Yeah, there is.

Have a passive med script fire on char logon etc, and use it to award points during it's loop, whenever mana is less than max. Be careful of the speed of your wait, make sure it's no to insanely fast.

Re: Method to execute script when vitals are regened

Posted: Fri Apr 28, 2006 8:56 pm
by tekproxy
tekproxy wrote:The only way I can think of would be to have some sort of script sitting on the player checking every second and if it notices a change in mana from the time before, award some points.
I thought that wouldn't be very clean but you know what you're talking about so I'll believe you! :-D

Thanks.