Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

A way to access detecting unit data for a Contact?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> A way to access detecting unit data for a Contact? Page: [1]
Login
Message << Older Topic   Newer Topic >>
A way to access detecting unit data for a Contact? - 11/16/2020 4:41:18 AM   
KnightHawk75

 

Posts: 1212
Joined: 11/15/2018
Status: offline
So I'm trying to obtain for a contact (or unit ), who has detected that contact, and by who I mean which unit(s), not a side, in LUA.

For example in the gui the following is displayed for a contact:


In this particular case there are detections from 2 sensors on 1 unit 'Stucture2'.

Now I can get the contact wrapper for this contact via VP_GetContact and interrogate .detectionBy field\table but it will only return {Radar=1};
Interestingly it also was nil till the second detection was made by the BigBird-D. Such that when the Bogey first appeared by being detected by the Cheese Board and shown in the gui .detectonBy was still coming back nil. IDK if it's a delay issue or something else such that the first one is being skipped. Additionally shouldn't that read {Radar=2} as pictured since there are now 2 radar sensors detecting it, or is # here the number of units and not sensors?

But now back to what I'm trying to accomplish. I can't seem to find a way of finding what unit(s) made the detection(s), either from information contained in the contact wrapper, or the underlying contact's unit. I can check the unit's .ascontact table but that just provides side,contactguid,name. I can't seem to find any way of getting what I want when the contact is_not being actively fired on, targeted by, targeting or firing on anyone. Is there a way I'm missing?



One might wonder why I wanted this information or an example of how I was going to use it.

So I've been working on a something I call YARC (yet another radar controller) at the moment.
Besides introducing customizable randomization into flipping on\off radars per desired unit(s) (and even per sensor or sensor type per hosting unit), I'm also trying to enable some more intelligence. Things like hey if this unit is currently in the middle of firing on someone maybe now is not the right time to turn a FCR off even if cycle time is up. But another option is to flag the unit-sensor entry as being able to use data from it's side to be arguably more intelligent. Such that if say contact is being tracked by that particular unit, and say only by that unit, maybe you want it not to turn off, or only turn off if range exceeded a certain threshold on it's own detection. That one requires me to know who has detected what - at least relatively recently.

Another option without getting into too much detail was basically using information from other side\allied side sources to know when to override activation\deactivation or not. Such that it might only activate when a contact is inside say munition and FCR range of a host unit using data fed by other units. Which I can do as is, but I wanted to optionally restrict that option relative to other radars\host units proximity who are feeding the data to the host. Such that unit X will turn on based on contact data with-in Y range of X, but only for contacts obtained by units friendly\allied units located with-in 50nm of X or for that matter only if certain comm-link exist between the parties. Basically simulating shared comms\cec as the user permits, but only to a point, not side-wide.

Anyway to do some of that stuff on I need info from the contact's detection table like exists in the gui, namely a detecting-unit guid. Also optionally (and more enabling), the associated sensor guid on that detecting-unit, and the age and range if it's already readily available to pass on to us.

I don't know what's the best place for this information though if added, be it on the contact or the unit or both or some other method. Not sure how many are actually kept either I assume it's similar # to the gui.

A .detectedByUnits table on a Contact wrapper:
{[1] {guid=detecting-unitguidhere,sensor_guid=sensor_guidhere,age=agehere,range=rangehere}
...
[10] {guid=detecting-unitguidhere,sensor_guid=sensor_guidhere,age=agehere,range=rangehere}}

:detectionByUnits() method could work too to avoid default bloat of the wrapper size with a table.

Or on the Unit wrapper as a method?:
:detectionsBy('Sidename' or all if nil) --returns table of contacts this unit has detected that have not timed out.
{ [1] {guid=contactguidhere,side='SidenameOrUnknown'} ...
[XXX] {guid=contactguidhere,side='SidenameOrUnknown'} }

Or maybe I'm just trying to do too much with this stuff.

Beyond the aforementioned I also ran into this challenge awhile back trying to design a piece of a scene that required the player to have a specific unit not get detected by a specific set of enemy units and enemy sensor dbids (when emissions were not involved). Which couldn't be done without containing each of those to their own separated sides and using detectedBySide as a inartful workaround.
Post #: 1
RE: A way to access detecting unit data for a Contact? - 11/26/2020 1:17:03 PM   
boogabooga

 

Posts: 334
Joined: 7/18/2018
Status: offline
I think that I had a similar issue where the detecting unit data would have been useful. This is the work-around that I came up with. Basically, the strategy is to cross-reference two sides' contact lists and try to pull out the units that I am interested in. Turns into nested loop he**. I used the "targetedBy" attribute as a stand-in since it is often the case that units target the contacts that they can detect. Not foolproof, but a work-around.

Perhaps this will be useful to you but perhaps not...

LibyanContacts = ScenEdit_GetContacts('Libya') 
UnitedStatesContacts = ScenEdit_GetContacts('United States')  

for key,value in pairs(LibyanContacts) do
	
	--Check the Libya's contact emissions for the AWG-9 or AWG-10
	if value.emissions == nil then  
		--Prevents error being thrown before any emissions are detected
	elseif value.emissions[1].sensor_dbid == 2003 or value.emissions[1].sensor_dbid == 1443 then
		USfighter = ScenEdit_GetUnit({guid = value.actualunitid})  
		
		--See if the unit associated with that radar is targeting any Libyan A/C
	    --If so, set that Libyan A/C RTB 
		for key_1, value_1 in pairs(UnitedStatesContacts) do 
			
			if value_1.type == nil then
				--Prevents error being thrown before types determined
			elseif value_1.type == 'Air' then
				LibyanAircraft = ScenEdit_GetUnit({guid = value_1.actualunitid}) 
				
				LibyanAircraftThreats = LibyanAircraft.targetedBy
				
				if LibyanAircraftThreats ~= nil then 
					for key_2, value_2 in pairs(LibyanAircraftThreats) do 
					
						if value_2 == USfighter.guid and Tool_Range(LibyanAircraft.guid, USfighter.guid) < 35 then
							ScenEdit_SetUnit({guid = LibyanAircraft.guid, RTB = true})
						end
					end
				end
			end
		
		end
		
	end
     
end

(in reply to KnightHawk75)
Post #: 2
RE: A way to access detecting unit data for a Contact? - 11/28/2020 3:01:36 AM   
KnightHawk75

 

Posts: 1212
Joined: 11/15/2018
Status: offline
Yeah unfortunately targetedby doesn't help in most cases for what I'm trying to do. Appreciate the response though.
I'm just gonna not add the intelligence I was going for yet.

(in reply to boogabooga)
Post #: 3
RE: A way to access detecting unit data for a Contact? - 11/28/2020 7:11:30 AM   
michaelm75au


Posts: 13355
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
I have logged a request for this as a place holder.

_____________________________

Michael

(in reply to KnightHawk75)
Post #: 4
RE: A way to access detecting unit data for a Contact? - 11/28/2020 5:22:59 PM   
KnightHawk75

 

Posts: 1212
Joined: 11/15/2018
Status: offline
Thanks Michael, appreciated as always.


(in reply to michaelm75au)
Post #: 5
RE: A way to access detecting unit data for a Contact? - 11/29/2020 3:09:43 AM   
boogabooga

 

Posts: 334
Joined: 7/18/2018
Status: offline
Just to mention the other way could be useful as well; for a given Unit, a list of all contacts that it is actually detecting.

(in reply to KnightHawk75)
Post #: 6
RE: A way to access detecting unit data for a Contact? - 11/29/2020 5:14:18 PM   
KnightHawk75

 

Posts: 1212
Joined: 11/15/2018
Status: offline

quote:

ORIGINAL: boogabooga

Just to mention the other way could be useful as well; for a given Unit, a list of all contacts that it is actually detecting.


Yeah that would be covered if implemented as method on Unit wrapper

quote:

Or on the Unit wrapper as a method?:
:detectionsBy('Sidename' or all if nil) --returns table of contacts this unit has detected that have not timed out.
{ [1] {guid=contactguidhere,side='SidenameOrUnknown'} ...
[XXX] {guid=contactguidhere,side='SidenameOrUnknown'} }

(in reply to boogabooga)
Post #: 7
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> A way to access detecting unit data for a Contact? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.441