Jump to content
dragonsyr

helicopter or player on ground check ???

Recommended Posts

how can i say " if (helicopter landed) then {hint"heli on ground"}; and if(player on foot (not flying or parachute fall) ) then {hint"player on ground"}

Share this post


Link to post
Share on other sites

waitUntil {isTouchingGround theHelo && {isTouchingGround player}};
hint "The helicopter and the player has touched the ground.";
//do some things

waitUntil {isTouchingGround theHelo || {isTouchingGround player}};
hint "The helicopter or the player has touched the ground.";
//do some things

waitUntil {isTouchingGround theHelo && {! (player in theHelo)}};
hint "The helicopter has touched the ground and the player isn't in the helo.";
//do some things

waitUntil {isTouchingGround theHelo && {! (player in theHelo) && {isTouchingGround player}}};
hint "The helicopter has touched the ground, the player isn't in the helo and the player isn't in a parachute.";
//do some things

waitUntil {(getPosATL theHelo) select 2 < 2 && {! (player in theHelo) && {(getPosATL player) select 2 < 2}}};
hint "The helicopter is near the ground, the player isn't in the helo and the player probably isn't in a parachute.";
//do some things

Of course you can use 'IF' control structure if you want.

Edited by Iceman77
  • Like 1

Share this post


Link to post
Share on other sites

Thanks for all the help got it done. You will find the script bellow in case some else needs something like this as well.

 

private _tObject = _this select 0;

_tObject addAction["Transport to", {
	params ["_target", "_caller", "_actionId", "_arguments"];

	// Save starting vector
	_oldPos = position _target;

	openMap true;
	hint "Select on the map the designated position";

	// Set landing zone!
	_target onMapSingleClick {  
		deleteMarker "LandingPosition";
		_heloWaypoint = createMarker ["LandingPosition", _pos];
		_heloWaypoint setMarkerShape "ICON";
		_heloWaypoint setMarkerType "hd_pickup";
		_this doMove getMarkerPos "LandingPosition";
		
		openMap false;
		onMapSingleClick "";
		hintSilent "";
	};

	// Wait until the helicopter reachs the landing point. If he reachs the point he stops and land
	waitUntil { 
		_cPos = position _target;
		_meters = _cPos distance2D getMarkerPos "LandingPosition";
		if (_meters < 100) then {
			hint "landing soon!";
			true;
		} 
		else {
			hint str _meters;
			false;
		};
	};
	doStop _target;
	_target land "GET OUT";
	
	// Wait until the helicopter landed
	waitUntil {
		isTouchingGround _target;
	};
	hint "Helicopter is landet!";

	// Wait 30 seconds and fly back to base
	_sec = 0;
	waitUntil {
		sleep 1;
		_sec = _sec + 1;
		if(_sec >= 30) then{
			true;
		}
		else {
			false;
		}
	};
	_this doMove _oldPos;
	hint "Helicopter is flying back!";

	// Wait until the heli reachs his starting position and land
	waitUntil { 
		_cPos = position _target;
		_meters = _cPos distance2D _oldPos;
		if (_meters < 100) then {
			true;
		} 
		else {
			hint str _meters;
			false;
		};
	};
	doStop _target;
	_target land "GET OUT";

	// wait until he is touching the ground and shut down the engine
	waitUntil {
		isTouchingGround _target;
	};
	_target engineOn false;

}, [_tObject]];

and it get called inside the editor with this function

[this, airport_military_transport_pilot_1] execVM "scripts\transport.sqf";

 

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

×