Change the player's jump height: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
setplayer has been able to take constants for a while now: the ZERO var is redundant.
Line 15: Line 15:
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.
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.


You'll need a pair of gamevars: one to hold the value of [[jumping_counter]] and one to contain the value 0.
You'll need a gamevar to hold the value of [[jumping_counter]].


<pre>gamevar temp 0 2
<pre>gamevar temp 0 2</pre>
gamevar ZERO 0 0</pre>


Inside the APLAYER actor, use the following code to cut the jump duration in half:
Inside the APLAYER actor, use the following code to cut the jump duration in half:
Line 26: Line 25:
ifvare temp 721  
ifvare temp 721  
{
{
setplayer[THISACTOR].jumping_counter ZERO
setplayer[THISACTOR].jumping_counter 0
}</pre>
}</pre>


[[Category: Tutorials]]
[[Category: Tutorials]]

Revision as of 18:57, 15 June 2009

You can use the player member jumping_counter to limit the player's jump to less Olympic heights.

The jumping_counter increments from 0 (not jumping) to 1441 as follows:

0
181
361
541
721
901
1081
1261
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.

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 
}