Jump to content

Recommended Posts

Looking for some advice on what functions to use.

 

Currently I have attached a "FIRED" event handler to each member of a recon team. 

Once the trigger fires, it assesses what the unit is shooting at, and if the target belongs to the WEST side, it has 'positively identified' NATO in the area.

 

//player sideChat (format ["%1",_this]);

_unit = (_this select 0);
_group = group _unit;
_leader = leader _group;
_target = assignedTarget _unit;

player sideChat (format ["Target: %1",_target]);

//player sideChat (format ["Side: %1",(side _target)]);
//player sideChat (format ["Qrf1: %1",qrf1Sent]);
//player sideChat (format ["Qrf2: %1",qrf2Sent]);


if ((side _target) == WEST) then
{

		if (reconOnSite) then
		{
									if (!qrf1Sent) then {_aaq = execVM "law\dispatchQrf1.sqf";};
									if (!qrf2Sent) then {_aar = execVM "law\dispatchQrf2.sqf";};
		};

}
else
{
		if ((reconOnSite) && (!qrf1Sent)) then {_aad = execVM "law\dispatchQrf1.sqf";};
};

 

Hence; if the recon team is only firing upon local militia, a small QRF is needed.

If the recon team is in contact with NATO forces, a large one.

 

 

The problem is that assignedTarget appears to rely upon the group leader specifically directing one of the units to fire upon the target.

If the unit simply sees an enemy and fires of it's own initiative, the target is returned as 'objectNull' and the script fails.

 

In most cases, this isn't a problem. But the recon team is only small, and if the group leader is killed before this happens it might cause problems.

 

Is there a better way of assessing what the unit is firing at without having a target assigned?

Share this post


Link to post
Share on other sites

Note that assignedTarget might return objNull for quite some time.

Some test I did earlier this year:

 

//use these lines to test for yourself:


oneachframe {hintsilent str (test knowsabout player)};
test reveal [player,0.1];
output = [];
_push = output pushback (format ["Test distance: %1m",(test distance player)]);

_LineOfSight = [] spawn {

	while {true} do {

		waituntil {!(lineintersects [eyepos player,eyepos test,test,player])};

		output pushback format (["Player in line of sight! Time: %1s. Knowsabout: %2!",time,test knowsabout player]);

		waituntil {(lineintersects [eyepos player,eyepos test,test,player])};

		output pushback format (["Player out of sight! Time: %1s. Knowsabout: %2!",time,test knowsabout player]);

		copytoclipboard str output;

	};

};


_track = [] spawn {

	while {true} do {

		_knows = test knowsabout player;

		waituntil {sleep 0.02;test knowsabout player != _knows};

		output pushback (format ["Knowsabout changed! Time: %1s. Knowsabout: %2",time,test knowsabout player]);
		copytoclipboard str output;

	};

};

player addEventHandler ["Fired",{output pushback (format ["Player fired. Time: %1s. Knowsabout: %2!",time,test knowsabout player])}];
test addEventHandler ["Fired",{output pushback (format ["Enemy fired at %1! Time: %2s. Knowsabout %3!",assignedtarget test,time,test knowsabout player])}];




//around the corner of a building

["Test distance: 20.479m"
"Player fired. Time: 3.587s. Knowsabout: 0.1!"
"Knowsabout changed! Time: 3.631s. Knowsabout: 1.35"
"Player in line of sight! Time: 7.389s. Knowsabout: 1.35!"
"Knowsabout changed! Time: 7.582s. Knowsabout: 4"
"Player out of sight! Time: 7.626s. Knowsabout: 4!"
"Player in line of sight! Time: 7.67s. Knowsabout: 4!"
"Player out of sight! Time: 7.715s. Knowsabout: 4!"
"Enemy fired at <NULL-object>! Time: 7.914s. Knowsabout 4!"
"Player fired. Time: 8.069s. Knowsabout: 4!"
"Enemy fired at <NULL-object>! Time: 8.113s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 8.322s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 8.522s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 8.719s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 8.918s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 9.116s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 9.314s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 9.539s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 9.716s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 9.914s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 10.107s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 10.303s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 10.516s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 10.713s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 10.907s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 11.112s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 11.3s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 11.5s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 11.708s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 11.874s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 12.109s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 12.294s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 12.477s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 12.708s. Knowsabout 4!"
"Enemy fired at <NULL-object>! Time: 12.892s. Knowsabout 4!"
"Player in line of sight! Time: 28.888s. Knowsabout: 4!"
"Player fired. Time: 29.704s. Knowsabout: 4!"
"Player out of sight! Time: 30.088s. Knowsabout: 4!"]

I fired a few shots, went into line of sight 2 times, the enemy fired without having me as assignedTarget despite a knowsAbout value of 4.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Wow, nice work. 

You proved my concerns far better than I ever could have.

 

There's no dedicated command for seeing what an AI is trying to shoot at without assignedTarget then?

Share this post


Link to post
Share on other sites
1 minute ago, Grumpy Old Man said:

Not that I know of.

 

Cheers

 

Bummer. 

 

Well, I suppose it could work in my favour in this case.

In this scenario the recon team is opFor and are not expecting NATO in the area.

 

So i guess the delay in assigning a target could be taken as the recon team (who are independant) being hesitant in their identification of a partially obscured target.

 

Anyway, thanks for the confirmation.

Share this post


Link to post
Share on other sites

Why not use a trigger with condition "blufor detected by opfor"?  I think I'm not understanding your need here.

 

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, johnnyboy said:

Why not use a trigger with condition "blufor detected by opfor"?  I think I'm not understanding your need here.

 

 

Hey johnny.

 

I think I'm correct in saying that the 'detectedBy' triggers will also trigger if a unit is heard firing a weapon, without the unit necessarily having achieved line of sight on the target first.

I went to a fired event handler because I thought it was safe to assume that if a recon unit is firing upon a unit, they have achieved line of sight at some point.

 

You have got me thinking though. 

Perhaps I would be able to run something along the lines of:

 

when (bluFor detectedby Independant) 
{
		if (lineOfSight) then {do a thing};	
}

 

 

Depends how the trigger works though.

Could fail if a unit is detected out of line of sight and then moved into line of sight.

  • Like 1

Share this post


Link to post
Share on other sites

Good point on detectedBy firing when a weapon is heard.  Based on the Grumpster's experiment, knowsabout might be good enough.  When he fired while not being in line of sight, he got a low knowsabout value.  The value jumped to 4 quickly after he moved into line of sight.

 

So maybe a knowsAbout threshold of 3.5 or so is good enough for an imperfect Armaverse?

Share this post


Link to post
Share on other sites

For what it's worth you could also use targets, which will most likely be the best command to detect if a unit knows about an enemy, since the knowsabout value alone doesn't tell you if it's an enemy or not.

Just note that it doesn't necessarily have to be the unit that is being checked that spotted the target, since all targets are shared within the same group after some time.

The knowsAbout threshold for a unit to open fire upon another is 0.7.

 

count (_unit targets [true,1500]) > 0
//returns true if hostile target within 1500m is spotted

Alternatively you could use a fired eventhandler and reveal the firing unit to all nearby enemies within a certain radius.

I'm doing this in pretty much all my missions, makes you really think if revealing yourself is worth it.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

knowsAbout isn't something I know much about (irony intended).

 

From the notes by helling on the bis wiki, looks like 1.5 is the value given to units that have actually been seen by the observer.

So what you're saying is that I could just be checking if the knows about value is greater than or equal to 1.5 for nearby bluFor units?

 

If the detection only starts at 1.5 (the mission does take place just after midnight) then is there a chance it would drop below that by the time it's checked?

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

×