Hey everyone!
I’m working on a “Life” Simulator, and I don’t know how to make
health and fall damage. Does anyone know a script, that has health, and the higher you fall from the more damage you take? Thanks for reading
No one will give you that script at all. Just think about it. Just ask questions as to how to make the simplest thing. How much hp do I have? How much hp can I have? How high do I need to be to get hurt and if I fall longer should I get hurt more?
So then, you obviously need currentHP
and maxHP
variables. Then you will need capableFallHeight
which could be used to determine how much a player can fall without being hurt, and anything passed that hurt the player. Ok, then all we need is how much should I get hurt if I fall too much. For every 1 foot the player falls he gets hurt -20hp. So, if I pass the capableFallHeight
threshold, every fallDistance
=> 1 foot add on -20hp from player