Jump to content

Recommended Posts

Posted

Hey guys,

 

Three questions:

 

1. Is there an easy way to determine who has fired a shot or to set up a flag when specific unit fires?

 

2. Is there a way to determine who scored a kill in the A-A combat (or for that matter, ground)? I would like to set up a comms when my wingman kills enemy plane.

 

3. Can I somehow determine when a static object is reduced to 50% life (talking about ammo depot) and set up a flag once it happens?

 

I have never used MIST so far, but perhaps it is time to move on and start learning new things :music_whistling:

For more information, please visit my website. If you want to reach me with a bug report, feedback or a question, it is best to do this via my Discord channel.
Details about the WinWing draw can be found here. Also, please consider following my channel on Facebook.

Posted

Scripting and using the event handlers. I've never used the events for scripting but everything your asking is possible. I'll have a play round later tonight to see if I can implement what you're asking and let you know. Unless someone gets in before I get back to you.

-16AGR- 16th Air Guards Regiment is always looking for pilots - http://www.16agr.com

 

EWRS - Early Warning Radar Script

 

Specs:

 

 

Gigabyte Sniper Z5-S

Intel i5-4670k 3.4GHz OC'd 3.9GHz w/ Thermaltake 120mm Water 3.0 Pro Liquid CPU Cooler

16GB RAM

Gigabyte GTX 1080

TM Hotas Warthog: SN: 06976

Saitek Pro Flight Combat Rudder Pedals

TrackIR5 with TrackClipPro & Oculus Rift

2x 28" 4k UHD Monitors (3840x2160 each) + 1280x1024

 

 

Posted (edited)

As Steggles says, scripts and events are the way to go.

 

There is a bug currently with S_EVENT_HIT event that means you wont have the weapon details.

 

Below is the event handler snippet for a range script I'm working on that shows both S_EVENT_HIT and S_EVENT_SHOT

 


range = {}

-- Handles all world events
range.eventHandler = {}
function range.eventHandler:onEvent(_eventDCS)

   if _eventDCS == nil or _eventDCS.initiator == nil then
       return true
   end


   local status, err = pcall(function(_event)


       if  _event.id == world.event.S_EVENT_HIT and  _event.target  then

           local _target = _event.target -- what was hit
           local _unit = _event.initiator -- who hit it

            trigger.action.outText("HIT! ".._event.target:getName().." with ".._event.weapon:getTypeName(),10,false)
    
       --_event.weapon is currently broken for clients so below wont work
               --   env.info(_event.initiator:getPlayerName().."HIT! ".._event.target:getName().." with ".._event.weapon:getTypeName())


       elseif _event.id == world.event.S_EVENT_SHOT then

               local _weaponName = _event.weapon:getTypeName()
         
               local _ordnance =  _event.weapon

               local _unitName = _event.initiator:getName()
              
           end
       end


       return true

   end, _eventDCS)

   if (not status) then
       env.error(string.format("Error while handling event %s", err),false)
   end
end

-- add event handler
world.addEventHandler(range.eventHandler)

 

More info about whats returned with the events:

http://wiki.hoggit.us/view/DCS_event_shot

http://wiki.hoggit.us/view/DCS_event_hit

 

And all the events: http://wiki.hoggit.us/view/Category:Events

 

Hope that helps!

Edited by Ciribob

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

  • 4 years later...
Posted
As Steggles says, scripts and events are the way to go.

 

There is a bug currently with S_EVENT_HIT event that means you wont have the weapon details.

 

Below is the event handler snippet for a range script I'm working on that shows both S_EVENT_HIT and S_EVENT_SHOT

 


range = {}

-- Handles all world events
range.eventHandler = {}
function range.eventHandler:onEvent(_eventDCS)

   if _eventDCS == nil or _eventDCS.initiator == nil then
       return true
   end


   local status, err = pcall(function(_event)


       if  _event.id == world.event.S_EVENT_HIT and  _event.target  then

           local _target = _event.target -- what was hit
           local _unit = _event.initiator -- who hit it

            trigger.action.outText("HIT! ".._event.target:getName().." with ".._event.weapon:getTypeName(),10,false)
    
       --_event.weapon is currently broken for clients so below wont work
               --   env.info(_event.initiator:getPlayerName().."HIT! ".._event.target:getName().." with ".._event.weapon:getTypeName())


       elseif _event.id == world.event.S_EVENT_SHOT then

               local _weaponName = _event.weapon:getTypeName()
         
               local _ordnance =  _event.weapon

               local _unitName = _event.initiator:getName()
              
           end
       end


       return true

   end, _eventDCS)

   if (not status) then
       env.error(string.format("Error while handling event %s", err),false)
   end
end

-- add event handler
world.addEventHandler(range.eventHandler)

 

More info about whats returned with the events:

http://wiki.hoggit.us/view/DCS_event_shot

http://wiki.hoggit.us/view/DCS_event_hit

 

And all the events: http://wiki.hoggit.us/view/Category:Events

 

Hope that helps!

Hi guys! Was wondering how to display custom kill messages with replacing Unit Type in them. If for example bot or client was flying J11A and killed somebody to replace J11A with J11B in kill message, or Su-33 renamed to J15. I`m brand new to lua and DCS scripting in general. I have little C# knowledge. But couldn`t come up with solution on my own.

I get that there should be two strings created that would be displayed instead of two original strings.

I have no idea on how i should write this function or two separate functions. How it or they would be structured to "intercept" Unit Types of interest and rewrite message to remove original unit and paste fictional instead?

Would greatly appreciate any help!

Thanks!

----RED FLAG---- DCS Server. Discord: https://discord.gg/2PjQ52V

  • Recently Browsing   0 members

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