LynxOfTheSky Posted November 17, 2023 Posted November 17, 2023 If you destroy a vehicle, that immediately explodes (tested on AAV-7, bmp-1, bmp-2, M113) instead of burning out (tanks) - the event does not return the normal result, but instead returns destroyed unit as a weapon, weapon_name becomes destroyed unit's typeName, target becomes weapon, and initiator is not returned at all. I tested it in a simple mission (ka-50 vs one target, launch one Vihr at the target) with the attached script (tprint is just a function that recursively turns table to string). The result is in the picture. function tprint (tbl, indent) if not indent then indent = 0 end local toprint = string.rep(" ", indent) .. "{\r\n" indent = indent + 2 for k, v in pairs(tbl) do toprint = toprint .. string.rep(" ", indent) if (type(k) == "number") then toprint = toprint .. "[" .. k .. "] = " elseif (type(k) == "string") then toprint = toprint .. k .. "= " end if (type(v) == "number") then toprint = toprint .. v .. ",\r\n" elseif (type(v) == "string") then toprint = toprint .. "\"" .. v .. "\",\r\n" elseif (type(v) == "table") then toprint = toprint .. tprint(v, indent + 2) .. ",\r\n" else toprint = toprint .. "\"" .. tostring(v) .. "\",\r\n" end end toprint = toprint .. string.rep(" ", indent-2) .. "}" return toprint end local ev = {} function ev:onEvent(event) if event.id == 37 then trigger.action.outText(tprint (event), 5) trigger.action.outText('target: ' .. event.target:getDesc().typeName, 5) trigger.action.outText('weapon: ' .. event.weapon:getDesc().typeName, 5) end end world.addEventHandler(ev)
Flappie Posted March 31, 2024 Posted March 31, 2024 Thank you for the script. I'm able to reproduce the issue. It is now reported. 1 1 ---
Recommended Posts