Change the player's jump height: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
mNo edit summary
 
Nexus (talk | contribs)
m decap
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
You can use the player member [[jumping_counter]] to limit the player's jump to less Olympic heights.
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 as follows:
The [[jumping_counter]] increments from 0 (not jumping) to 1441 (end of jump) in increments of 180, as follows:


  0
  0
Line 13: Line 13:
  1441
  1441


By manually setting the counter to 0 when the counter reaches one of these values, you can decrease the duration of the jump by effectively cancelling it mid-jump.
NOTE: In water surface sectors ([[lotag]] 1), the counter will only reach up to 901.


You'll need a pair of gamevars: one to hold the value of [[jumping_counter]] and one to contain the value 0.
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.


<pre>gamevar temp 0 0
You'll need a gamevar to hold the value of [[jumping_counter]].
gamevar ZERO 0 0</pre>


Inside the aplayer actor, use the following code to cut the jump duration in half:
<pre>gamevar temp 0 2</pre>


Inside the APLAYER actor, use the following code to cut the jump duration in half:
<pre>
getplayer[THISACTOR].jumping_counter temp
ifvare temp 721
{
setplayer[THISACTOR].jumping_counter 0
}
</pre>
If you want to increase jump height instead of lowering it, you can do this instead:
<pre>
<pre>
getactor[THISACTOR].jumping_counter temp
getplayer[THISACTOR].jumping_counter temp
ifvare temp 721 { setactor[THISACTOR].jumping_counter ZERO }</pre>
ifvare temp 1261
{
setplayer[THISACTOR].jumping_counter 362
}
</pre>
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]]).
 
[[Category: Tutorials]]

Latest revision as of 12:34, 27 October 2014

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).