Después de mucho tiempo he conseguido que el script de reconocimiento esté ya a un nivel aceptabilísimo. QUe es lo que hace??
Pues como comentaba antes... a petición via F10.
Te pasará una lista de GRUPOS enemigos que estén en Line of SIght en un radio de 5 km de cualquier unidad nuestra. En coordenadas Lat Long.
Las coordenadas serán una media de todas las unidades del grupo.
Además saldrá un mensaje si to no pides, avisando... "oye, que hay enemigos a menos de 5 km". Pero ojo, solo avisará si tiene un LOS directo, o sea si los vé. SI está detrás de una montaña pues no detecta nada.
Luego, a petición, podemos pedirle que los marque con humo, evidentemente marcará TODOS los grupos que estén a menos de 1800 metros. Porqué 1500 metros?? bueno, he supuesto que todos los grupos llevan un mortero Comando de 60mm que tiene un alcance de unos 2km, pesa 8 kg y la munición unos 2kg.... Si queremos, podemos suponer que tenemos artillería, y listo... un 155mm de 52 calibres llega a 25km-30 km sin problema... pero esto depende de la operación que se haga.
Para que sirve?? bueno pues :
1.- misiones CAS. Los aviones ahora podrán tener referencias Lat Long del enemigo, siempre y cuando esté detectado. Incluso humo, para emergencias.
2.- El Comandante terrestre ya no lo pillarán desprevenido y tiene que moverse como un loco.
3.- Podemos empezar trabajar incluso sin niebla de guerra, es decir. El enemigo que no se vea en el mapa F10.
4.- Para misiones del tipo Seal Team en Vietnam, viene que te cagas!!!
AHora quiero que en los mensajes de posición indiquen la entidad del grupo. COmo no es plan de decir que hay en todas las unidades, quiero intentar hacer un orden de prioridades en función de la unidad mas peligrosa. Si tiene un SAM, pues un grupo SAM, si tiene un AAA pues un grupo AAA, si tiene un SAM y AAA, seguiría siendo un grupo SAM. el orden que he pensado sería.
SAM-AAA- Vehiculos-infanteria-desarmados
Y aquí está mi niño... lo he hecho yo solito, (algun snipet esta trincao de internet)
Funciona perfectamente con unidades helitranportadas...
---------------------------
Code: Select all
function reconmarker()
function table_count(tt, item)
local count
count = 0
for ii,xx in pairs(tt) do
if item == xx then count = count + 1 end
end
return count
end
function table_unique(tt)
local newtable
newtable = {}
for ii,xx in ipairs(tt) do
if(table_count(newtable, xx) == 0) then
newtable[#newtable+1] = xx
end
end
return newtable
end
local redunits = mist.makeUnitTable({'[red][vehicle]'})
local blueunits = mist.makeUnitTable({'[blue][vehicle]'})
LOSData = mist.getUnitsLOS(blueunits,2,redunits,2,1500)
local targets = {}
for k, v in pairs (LOSData) do
local tabledata = LOSData[k]
for j, w in pairs (tabledata.vis)do
local targetinLOS = tabledata.vis[j]
targets[#targets+1] = targetinLOS
end
end
--trigger.action.outText(mist.utils.tableShow(targets),20)
local targetgrouptable = {} -- table with all units-groups
for k, v in pairs(targets) do
local unit = targets[k]
local unitname = unit:getGroup()
targetgrouptable[#targetgrouptable+1] = unitname
end
--trigger.action.outText(mist.utils.tableShow(targetgrouptable),20)
tabletarget = table_unique(targetgrouptable)
for k, v in pairs(tabletarget) do
local group = tabletarget[k]
local groupname = group:getName()
trigger.action.smoke(mist.getAvgPos(mist.makeUnitTable{tostring('[g]'.. groupname)}), trigger.smokeColor.Orange)
end
end
function reconadvise()
function table_count(tt, item)
local count
count = 0
for ii,xx in pairs(tt) do
if item == xx then count = count + 1 end
end
return count
end
function table_unique(tt)
local newtable
newtable = {}
for ii,xx in ipairs(tt) do
if(table_count(newtable, xx) == 0) then
newtable[#newtable+1] = xx
end
end
return newtable
end
local redunits = mist.makeUnitTable({'[red][vehicle]'})
local blueunits = mist.makeUnitTable({'[blue][vehicle]'})
LOSData = mist.getUnitsLOS(blueunits,2,redunits,2,5000)
local targets = {}
for k, v in pairs (LOSData) do
local tabledata = LOSData[k]
for j, w in pairs (tabledata.vis)do
local targetinLOS = tabledata.vis[j]
targets[#targets+1] = targetinLOS
end
end
--trigger.action.outText(mist.utils.tableShow(targets),20)
local targetgrouptable = {} -- table with all units-groups
for k, v in pairs(targets) do
local unit = targets[k]
local unitname = unit:getGroup()
targetgrouptable[#targetgrouptable+1] = unitname
end
--trigger.action.outText(mist.utils.tableShow(targetgrouptable),20)
tabletarget = table_unique(targetgrouptable)
for k, v in pairs(tabletarget) do
local group = tabletarget[k]
local groupname = group:getName()
local targetgrouppos = mist.getLLString({units = mist.makeUnitTable{tostring('[g]'.. groupname)} , acc = 3,})
do
trigger.action.outText("Ground troops, to all flights, enemies detected at " .. targetgrouppos, 20)
end
end
end
do
local redunits = mist.makeUnitTable({'[red][vehicle]'})
local blueunits = mist.makeUnitTable({'[blue][vehicle]'})
mist.flagFunc.units_LOS{
unitset1 = redunits,
altoffset1 = 2,
unitset2 = blueunits,
altoffset2 = 2,
flag = 'enemies',
radius = 5000,
req_num = 3,
interval = 20,
toggle = true,
}
if trigger.misc.getUserFlag('enemies')== 1 then
trigger.action.outText("Ground troops, to all flights, enemies detected (further info in F10)", 30)
end
local _path1 = missionCommands.addSubMenu("Ground units", nil)
local _path2 = missionCommands.addSubMenu("All groups", _path1)
missionCommands.addCommand("Mark anemy troops with Orange smoke",_path2, function ()reconmarker ()end, nil)
missionCommands.addCommand("Report enemy situation",_path2, function ()reconadvise ()end, nil)
end
-- trigger.action.outText(mist.utils.tableShow(tabletarget),20)
