Prevent fall damage or falling death: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
LordMisfit (talk | contribs)
m small tutorial >.>
 
LordMisfit (talk | contribs)
No edit summary
Line 14: Line 14:
{
{
   setvar fallcounter 61 // any value under 62 is non-fatal
   setvar fallcounter 61 // any value under 62 is non-fatal
   setactor[THISACTOR].jumping_counter fallcounter
   setplayer[THISACTOR].jumping_counter fallcounter
}
}
</pre>
</pre>
Line 25: Line 25:
{
{
   setvar fallcounter 8 // any value under 9 does no damage
   setvar fallcounter 8 // any value under 9 does no damage
   setactor[THISACTOR].jumping_counter fallcounter
   setplayer[THISACTOR].jumping_counter fallcounter
}
}
</pre>
</pre>

Revision as of 07:45, 22 September 2006

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 61
{
  setvar fallcounter 61 // any value under 62 is non-fatal
  setplayer[THISACTOR].jumping_counter fallcounter
}

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

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