Jump to content
Sign in to follow this  
giorgygr

AI JTAC and Laser designator

Recommended Posts

Hello guys.

Yesterday i was trying to put

1) a NATO UAV "Greyhawk" flying //max skill

2) a NATO AI JTAC subordinate in high ground

3)Some OPFOR's along with a civilian car driven by an OPFOR

To my surprise i saw my JTAC putting out his Laser designator and naming the targets..but he remained stuck in this animation

and the friendly (not connected to group tho) UAV hasn't got valid targets.

The results are different tho if "I" lase the desired target to a non-grouped UAV

Solutions?

Share this post


Link to post
Share on other sites

till kylania saves the day, ill throw out a wild guess and suggest trying reveal

never used it, but its description sounds like it would help. jtac and uav must not be communicating, maybe because unit is a subordinate....when working correctly with you lazing the target, is your player unit a subordinate too, or a group leader? (irregardless of the uav)

Share this post


Link to post
Share on other sites

I've been playing with this off and on today and just can't seem to get AI UAVs to see my player laser targets :(

Share this post


Link to post
Share on other sites

kylania - On a semi-related note;

is there any chance you could help us to understand what changes to make so that the laser-guided missiles from this A2 script of yours will work in A3?

http://www.kylania.com/ex/?p=21

I've got it so that I get the hints about target found and incoming missile, but nothing shows up.

Share this post


Link to post
Share on other sites

so, im in the dev build and with no scripting i was able to get it -all- to work. Greyhawk flying max skill (and default too) ungrouped, and various combinations of player and Jtac groupings (subordinate, grouped, leader, etc). with no issues what so ever, target vehicle was blown up. Only thing i noticed is that sometimes you gotta wait a while for the uav to do a flyby and turn around...the waiting game.

-when jtac was grouped as subordinate to player, player had to order jtac to target vehicle.

-when only grouped with a recon leader, leader ordered jtac to target.

-when ungrouped alone, jtac targeted on their own accord.

-when player lazed target with and without jtac present on the map, uav attacked target.

-multiple targets were selected one-by-one by jtac

-for fun i let jtac target opfor vehicles, while i targeted the jtac - after his targets were destroyed he took my laze as unfriendly and turned around to laze me back, with which the uav complied :D

more update: also had no issue with civilians or civi vehicles being near opfor targets, and the uav had no problem attacking a civilian vehicle i targeted.

only issue, was when there was a civ vehicle and a opfor was give a 'getin' waypoint, jtac fired shots at the enemy, once enemy was in vehicle jtac wouldn't laze but continue to aim rifle at target. but if opfor unit was 'moveInDriver'ed, jtac lazed target

Edited by dr_strangepete
more testing observations

Share this post


Link to post
Share on other sites

@ dr_strangepete

I was hoping for a 'non scripted' solution.

i.e. I want to make a scenario when player must be hiding while an enemy UAV will be in the air ..and the mission will have probability to spawn enemy JTAC's giving your position to UAV for 'fireworks'

@kylania

It is doable IF you lase the target for a non-grouped-on-you UAV

I tested it and it works.

Just as (appropriate measure) set UAV's skill to high enough and it's ROE to open fire/open fire-engage at will.

Things i noticed was..

1)A UAV won't engage automatically Infantry targets

2)A UAV won't engage enemy infantry while there are inside a Civilian car.

3)Enemy Side related light armored cars /populated are getting fried automatically-with my ROE settings-

I tried the Reveal command yesterday (as our friend dr_strangepete suggests) on a civilian car driven by an enemy..but it didn't worked.

I dont know..maybe i 've done something wrong (code==not my best part)

edited later

@dr_strangepete Nice sync :)

The problem is..UAV doesn't really needs JTAC to lase a Enemy's faction vehicle.. :/

Edited by GiorgyGR

Share this post


Link to post
Share on other sites
is there any chance you could help us to understand what changes to make so that the laser-guided missiles from this A2 script of yours will work in A3?

Yeah, I got it working but I'm getting a stupid undefined variable error because the velocity of the missile is "any" just as it dies and I can't figure out how to get around that. But it works if you don't mind errors, which I guess are turned off anyway... so yah. Also while the LD drops when you start walking you can't look over them while lasing so you miss the whole show. Very disappointing.

here's the script:

//////////////////////////////////////////////////////////////////
// Created by: BIS, adapted for ArmA 3 by kylania
//////////////////////////////////////////////////////////////////

_primaryTarget = [_this, 0, laserTarget player, [objNull]] call BIS_fnc_param; //target for the missile
_missileStart = [_this, 1, getPos miMissileStart, [[0,0,0]]] call BIS_fnc_param; //position where te missile will be spawned
_missileType = [_this, 2, "M_Scalpel_AT", [""]] call BIS_fnc_param; //type of the missile
_missileSpeed = [_this, 3, 200, [123]] call BIS_fnc_param; //speed of the missile
_defaultTargetPos = [_this, 4, getPos player, [[0,0,0]]] call BIS_fnc_param; //default position where unguided missiles will fly [8340.718750,3074.914795,0];

_reloadTime = 15;

if (isNull _primarytarget) exitWith {hint "No Target Found!"};
if (miMissionActive) exitWith{hint "Missile unavailable!"};

miMissionActive = true;

hint "Target Detected!\n\nMissile inbound!";
sleep 5;

_perSecondChecks = 25; //direction checks per second
_getPrimaryTarget = {if (typeName _primaryTarget == typename {}) then {call _primaryTarget} else {_primaryTarget}}; //code can be used for laser dots
_target = call _getPrimaryTarget;

_missile = _missileType createVehicle _missileStart;
_missile setPos _missileStart;
//player sideChat format["missile is %1 at %2", _missile, getPosASL _missile];
//secondary target used for random trajectory when laser designator is turned off prematurily
_secondaryTarget = "Land_HelipadEmpty_F" createVehicle _defaultTargetPos;
_secondaryTarget setPos _defaultTargetPos;

_guidedRandomly = FALSE;

//procedure for guiding the missile
_homeMissile = {

//here we switch to secondary target at random position if the laser dot no longer exists
//if the designator is turned on again, the missile will return to it's original target (providing it hadn't flown too far)
private ["_velocityX", "_velocityY", "_velocityZ", "_target"];
_target = _secondaryTarget;
if (!(_guidedRandomly) && _missile distance _target > _missileSpeed * 1.5) then {
_guidedRandomly = TRUE;
_target = _secondaryTarget;
_dispersion = (_missile distance _defaultTargetPos) / 20;
_dispersionMin = _dispersion / 10;
_target setPos [(_defaultTargetPos select 0) + _dispersionMin - (_dispersion / 2) + random _dispersion, (_defaultTargetPos select 1) + _dispersionMin - (_dispersion / 2) + random _dispersion, 0];
};
if (!(isNull (call _getPrimaryTarget))) then {_target = call _getPrimaryTarget; _defaultTargetPos = position _target; _guidedRandomly = FALSE};

//altering the direction, pitch and trajectory of the missile
if (_missile distance _target > (_missileSpeed / 20)) then {
_travelTime = (_target distance _missile) / _missileSpeed;
_steps = floor (_travelTime * _perSecondChecks);

_relDirHor = [_missile, _target] call BIS_fnc_DirTo;
_missile setDir _relDirHor;

_relDirVer = asin ((((getPosASL _missile) select 2) - ((getPosASL _target) select 2)) / (_target distance _missile));
_relDirVer = (_relDirVer * -1);
[_missile, _relDirVer, 0] call BIS_fnc_setPitchBank;

_dummy = [];
_velocityX = [_dummy, 0, ((((getPosASL _target) select 0) - ((getPosASL _missile) select 0)) / _travelTime), [123]] call BIS_fnc_param;
_velocityY = [_dummy, 1, ((((getPosASL _target) select 1) - ((getPosASL _missile) select 1)) / _travelTime), [123]] call BIS_fnc_param;
_velocityZ = [_dummy, 2, ((((getPosASL _target) select 2) - ((getPosASL _missile) select 2)) / _travelTime), [123]] call BIS_fnc_param;

//_velocityY = (((getPosASL _target) select 1) - ((getPosASL _missile) select 1)) / _travelTime;
//_velocityZ = (((getPosASL _target) select 2) - ((getPosASL _missile) select 2)) / _travelTime;

//_defaultTargetPos = position _target;
};
if ((typeName _velocityX) != (typeName 0)) then {_velocityX = 0};
if ((typeName _velocityY) != (typeName 0)) then {_velocityY = 0};
if ((typeName _velocityZ) != (typeName 0)) then {_velocityZ = 0};

[_velocityX, _velocityY, _velocityZ]
};

call _homeMissile;

//fuel burning should illuminate the landscape
_fireLight = "#lightpoint" createVehicle position _missile;
_fireLight setLightBrightness 0.5;
_fireLight setLightAmbient [1.0, 1.0, 1.0];
_fireLight setLightColor [1.0, 1.0, 1.0];
_fireLight lightAttachObject [_missile, [0, -0.5, 0]];

//missile flying
while {alive _missile} do {
_velocityForCheck = call _homeMissile;
//if (isNil "_velocityForCheck") then {_velocityForCheck == [0,0,0]};
	//player sideChat format["%1", _velocityForCheck];
if ({(typeName _x) == (typeName 0)} count _velocityForCheck == 3) then {_missile setVelocity _velocityForCheck};
sleep (1 / _perSecondChecks)
};

deleteVehicle _fireLight;
deleteVehicle _secondaryTarget;

sleep _reloadtime;
miMissionactive = false;
hint "Missile available!";

I've been running it as a support:

description.ext:

class CfgCommunicationMenu
{
   class myMissile
   {
       text = "Guided Missile"; // Text displayed in the menu and in a notification
       submenu = ""; // Submenu opened upon activation (expression is ignored when submenu is not empty.)
       expression = "_null = [] execvm 'launchmissile.sqf'";
       icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa"; // Icon displayed permanently next to the command menu
       cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"; // Custom cursor displayed when the item is selected
       enable = "1"; // Simple expression condition for enabling the item
       removeAfterExpressionCall = 0; // 1 to remove the item after calling
   };
};

add access to it with:

_supportMissiles = [player,"myMissile"] call BIS_fnc_addCommMenuItem;

Also expects a GameLogic named miMissileStart 500m up in the air somewhere with init of:

miMissionActive = false;

---------- Post added at 08:22 PM ---------- Previous post was at 08:19 PM ----------

@kylania

It is doable IF you lase the target for a non-grouped-on-you UAV

I tested it and it works.

Just as (appropriate measure) set UAV's skill to high enough and it's ROE to open fire/open fire-engage at will.

The question is, did he target your laser or his own target/laser?

Share this post


Link to post
Share on other sites

The question is, did he target your laser or his own target/laser?

Pretty sure-my targets

I was lasing 2-3 stationary infantry plus 1 spot of plain road

Share this post


Link to post
Share on other sites
Yeah, I got it working ....

Thank you sir. I enjoy having it available when I'm playing Rambo vs tanks and whatnot.

Share this post


Link to post
Share on other sites

kylania,

I was wondering if there's any way this can be adapted so that a SinglePlayer can use the laser targeting feature of the small Quadcopter UAV in conjunction with this script (EDIT: what I was trying to say was, can it be made to work whether I'm holding the laser designator in my hand, OR using the one in the quadcopter).

I have tried, and I don't seem to be able to access the support menu while in control of the quadcopters laser targeting turret.

Then I took a different approach, and by combining info from this thread, and from your A2 website, I was able to get your A3 version to work for my Player as an AddAction, instead of from support menu. But still I was unable to get it to work with the quadcopter uav. Then I placed a quadcopter, and put the

this addAction["Fire Missile","launchMissile.sqf",[this, miMissileStart,"M_Scalpel_AT",200]];

into its init line, and got close, things seemed to be hunky dory, but it said "no target found", even though I was laser-ing (lazing?) the target.

If you know of a way to make it work like this, I think it would be pretty darn neat, and I would be very grateful.

Edited by R.Flagg
clarification of question

Share this post


Link to post
Share on other sites

The script uses laserTarget to determine if you have a target or not, so just change from laserTarget player to laserTarget UAV and as long as it's local to you it should work.

Share this post


Link to post
Share on other sites

Thanks for the reply.

So far I still haven't had success though. I get as far as target detected, incoming missile, but no missile shows up.

I've been trying various combos, just to see if I could figure it out.

I put the addaction on me, then assembled a UAV, and then targeted, and then released controls (so I could get to my addaction menu)

I placed a UAV, and put the addaction on it, so I could access the fire missile command while still viewing through it's menu

I tried putting B_soldier_UAV_F instead of just UAV, just in case.

_primaryTarget = lasertarget (UAV); //target for the missile
_missileStart = getPos ((_this select 3) select 1); //position where te missile will be spawned
_missileType = (_this select 3) select 2; //type of the missile
_missileSpeed = (_this select 3) select 3; //speed of the missile
_defaultTargetPos = (_this select 3) select 4; //default position where unguided missiles

I've tried with paran and thesis, and w/o

Only reason i've listed all this stuff is to show you that I am trying lots of variations on my own, instead of just always asking first.

Again, I have it working just fine as a support menu option, and as a addaction option. It's just applying it to the Darter UAV that I'm still struggling with.

Share this post


Link to post
Share on other sites

You'd have to give the UAV a name, or use one of the new commands, umm..

_primaryTarget = laserTarget (getConnectedUav player); // might work?

Share this post


Link to post
Share on other sites

Yes sir, it did work. You've done it again.

Constantly helping others enjoy this game.

I thank you. :)

Share this post


Link to post
Share on other sites
You'd have to give the UAV a name, or use one of the new commands, umm..

_primaryTarget = laserTarget (getConnectedUav player); // might work?

Hey kylania et al, this is a fantastic script and I've enjoyed playing with it so far.

Right now, I see that I have two options to activate this script:

PLAYER LASER DESIGNATOR by assigning the line this way:

_primaryTarget = laserTarget (_this select 1);

OR

UAV LASER DESIGNATOR by assigning the line this way:

_primaryTarget = laserTarget (getConnectedUav player);

Both of these options work, but how can I make this so that I can have the _primaryTarget = either the player OR UAV designator?

In other words, the script fires off if I assign one of the two expressions, but I want the script two work if either of the two expressions are present.

I hope I'm explaining this well.

For context, I am using this via scroll menu addaction activation. I'd try the radio route, but can't figure out how to do that.

Thanks for the help,

Emryse

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  

×