Fall damage

How to damage your characters health when they fall a distance


In many adventure games, your character will die if they fall too far, as the damage from the fall is too great to survive. This tutorial will set up a fall damage mechanic. As seen in games such as Tomb Raider, Far Cry, Assassins Creed (and many others). Dont forget you will need a respawn mechanic if you are going to kill your player character.


This is put in your player brain.

page 1

WHEN DO [call page][text:Falling]

page 2 : name page Falling

This will set up your position vectors for when you start to fall and when you stop falling (i.e. hit land, a prop, or water)

WHEN [started to][is falling] DO [vectorvar:start fall][=][position]
WHEN [no longer][falling] DO [vectorvar:end fall][=][position]

This will calculate the distance you have fallen (the difference between the 2 numbers)

…WHEN DO [numvar:fall distance][=][vectorvar:start fall][y][-][vectorvar:end fall][y]

Now we will set up the damage. You can set it to cause different levels of damage depending on height. A jump will create a fall of about 2 and a double jump 4, so make sure you do not cause damage at heights lower than this, or if you have changed the jump height, to whatever the maximum jump height is.

(Now you could change the end and start position lines by read [falling] [and][not][jumping], and then it would only register damage if the player falls and does not jump – however a player could jump from a high tower and survive the fall with this method – but this may be suitable for your game, your choice).

…WHEN [numvar:fall distance][>][15] DO [kill][me]
…/…WHEN [else]
…/…/…WHEN [numvar:fall distance][>][10] DO [damage][40]
…/…/…/…WHEN [else]
…/…/…/…/…WHEN [numvar:fall distance][>][5] DO [damage][20]

Now, you may want a mechanic so that if they fall into water they do not get any damage. Add like this:

WHEN [numvar:fall distance][>][10] [and][not][swimming] DO [damage][40]

If you want your death distance into water to be greater than on land

WHEN [numvar:fall distance][>][40] [and][not] [swimming] DO [kill][me]
…WHEN [else]
…/…WHEN  [numvar:fall distance][>][50] [and][swimming] DO [kill][me]


Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: