Sedlo Posted March 20, 2021 Posted March 20, 2021 (edited) Hi Folks! Been going nuts here trying to figure this one out. First off, what I'm trying to achieve is kind of a training environment. All aircraft are set to immortal, and I've got a script that will: 1. Trigger a message saying who is hit and by whom. 2. Trigger an explosion at the point of the aircraft getting hit (so make sure the pilot knows by seeing/feeling it) 3. Trigger a signal flare at the point of impact (because I think it looks cool) The script is thus: Handler = {} function Handler:onEvent(event) if event.id == world.event.S_EVENT_HIT and event.initiator:getName() and event.target:getName() then trigger.action.outText(event.target:getName().." hit by "..event.initiator:getName(),2,true) trigger.action.signalFlare(event.target:getPoint(), 1, 1 ) trigger.action.explosion(event.target:getPoint(), 50) end end world.addEventHandler(Handler) OK, here is the thing. When I run this on a dedicated server, the message/explosion/flare work just fine when: 1. Client hits an AI unit. 2. AI hits a client unit. 3. AI hits and AI unit. But it does NOT work when a CLIENT hits a CLIENT. At all. Checking the server logs, I can see events when a client shoots, but there is no event when a client is hit listed. Is this normal? I'm thinking this might mean the S_EVENT_HIT is not being recognized in multiplayer servers, or there is a problem with it. 9:00:03 PM.604 INFO SCRIPTING event:type=shot,initiatorPilotName=Granite 2-1 | Sedlo,t=61208.842,weapon=AIM-9M,initiatorMissionID=233, So my question to you all is.. Where am I going wrong? I've tried the script above as it is, I've tried adding a table of units and referencing that with no luck. It just seems CLIENT vs CLIENT isn't working for me. @Hardcard @funkyfranky@Pikey, I know you guys are scripting gurus, I'm wondering if you have any solution. (PS, I've tried the MOOSE missile trainer script which works great, but I'd also like this to work for guns kills. Not sure if there is a missile trainer script that includes guns kills, but that would be cool) Sample mission attached. hit script test 1.miz Edited March 20, 2021 by Sedlo added data My Youtube Channel MY DCS MISSIONS
Sedlo Posted March 21, 2021 Author Posted March 21, 2021 Track file can be found here (client vs client kill at the 2:05 mark) hit script test 1-20210320-192612.trk My Youtube Channel MY DCS MISSIONS
Sedlo Posted March 21, 2021 Author Posted March 21, 2021 And the track file from the dedicated server (client vs client around the 2:05 mark, too) server-20210320-192627.trk My Youtube Channel MY DCS MISSIONS
Grimes Posted March 21, 2021 Posted March 21, 2021 By the way for anyone curious this is related to the units being immortal. The hit event works as expected if the clients aren't set to immortal. 2 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
Recommended Posts