Modme Forums
Menu:

Set jump height for player

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: ihmiskeho
How does one change the jump height of a certain player?

Scrolling through scriptapifunctions I found this:

void SetJumpHeight(<height_in_inches>)</height_in_inches>
But that doesn't really work here since it set the given jump height to all players.
I also tried using this script but it only seems to work when the user is holding the jump button.
function AfterLifeJump()
{
	//self = player in afterlife
	self endon("afterlife_done");
	self endon("disconnect");
	self endon("death");
	
	for(;;)
	{
		if(self JumpButtonPressed() && self IsOnGround() )
		{
			self SetVelocity(self GetVelocity() + (0, 0, 1000));
		}

		WAIT_SERVER_FRAME;
	}
}
There is probably something really simple I'm missing here.
Any help would be appreciated. Thanks


ModmeBot:

Reply By: Harry Bo21
afterlife can be done much easier - and will not have client lag ( your example will ) if you instead adjust the players gravity


void <player> SetPlayerGravity(<gravity>)
[MANDATORY] <gravity> The gravity to set
CATEGORY: 
CLIENT/SERVER: Server
SUMMARY: Sets the gravity override value for the player.
EXAMPLE: player SetPlayerGravity( 600 )</gravity></gravity></player>


ModmeBot:

Reply By: ihmiskeho

Harry Bo21
afterlife can be done much easier - and will not have client lag ( your example will ) if you instead adjust the players gravity void <player> SetPlayerGravity(<gravity>) [MANDATORY] <gravity> The gravity to set CATEGORY: CLIENT/SERVER: Server SUMMARY: Sets the gravity override value for the player. EXAMPLE: player SetPlayerGravity( 600 )

Thanks, works a lot smoother now.
However, setting the player gravity doesn't really seem to change the jump height. Is there something more to it?
Also I noticed that grenade gravity doesn't return to normal, instead they fly all over the place when thrown. The players gravity does return to normal however.
function AfterLifeJump()
{
	old_gravity = self GetPlayerGravity();
	new_gravity = 200;
	self SetPlayerGravity(new_gravity);
	self waittill("afterlife_done");
	self SetPlayerGravity(old_gravity);
}
</gravity></gravity></player>