Jump to content
Sign in to follow this  
tsd16

do while issue

Recommended Posts

in the below script, it doesnt seem to break out of the while loop here any ideas to why? (the helo will go all the way to the ground, but wont pop back up, it sits there, so the loop isnt exitting when the _height is less than 10.

EDIT: I think i know what the issue is, it only has the initial height, I need to some how dynamically keep getting that variable.

EDIT: never mind, was way overzealous in posting for help this thread can be locked removed deleted.

getting _height = (position _vehicle) select 2; at the end of each loop fixes it.

_group = _this select 0;
_vehicle = _this select 1;
_height = (position _vehicle) select 2;

while { _height > 10 } do {
_vehicle setVelocity [0,0,-5];
}

Edited by tsd16

Share this post


Link to post
Share on other sites

You are no setting the height inside the loop, so it's value doesn't change.

_group = _this select 0;
_vehicle = _this select 1;

while { ((position _vehicle) select 2) > 10 } do {
_vehicle setVelocity [0,0,-5];
}

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  

×