BIS fnc wpLand: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(KC Grimes moved page BIS fnc wpLand to BIS fnc wpLand TKOH: Making room for A3 version)
 
(Default start for BIS_fnc_wpLand)
Line 1: Line 1:
#REDIRECT [[BIS fnc wpLand TKOH]]
 
{{Function|= Comments
____________________________________________________________________________________________
 
| arma3 |= Game name
 
|1.00|= Game version
____________________________________________________________________________________________
 
| <pre>
 
/*
Author: Karel Moricky
 
Description:
Let group members land at the waypoint position
 
Parameters:
0: GROUP
1: ARRAY - waypoint position
2: OBJECT - target to which waypoint is attached to
 
Returns:
BOOL
*/
 
private ["_group","_pos","_target","_wp"];
_group = _this param [0,grpnull,[grpnull]];
_pos = _this param [1,[],[[]],3];
_target = _this param [2,objnull,[objnull]];
_wp = [_group,currentwaypoint _group];
_wp setwaypointdescription localize "STR_A3_CfgWaypoints_Land";
 
private ["_vehsMove","_vehsLand"];
_vehsMove = [];
_vehsLand = [];
 
waituntil {
private ["_countReady","_vehsGroup"];
_countReady = 0;
_vehsGroup = [];
 
//--- Check state of group members
{
private ["_veh"];
_veh = vehicle _x;
if (_x == effectivecommander _x) then {
if (!(_veh in _vehsMove)) then {
 
//--- Move to landing position
_veh domove _pos;
_vehsMove set [count _vehsMove,_veh];
} else {
if !(istouchingground _veh) then {
if (unitready _veh && !(_veh in _vehsLand)) then {
 
//--- van 't Land
_veh land "land";
_vehsLand set [count _vehsLand,_veh];
};
} else {
//--- Ready (keep the engine running)
_veh engineon true;
_countReady = _countReady + 1;
};
};
_vehsGroup set [count _vehsGroup,_veh];
};
} foreach units _group;
 
//--- Remove vehicles which are no longer in the group
_vehsMove = _vehsMove - (_vehsMove - _vehsGroup);
_vehsLand = _vehsLand - (_vehsLand - _vehsGroup);
 
sleep 1;
count _vehsGroup == _countReady
};
true
 
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________
 
| <!-- [] call [[BIS_fnc_getCfgDataArray]]; --> |= Syntax
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also
 
}}
 
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
 
<!-- Note Section END -->
</dl>
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Configs|{{uc:getCfgDataArray}}]]
[[Category:Functions|{{uc:getCfgDataArray}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:getCfgDataArray}}]]

Revision as of 15:14, 15 June 2018


Hover & click on the images for description

Description

Description:

/*
	Author: Karel Moricky

	Description:
	Let group members land at the waypoint position

	Parameters:
		0: GROUP
		1: ARRAY - waypoint position
		2: OBJECT - target to which waypoint is attached to

	Returns:
	BOOL
*/

private ["_group","_pos","_target","_wp"];
_group = _this param [0,grpnull,[grpnull]];
_pos = _this param [1,[],[[]],3];
_target = _this param [2,objnull,[objnull]];
_wp = [_group,currentwaypoint _group];
_wp setwaypointdescription localize "STR_A3_CfgWaypoints_Land";

private ["_vehsMove","_vehsLand"];
_vehsMove = [];
_vehsLand = [];

waituntil {
	private ["_countReady","_vehsGroup"];
	_countReady = 0;
	_vehsGroup = [];

	//--- Check state of group members
	{
		private ["_veh"];
		_veh = vehicle _x;
		if (_x == effectivecommander _x) then {
			if (!(_veh in _vehsMove)) then {

				//--- Move to landing position
				_veh domove _pos;
				_vehsMove set [count _vehsMove,_veh];
			} else {
				if !(istouchingground _veh) then {
					if (unitready _veh && !(_veh in _vehsLand)) then {

						//--- van 't Land
						_veh land "land";
						_vehsLand set [count _vehsLand,_veh];
					};
				} else {
					//--- Ready (keep the engine running)
					_veh engineon true;
					_countReady = _countReady + 1;
				};
			};
			_vehsGroup set [count _vehsGroup,_veh];
		};
	} foreach units _group;

	//--- Remove vehicles which are no longer in the group
	_vehsMove = _vehsMove - (_vehsMove - _vehsGroup);
	_vehsLand = _vehsLand - (_vehsLand - _vehsGroup);

	sleep 1;
	count _vehsGroup == _countReady
};
true

(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
Syntax needed
Return Value:
Return value needed

Examples

Example 1:

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section