Bushmanni Posted March 3, 2015 Posted March 3, 2015 I made a mission with invulnerable planes to practice gunnery and a script that tells when you hit someone. The problem is that only shots by the host trigger the S_EVENT_HIT event. Hit event is registered in the debrief.log also for clients but not in SSE environment. I have attached the mission. messages = {}; refreshrate = 1; --in seconds function addMessage(msg, duration) table.insert(messages, msg); mist.scheduleFunction(RemoveMessage, {msg }, timer.getTime() + duration); end; function RemoveMessage(msg2) for i, tablemsg in ipairs(messages) do if tablemsg == msg2 then table.remove(messages, i); break; end; end; end; function ShowMessages() local messages = mist.utils.deepCopy(messages) local output = ""; for i, val in ipairs(messages) do if i == 1 then output = val; else output = output .. "\n" .. val; end; end; if output ~= "" then trigger.action.outText(output, refreshrate); end; mist.scheduleFunction(ShowMessages, {}, timer.getTime() + refreshrate); end; ShowMessages(); customEventHandler = {}; function customEventHandler:onEvent(event) if (world.event.S_EVENT_HIT == event.id) then local target = "unknown"; if event.target:getCategory() == Object.Category.UNIT then if event.target:getPlayerName() then target = event.target:getPlayerName(); elseif event.target:getName() then target = event.target:getName(); end; end; addMessage(target .. " was hit", 5); else addMessage("event id = " .. event.id, 20); end; end; world.addEventHandler(customEventHandler);PvP snap shot drill BFM training 4x pairs.miz 1 DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community -------------------------------------------------- SF Squadron
Grimes Posted March 4, 2015 Posted March 4, 2015 Its know. I saw it reported somewhere else on the forums the other day. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Bushmanni Posted March 4, 2015 Author Posted March 4, 2015 Ok, good. DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community -------------------------------------------------- SF Squadron
Recommended Posts