Jump to content
Sign in to follow this  
Kempco

Returing nearest H pad "build-in" to map

Recommended Posts

the following code was used to get the type of Object of a Known helipad at the Zargabad Airport:

copyToClipboard (format ["%1", TypeOf ((position player) nearestObject 3999)]);

The Above code works with buildings but in the case of the Helipad it returned an empty string.

I then tried:

copyToClipboard (format ["%1", (position player) nearestObject 3999]);

Which returned ==> 3999: heli_h_army.p3d

is there a way to convert the p3d model returned by the above code to its associated object class other then "typeOf"?

PS: the object classes of the 3 visible helipads ["HeliH","HeliHRescue","HeliHCivil"] also did not register.

Share this post


Link to post
Share on other sites
The "built-in" H pads do not have a config definition, hence the return of the p3d.

See here for further reading:

Bug #18579

Objects vs Map Objects

Nearobjects and trees + bushes

What are you trying to do with this?

I want to use the H-pads build into the map as cross-reference with the following function to get the nearest "safe" landing zone for an AI pilot to Land.

//by Kempco

_pos 	= _this select 0;
_limit = _this select 1;
_helo  = _this select 2;

_LZ = false;
_bb_max = boundingBox _helo select 1; 
_size = [[_bb_max select 0,_bb_max select 1],1] call bis_fnc_findExtreme;
_diameter = 1.25*_size;
_maxgradient = 0.125;
_isFlat = [_pos select 0,_pos select 1,0] isflatempty [_diameter,0,_maxgradient,_diameter,0,false,objNull];

scopeName "main";
if (count _isFlat != 3) then {
_center = _pos;
_pos = false;

for "_i" from 1 to 1000 do {
	_d = _diameter + (0.5*_diameter*_i);
	if (_d > _limit) exitWith {};

	_steps = floor (_d*pi*0.1);
	_inc = 360/_steps;
	for "_j" from 1 to _steps do {
		_dir = _inc * _j;
		_x = (_center select 0)+(sin(_dir)*_d);
		_y = (_center select 1)+(cos(_dir)*_d);
		_isFlat = [_x,_y,0] isflatempty [_diameter,0,_maxgradient,_diameter,0,false,objNull];
		_LZ = if (count _isFlat == 3) then {_isFlat}else{false};
		if (typeName _LZ == "ARRAY") exitWith {};
	};
	if (typeName _LZ == "ARRAY") exitWith {};
};
}else{
_LZ = _isFlat;
};
_LZ

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  

×