Prevent fall damage or falling death: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
LordMisfit (talk | contribs)
mNo edit summary
LordMisfit (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:
<pre>
<pre>
getplayer[THISACTOR].falling_counter fallcounter
getplayer[THISACTOR].falling_counter fallcounter
ifvarg fallcounter 61
ifvarg fallcounter 60 // not 61, because there's a slim chance the number won't set properly in time
{
{
   setvar fallcounter 61 // any value under 62 is non-fatal
   setvar fallcounter 60 // any value under 62 is non-fatal
   setplayer[THISACTOR].falling_counter fallcounter
   setplayer[THISACTOR].falling_counter fallcounter
}
}
Line 22: Line 22:
<pre>
<pre>
getplayer[THISACTOR].falling_counter fallcounter
getplayer[THISACTOR].falling_counter fallcounter
ifvarg fallcounter 8
ifvarg fallcounter 7 // not 8, because there's a slim chance the number won't set properly in time
{
{
   setvar fallcounter 8 // any value under 9 does no damage
   setvar fallcounter 7 // any value under 9 does no damage
   setplayer[THISACTOR].falling_counter fallcounter
   setplayer[THISACTOR].falling_counter fallcounter
}
}

Latest revision as of 16:03, 16 October 2007

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 // not 61, because there's a slim chance the number won't set properly in time
{
  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 // not 8, because there's a slim chance the number won't set properly in time
{
  setvar fallcounter 7 // any value under 9 does no damage
  setplayer[THISACTOR].falling_counter fallcounter
}