Change the player's jump height

From EDukeWiki
Revision as of 12:34, 27 October 2014 by Nexus (talk | contribs) (decap)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can use the player member jumping_counter to limit the player's jump to less Olympic heights, or make the player's jump even more superhuman.

The jumping_counter increments from 0 (not jumping) to 1441 (end of jump) in increments of 180, as follows:

0
181
361
541
721
901
1081
1261
1441

NOTE: In water surface sectors (lotag 1), the counter will only reach up to 901.

By manually setting the counter to 0 or a value above 1440 when the counter reaches one of these values, you can decrease the duration of the jump by effectively cancelling it mid-jump. Additionally, you can use a similar method to extend the jump height of the player.

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

gamevar temp 0 2

Inside the APLAYER actor, use the following code to cut the jump duration in half:

getplayer[THISACTOR].jumping_counter temp
ifvare temp 721 
{
	setplayer[THISACTOR].jumping_counter 0 
}

If you want to increase jump height instead of lowering it, you can do this instead:

getplayer[THISACTOR].jumping_counter temp
ifvare temp 1261 
{
	setplayer[THISACTOR].jumping_counter 362 
}

The above example increases the jump duration by 5 tics. The default jumping height is 9 tics without any changes in the code. The reason 1 is added to the counter when a jump is extended is to prevent an endless jumping loop from occuring. It is recommended to check for 126x when extending the jump to maximize jumping velocity(or poszv).