Prevent fall damage or falling death

From EDukeWiki
Revision as of 22:45, 15 October 2007 by LordMisfit (talk | contribs) (minor fix based on extensive testing)
Jump to navigation Jump to search

The following code can be used to prevent the player from either receiving fall damage, or from hitting 'terminal velocity', which results in death upon hitting the ground.

You'll need a single gamevar to hold the value of falling_counter.

gamevar fallcounter 0 1

Inside the APLAYER actor, use the following code to restrict the falling counter to prevent falling deaths:

getplayer[THISACTOR].falling_counter fallcounter
ifvarg fallcounter 60
{
  setvar fallcounter 60 // any value under 62 is non-fatal
  setplayer[THISACTOR].falling_counter fallcounter
}

To prevent ANY fall damage to the player, change it to the following

getplayer[THISACTOR].falling_counter fallcounter
ifvarg fallcounter 7
{
  setvar fallcounter 7 // any value under 9 does no damage
  setplayer[THISACTOR].falling_counter fallcounter
}