Jump to content

Recommended Posts

Posted

Anyone know a way to detect when the hornet smoke system has been activated so that a flag could be switched to on/true once it occurs?

Github Copilot created this script but it doesn't work:

-- Define the unit ID
local unitID = 35

-- Function to check if the SMOKE_ON_OFF system is activated
function checkSmokeSystem()
    -- Iterate through all units to find the unit with the specified ID
    local allUnits = coalition.getUnits(coalition.side.BLUE)
    for _, unit in ipairs(allUnits) do
        if unit:getID() == unitID then
            local smokeOnOff = unit:getDrawArgs(10) -- Assuming 10 is the draw argument for SMOKE_ON_OFF, this might need to be adjusted
            if smokeOnOff > 0 then
                trigger.action.setUserFlag("Smoke On", true)
            else
                trigger.action.setUserFlag("Smoke On", false)
            end
            return
        end
    end
    -- If the unit is not found or is destroyed, set the flag to false
    trigger.action.setUserFlag("Smoke On", false)
end

 

  • Recently Browsing   0 members

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