Jump to content
stanhope

getArtilleryETA not working for VLS

Recommended Posts

So I'm writing a little thing to call in a cruise missile from the VLS and I want a marker on the position where the strike will be with the ETA next to it.  To get that ETA I'm using getArtilleryETA, this is how I'm using it: VLS getArtilleryETA [getPos _target, currentMagazine VLS];  Now my problem is that it returns -1.  And no, the missile doesn't arrive one second before I call it in 🙂

Is it something I'm doing wrong or does getArtilleryETA not work for the VLS?  If it's the latter, anyone have any other idea how I could get an ETA for that missile? 

 

Here's the full code I'm using for reference:

Spoiler


callCruiseMissile = {
	params ["_mode", "_trigger"];
	
	playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
	[player, "Requisting artillery support at the designated coordiantes"] remoteExecCall ["commandChat", 0];
	
	private _target = objNull;
	if (_mode == "laser") then {
		_target = laserTarget player;
	} else {
		private _pos = screenToWorld [0.5,0.5];
		_target = createVehicle ["Land_HelipadEmpty_F" ,_pos, [],0,"CAN_COLLIDE"];
	};
	
	private _eta = 5 + round( VLS getArtilleryETA [getPos _target, currentMagazine VLS]);		
	private _marker = createMarkerLocal [format ["artilleryVehicleTarget_%1", time], getPos _target];
	_marker setMarkerShapeLocal "ICON";
	_marker setMarkerTypeLocal "mil_warning";
	_marker setMarkerColorLocal "ColorBLUFOR";
	_marker setMarkerTextLocal format [' Artillery ETA %1 sec', _eta];
	
	sleep 5;
	
	playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
	[VLS, "Target location received.  Ordinance is inbound.  Out."] remoteExecCall ["commandChat", 0];
	
	west reportRemoteTarget [_target, _eta + 3]; 
	_target confirmSensorTarget [west, true]; 
	VLS fireAtTarget [_target, "weapon_vls_01"];
	
	playSound3D ["A3\dubbing_f\modules\supports\artillery_rounds_complete.ogg", player];
	[VLS, "Rounds complete.  Out."] remoteExecCall ["commandChat", 0];
	
	[_marker, _eta, _target, _mode] spawn {
		params ["_marker", "_eta"];
		private ["_i"];
		for [{ _i = _eta }, { _i > 0 }, { _i = _i - 1 }] do
		{	sleep 1;
			_marker setMarkerText format [' Artillery ETA %1 sec', _i];
			if (_i == 3) then {
				playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
				[VLS, "Splash.  Out."] remoteExecCall ["commandChat", 0];
			};
		};
		
		deleteMarker _marker;
		if (!isNil "_target" && !isNil "_mode") then {
			if (_mode != "laser") then {
				deleteVehicle _target;
			};
		};
	};
	
	if (!isNil "_trigger") then {
		deleteVehicle _trigger;
	};
};

support1 = createTrigger ["EmptyDetector", [0,0,0], false];
support1 setTriggerText "Cruise missile strike (laser guided)";
support1 setTriggerActivation ["ALPHA", "NOT PRESENT", false];
support1 setTriggerStatements ["this", "['laser',thisTrigger] spawn callCruiseMissile;",""];

support2 = createTrigger ["EmptyDetector", [0,0,0], false];
support2 setTriggerText "Cruise missile strike (GPS guided)";
support2 setTriggerActivation ["BRAVO", "NOT PRESENT", false];
support2 setTriggerStatements ["this", "['gps',thisTrigger] spawn callCruiseMissile;",""];

 

 

Edit: Figured out a way around it by using a fired event handler and calculating the ETA myself based of the speed of the missile and the distance between it and the target.

Edited by stanhope

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

×