Jump to content

Export.lua destroyed object


zofo1963

Recommended Posts

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 ??

Link to comment
Share on other sites

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

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