Author Topic: Working Damage System  (Read 866 times)

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.
Code: [Select]
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!
« Last Edit: October 12, 2013, 08:50:11 PM by xXDeadwolf456Xx »

You pretty clearly don't know how events work. I would help you more but unfortunately all my Blockland files are tied up in copying right now. Download and look at some output events in other mods, that should help you.

That's not my events. Its a friends that he made but let me have. he said it worked but after I used it, it turned out it didn't.


That's not my events. Its a friends that he made but let me have. he said it worked but after I used it, it turned out it didn't.
This is mine..

Who gave you this?

EDIT: I had this code for about a year when I was trying to figure out how Pecon did his custom health for bosses, I figured it out now. This was just some weird way to have modded health.

The file I had was like Event_MaxHealth, so I am guessing you have this file as well. Someone obviously gave you this. If I did (I am Visolator), then somehow I wasn't thinking correctly, unless it made sense why I gave it to you, but it doesn't really work well anyways.
« Last Edit: October 13, 2013, 12:15:59 PM by Advanced Bot »