Does anyone have a working damage system with dynamic health? I've been trying to make on and lets just say "I can't do stuff". It would be nice if you could share the code for me and other people who need it. Thanks!
EDIT:
Currently, the one I have is this.
package setMaxDamageEvent
{
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
if(%obj.OverHealth > 0)
{
if(%damage > %obj.OverHealth)
{
%damage = %damage - %obj.OverHealth;
%obj.OverHealth = 0;
}
else
{
%obj.OverHealth = %obj.OverHealth - %damage;
%damage = 0;
}
}
Parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
}
};
activatepackage(setMaxDamageEvent);
package SetMaxDamageMain
{
function Player::AddMaxHealth(%this,%AddMax)
{
%brickuser = %this.client.player;
%brickuser.OverHealth = (%brickuser.OverHealth+%AddMax);
}
function Player::SetMaxHealth(%this,%SetMax)
{
%brickuser = %this.client.player;
%brickuser.OverHealth = %SetMax;
}
function Player::SetMaxHealthByNoP(%this,%SetNoP)
{
%brickuser = %this.client.player;
%brickuser.OverHealth = (clientgroup.getCount() * %SetNoP);
}
function Player::AddMaxHealthByNoP(%this,%AddNoP)
{
%brickuser = %this.client.player;
%brickuser.OverHealth = ((clientgroup.getCount() * %AddNoP) + %brickuser.OverHealth);
}
};
registerOutputEvent("player", "AddMaxHealth" ,"string 4 40");
registerOutputEvent("player", "SetMaxHealthByNoP" ,"string 4 40");
registerOutputEvent("player", "AddMaxHealthByNoP" ,"string 4 40");
registerOutputEvent("player", "SetMaxHealth" ,"string 4 40");
Which is an old on that I found. There are probably lots of mistakes so it would help if you could make a new one or if you could improve this one. Thanks!