Jump to content
Sign in to follow this  
dreadedentity

[CODE SNIPPET] Fun with scripting - Simple jump script

Recommended Posts

Hello all,

I got bored and decided that it would be fun to see if I can make a person jump. You can!

my init.sqf

player addAction ["Jump (for loop)",
{
for "_i" from 0 to 12 do
{
	player setPos [getPos player select 0, getPos player select 1, (_i / 12)];
	sleep 0.02;
};
}];

player addAction ["Jump (setVelocity)",
{
_vel = velocity player;
_dir = direction player;
_speed = 1;
player setVelocity [
	(_vel select 0) + (sin _dir * _speed), 
	(_vel select 1) + (cos _dir * _speed), 
	(_vel select 2) + 5
];
}];

[] spawn
{
while {true} do
{
	_position = getPos player;
	if (_position select 2 < getPos player select 2) then
	{
		hintSilent format["%1", getPos player select 2];
	};
};
};

I don't know how to bind code to keypresses so this is where I leave you. Have fun!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×