Jump to content

Recommended Posts

Posted

Hi,

Using LoGetWorldObjects in Export.lua to export objects data in LuaExportAfterNextFrame function.

Is there a way to detect destroyed or crash objects ?

Posted

depending on what you want to accomplish, the MIST-script libary for the Mission(editor) makes a list of destroyed objects and scenery

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Posted

I try two solutions in Export.lua :

1. function getUnitsLife()

units={}

if coalition~=nil then

for _, group in pairs(coalition.getGroups(coalition.side.BLUE)) do

for _, unit in pairs(group:getUnits()) do

local u={}

u.name=unit:getName()

u.life=unit:getLife()

units[u.name]=u.life

end

end

for _, group in pairs(coalition.getGroups(coalition.side.RED)) do

for _, unit in pairs(group:getUnits()) do

local u={}

u.name=unit:getName()

u.life=unit:getLife()

units[u.name]=u.life

end

end

end

end

and retrieve life in LuaExportBeforeNextFrame() objects enumerator (I have the UnitName)

but coalition seems to be null in Export.lua

 

2. Using eventhandler but doesn't work in export.lua

DEADHandler = {}

function DEADHandler:onEvent(event)

if event.id == world.event.S_EVENT_CRASH or event.id == world.event.S_EVENT_DEAD then

default_output_file:write(string.format("%s\r\n",event.initiator))

end

end

world.addEventHandler(DEADHandler)

 

I really don't understand why objects like coalition or world are not available in Export.lua ??

  • 1 year later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...