Jump to content

Recommended Posts

Posted (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 by Sedlo
added data
  • Recently Browsing   0 members

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