Hi today I made this free model called DamageHandler, that can process damage and do defence and stuff, and I think I did a pretty good job at it, but I want your feedback, so please tell me what I should change / add! this is the model ↓
This is the model that gets automaticly added ↓
How to use
Setup
Just download the DamageHandler
and then put it in the ServerScriptService, and you’re good to go!
Functions
TakeDamage()
Parameters
Attacker - Instance: The player of the attacker
DamageAmount - Integer: The amount of damage to deal
Returns
DamagedAmount - Integer: If done 10 damage but the character only took 5 damage then returns 5
Sample code
local DamageAmount = 10;
local Attacker = game.Players:GetPlayerFromCharacter(Tool.Parent);
--You set this value abouve to the player who is attacking the other.
DamageProcessor:TakeDamage(Attacker, DamageAmount);
Heal()
I have not done too much about this function at the moment.
Parameters
HealAmount - Integer: How much the character should heal.
Returns
HealedAmount - Integer: If HealAmount is 10 but the character only healed 5 then returns 5
Sample code
DamageProcessor:Heal(HealAmount);
Setting up base status
If you double click the Configuraion in the DamageHandler folder, you will see this ↓
This is the default status all players will receive.
When using the TakeDamage() function,
the DamageAmount get’s added to the attacker’s BaseDamage,
But the damage get’s subtracted by the defence of the attacked character.
What to do when you want to make a dummy take damage aswell?
If you put any instance named “DamageProcessorTicket” the script will automaticaly add the DamageProcessor module and the BaseStatus modlue to the dummy.
Also keep in mind that this is still in alpha so please don’t use for a real game yet.
And that’s about all you can do, thanks for you reading this, and I look forward to your feedback!
okay so, maybe it’s just me but I really don’t agree with damaging a player and then healing them immediately afterwards, imagine if you had a particle effect that appear when you heal, you will have to manually make a code that prevent the effect from appearing when dealing with defense
you put the DamageHandler folder in the ServerScriptService, you don’t need to put the DamageHandler-MainModule anywhere as it will get added automaticaly
If you already have this code in your module you don’t have to do anything.
So if you change the SoundId from default to your own then of course that will get played,
and if you want to set the sound group, then right below SoundId, SoundGroup = your SoundGroup
Every other properties are the same, you just put the Property name and the value next to it.
If you make TurnRedOnHit to false it wont make the character red when hit.
Thats not what I meant, anyways it shouldn’t make a difference even if you did do that. I’m wondering whats the point of this module, is it like for holding values in a table for specific entities?
well I mean woulden’t it be faster if you could just put a module that do all that stuff for you without having have to do it yourself, right? Isn’t that the point a free model?