Blockland Forums > Modification Help
setRepairRate making it negative
Kiwi:
The setRepairRate() function is a wonderful thing, but it can't be set to a negative number.
Is there anything that removes health like the setRepairRate function adds health?
Chrono:
setDamageLevel. Do math.
Kiwi:
--- Code: ---function Player::onDamage(%this,%obj,%delta)
{
Parent::onDamage(%this,%obj,%delta);
if(%delta > 0)
{
if(%obj.getState() !$= "Dead")
{
%obj.bleedStartSched1 = %obj.schedule(666,addHealth,-3);
%obj.bleedStartSched2 = %obj.schedule(1333,addHealth,-2);
%obj.bleedStartSched3 = %obj.schedule(2000,addHealth,-1);
}
}
}
--- End code ---
I want the player to bleed after he is hit for a short time but when he's hit he keeps loosing health.
It is because when health is removed onDamage is called again.
This is why I want a negative setRepairRate.
phflack:
couldn't you just have a function that takes a damage amount and a loopcount? sorta like a for loop i guess (in that it counts down a # of times, but is delayed)
Zloff:
Kinda like this add-on?