Files
MOOSE_MISSIONS/WRAPPER - Weapon/Weapon - 010 - Track Bomb/Weapon - 010 - Track Bomb.lua
2023-02-05 22:18:41 +00:00

52 lines
1.3 KiB
Lua

---
-- WEAPON: Track Bomb
--
-- An F-15E is tasked to drop a Mk-82 bomb at
-- the old airfield near Kobuleti.
--
-- We monitor the SHOT event and track the bomb
-- until it impacts.
--
-- The impact point is marked with red smoke
-- and a mark on the F10 map is shown.
---
-- Some message on screen.
local text="Starting Weapon Test mission"
MESSAGE:New(text, 120):ToLog():ToAll()
-- Create an event handler that monitors the SHOT event.
local handler=EVENTHANDLER:New()
handler:HandleEvent(EVENTS.Shot)
--- Function called on shot event.
function handler:OnEventShot(EventData)
local eventdata=EventData --Core.Event#EVENTDATA
-- Nil check if we have a weapon in the eventdata table.
if eventdata and eventdata.weapon then
-- Debug info.
MESSAGE:New(string.format("Captured SHOT Event from unit=%s", eventdata.IniUnitName), 60):ToAll():ToLog()
-- Create a new WEAPON object from the DCS weapon object in the event data.
local weapon=WEAPON:New(eventdata.weapon)
-- Mark impact point on F10 map.
weapon:SetMarkImpact(true)
-- Smoke impact point.
weapon:SetSmokeImpact(true)
-- Strart tracking the weapon.
weapon:StartTrack()
end
end
-- Active group.
GROUP:FindByName("F-15E Bombing"):Activate()