Jump to content

Recommended Posts

i am trying to use a waitUntill to wait for the player to not be on the ground (eg falling) but despite using "not" it still executes the code when the player is on the ground this is my code 

[]spawn{waitUntil {!isTouchingGround player;};};
_freeFallId = [_player,_target] execVM "\SM_tandem_jumping\functions\fn_freeFall.sqf";
player setVariable ["tandem_freeFallId",_freeFallId];

I have also tried using a while loop but it cases way too much lag this is the code I used:

while{(velocity _player select 2) > -4}do{
 	if ((velocity _player select 2) < -3) then{
 		hint"true2";
		_freeFallId = [_player,_target] execVM "\SM_tandem_jumping\functions\fn_freeFall.sqf";
		player setVariable ["tandem_freeFallId",_freeFallId];
 		exit;
 	};
	[]spawn {uiSleep 2;};
 	
};

I know it's not an error relating to the line 

!isTouchingGround player

as I've tested it in the debug and when I am on the ground it outputs false which it should so this has got me absolutely stumped on how to fix it and what to do. i can give the rest of the code if it helps to s

Share this post


Link to post
Share on other sites

The while condition... is more than minus 4? Shouldn't that be less than minus 4?

Share this post


Link to post
Share on other sites
6 minutes ago, Tankbuster said:

The while condition... is more than minus 4? Shouldn't that be less than -4?

I've tested it both ways still has the same problem it's not a syntax im having its a logic error  

Share this post


Link to post
Share on other sites
Quote

[]spawn{waitUntil {!isTouchingGround player;};};
_freeFallId = [_player,_target] execVM "\SM_tandem_jumping\functions\fn_freeFall.sqf";
player setVariable ["tandem_freeFallId",_freeFallId];

 

The execVM and setVariable are outside the spawn. 

The waitUntil runs separately in the spawn, and ends with nothing being done. 

Try moving the execVM and setVariable inside the spawn, after the wait.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, opusfmspol said:

The execVM and setVariable are outside the spawn.

The waitUntil runs separately in the spawn, and ends with nothing being done.

Try moving the execVM and setVariable inside the spawn, after the wait.

 

Thank you @opusfmspol works perfectly. your a life saver

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

×