Author Topic: dynamic health system  (Read 2480 times)

so Blocklands health/damage system is really pretty weird.

as a general rule of thumb player datablocks determine the max amount of 'health' a player can have, which is actually done backwards, how much damage the player can take.

I need to allow the player to have more health based on their level, I cannot create a new datablock for every single level.

I was thinking create a datablock with maxdamage at like 50000 (this would set a cap which is undesirable to begin with), then using the current level and such damage the player so that he would have his amount of health.

The problem is whenever a player spawns the get the deep red flash basically thinking they're dead, it's sloppy and annoying.

Is there any way to create a limitless and organized dynamic health system?

nevermind

I just scaled damage inside the Armor::OnDamage function

here's the full code if anyone ever needs it:

Code: [Select]
function Armor::Damage(%this,%obj,%sourceObject,%position,%damage,%damageType)
{
if(%obj.client.getClassName() $= "GameConnection")
{
%scale = %this.maxDamage / $MonsterRPG::Data::ID[%obj.client.bl_id,maxHealth];
%damage *= %scale;
return parent::Damage(%this,%obj,%sourceObject,%position,%damage,%damageType);
}
}

nevermind

I just scaled damage inside the Armor::OnDamage function

here's the full code if anyone ever needs it:

Code: [Select]
function Armor::Damage(%this,%obj,%sourceObject,%position,%damage,%damageType)
{
if(%obj.client.getClassName() $= "GameConnection")
{
%scale = %this.maxDamage / $MonsterRPG::Data::ID[%obj.client.bl_id,maxHealth];
%damage *= %scale;
return parent::Damage(%this,%obj,%sourceObject,%position,%damage,%damageType);
}
}
If you don't have that scale variable set, they will be invincible

yes, the solution to this is to scale damage.

confirmed with lugnuts stamp of approval

If you don't have that scale variable set, they will be invincible
I have it set in my script, I removed the line, you are correct

yes, the solution to this is to scale damage.

confirmed with lugnuts stamp of approval
thanx

yes, the solution to this is to scale damage.

confirmed with lugnuts stamp of approval
Or you could give the player an extra health variable, and make it so they're not actually damaged until the extra health variable gets to 0. So instead, if the extra health variable isn't 0, it goes %player.extraHP -= %damage.

Or you could give the player an extra health variable, and make it so they're not actually damaged until the extra health variable gets to 0. So instead, if the extra health variable isn't 0, it goes %player.extraHP -= %damage.

Result: No red flash until you're nearly dead.

Result: No red flash until you're nearly dead.

Solution: Write your own ::damage and ::onDeath functions.

Solution: Write your own ::damage and ::onDeath functions.
or scale damage and don't do extra unneeded work

or scale damage and don't do extra unneeded work

Writing your own damage system is a lot more flexible.

Writing your own damage system is a lot more flexible.
if you need it to be

i can think of many applications that type of flexibility isn't needed.

if you need it to be

i can think of many applications that type of flexibility isn't needed.

I can think of many applications where it is needed.


okay seriously now you guys are just being richards

your glorious entire rewritten damage systems are amazing and cool and stuff but you know what

op does not need that much stuff

scaling damage will work fine for op

okay seriously now you guys are just being richards

your glorious entire rewritten damage systems are amazing and cool and stuff but you know what

op does not need that much stuff

scaling damage will work fine for op

Result: No red flash until you're nearly dead.

Solution: Write your own ::damage and ::onDeath functions.

I was just answering somebody :panda: