Fall Damage
Usage
Pretty simple script, noticed it didn’t exist. All it does is check if the player has suddenly come to a stop on the Z axis, by some threshold, then applies the difference in damage.
You can set the threshold via the minimumVelocity property on the script
Usage
Drag the Fall Damage template onto the player
Drag the Fall Damage template onto the player
Advanced Usage
The fall damage script provides some useful properties
The fall damage script provides some useful properties
- damageMultiplier - this multiplies the damage applied to the player when they take fall damage. You can set this to 0 temporarily to make the player immune to fall damage, or increase it to take increased fall damage due to some debuff, etc.
- There are sound/effect/vibration properties you can use to customize the impact of hitting the ground
In addition, there are some utility functions available, if you’re scripting:
- PreventDamage(force) - If the user is falling and this is called, the user will not take damage when they hit the ground. If called with a paramter of true, the player will not take the next instance of fall damage, even if they’re not falling when you call it.
- AllowDamage() will cancel any PreventDamage(true) calls called in the past
- PauseDamage(time) will page fall damage for the given number of seconds. Calling AllowDamage, PreventDamage, or PauseDamage again will cancel any other pause. PreventDamage will only cancel the pause if it’s forced, or if you’re at the minimum velocity already