Realize automatic tracking ?
Posted: Thu Apr 21, 2022 1:59 pm
How to realize automatic tracking after uav discovering a ship by LUA
What's your Strategy?
https://forums.matrixgames.com:443/
For example, after the enemy destroyer is spotted by the MQ-8 drone, the destroyer moves away , the MQ-8 automatically hovers over it and track it. How to achieve this effect by Lua?KnightHawk75 wrote: Fri Apr 22, 2022 4:22 am I don't understand the question, can you be much more specific.
thanks a lot,but how to create an ever updating patrol zone ? use 'ScenEdit_SetMission'?,but how to confirm the waypoint?KnightHawk75 wrote: Sat Apr 23, 2022 6:13 am So some things that will come in play and I .
I might in the general sense if Blue is destroyer side and Red is Drone side..
Use the detection trigger event (Blue detects Red Drone, or Blue detects Red Drone in area around Blue destroyer), to kick off the LUA for the reaction of the destroyer unit, moving 'away' via course,speed and throttle assignments or reassigning to a mission with different location that causes reaction desired. On the drone side I would use a similar detection event (Red detects Blue specific destroyer) to kick off it's reaction and course, be that waypoints or the creation of an ever updating patrol zone rp's around/behind/whatever the destroyer, and assignment of the drone to that mission.
Why is the location shown wrong?KnightHawk75 wrote: Sat Apr 23, 2022 8:17 am You can write some code to update the locations of the RP that are being used to define the area to new locations at the interval of your choosing. Another way when it applies/works for the specific case, is to just use 'relative' settings on the RP's.
Not sure what you mean by confirm, do you mean how to set/change a units waypoint(s). You do that modifying the Unit's course property, by feeding it a new table of waypoints of your own making in terms of location.

Code: Select all
local con = ScenEdit_GetContacts('R')
local guid1=con[1].guid
local name1=con[1].name
local Lat1=con[1].Latitude
local Lon1=con[1].Longitude
--ScenEdit_MsgBox(guid1, 1)
--ScenEdit_AddReferencePoint( {side='R', RelativeTo=name1, bearing=45 ,distance=20, clear=true })
--ScenEdit_SetReferencePoint({side='R', name="Downed Pilot", RelativeTo=name1, bearing=5 ,distance=10, highlighted =true})
ScenEdit_AddReferencePoint({side="R", name="Downed Pilot", lat=Lat1, lon=Lon1, highlighted=true})hanzawa1991 wrote: Sun Apr 24, 2022 2:24 pmWhy is the location shown wrong?KnightHawk75 wrote: Sat Apr 23, 2022 8:17 am You can write some code to update the locations of the RP that are being used to define the area to new locations at the interval of your choosing. Another way when it applies/works for the specific case, is to just use 'relative' settings on the RP's.
Not sure what you mean by confirm, do you mean how to set/change a units waypoint(s). You do that modifying the Unit's course property, by feeding it a new table of waypoints of your own making in terms of location.
this is my code:Code: Select all
local con = ScenEdit_GetContacts('R') local guid1=con[1].guid local name1=con[1].name local Lat1=con[1].Latitude local Lon1=con[1].Longitude --ScenEdit_MsgBox(guid1, 1) --ScenEdit_AddReferencePoint( {side='R', RelativeTo=name1, bearing=45 ,distance=20, clear=true }) --ScenEdit_SetReferencePoint({side='R', name="Downed Pilot", RelativeTo=name1, bearing=5 ,distance=10, highlighted =true}) ScenEdit_AddReferencePoint({side="R", name="Downed Pilot", lat=Lat1, lon=Lon1, highlighted=true})
Code: Select all
local con = ScenEdit_GetContacts('R')
print("GetContacts latitude is " .. con[1].latitude)
local Lat1=con[1].latitude
print(Lat1)
I made a scenario with a single MPA Aircraft and a DDG on the opposite side. Once the DDG was detected I ran the above script in the Lua Console.GetContacts latitude is 36.99019808043
36.9901980804296
hanzawa1991 did TitaniumTrout's reply help you clear up the issue you were having?hanzawa1991 wrote: Mon Apr 25, 2022 1:51 pm I have tried many functions,like "ScenEdit_GetContact()/ScenEdit_GetContacts()/VP_GetContact()/VP_GetSide()/VP_GetSides()/
VP_GetUnit()" but there is no way to get the longitude and latitude of the ship found by "R" side, what should I do?![]()
Thank you very much. It's doneKnightHawk75 wrote: Tue Apr 26, 2022 2:41 pmhanzawa1991 did TitaniumTrout's reply help you clear up the issue you were having?hanzawa1991 wrote: Mon Apr 25, 2022 1:51 pm I have tried many functions,like "ScenEdit_GetContact()/ScenEdit_GetContacts()/VP_GetContact()/VP_GetSide()/VP_GetSides()/
VP_GetUnit()" but there is no way to get the longitude and latitude of the ship found by "R" side, what should I do?![]()
You're absolutely right. That's the problem, thanks a lot!!TitaniumTrout wrote: Tue Apr 26, 2022 1:31 pm Lua is case sensitive.
local Lat1=con[1].Latitude will not work, but local Lat1=con[1].latitude will.
Code: Select all
local con = ScenEdit_GetContacts('R') print("GetContacts latitude is " .. con[1].latitude) local Lat1=con[1].latitude print(Lat1)I made a scenario with a single MPA Aircraft and a DDG on the opposite side. Once the DDG was detected I ran the above script in the Lua Console.GetContacts latitude is 36.99019808043
36.9901980804296