Armour / Damage System RPG-like?

Hi all!

I’m currently developing a 3rd person zombie shooter and would like to implement some kind of Clothing / Armour System to the player character.

I know how to put on & put off clothes, but not how for example any Roleplaying-Game is handling it with “the better the armour, the more damage will be absorbed!”.

If I damage the player, I just do: “health -= damage;”

Which value do I need to substract from the damage when for example the Helmet has 20 defense points and the T-Shirt 15?

I don’t think World of Warcraft is then substracting (20 + 15) from the damagevalue!

Thanks for all your answers!

Mike

Hi

there are a lot of ways to do this.
I assume that you have a script for your player with a method that takes damage.
Now you can add properties for things like armour. To calculate this it is depending on how you want your clothing take effect.
To give you a very basic example you could do something like this

damage = hitForce / currentArmor

Where damage is the value you will substract form the players health, hitForce is the force (damage) the enemy is hitting the player with and in currentArmor you sum up your armor values (helmet, t-shirt) (make sure currentArmor is at a minimum of 1, thanks scribe! )

basically there is no limitation to make this more complex if you want to have many types of armor, add poisoning or armour levelling etc.

hmmm… you can try something like this:
public class DefenseSystem : MonoBehaviour{
public static float defense;
public static bool isEquip;

    void Start(){
    defense = 0;
    isEquip = false;
    }
    
    void Update(){
    if(isEquip && isDamaged){//isDamaged is a static bool from the damaging script and damage is a static float value
    health -= defense - damage; //make sure health cannot reach higher then it's max value 
    }
    if(isDamaged && health == maxhealth)//if the damage was completly negated
    health -=1;//optional 
    }
}
}
}

I hope this helps. Tell me how it works