Skip to content

BaseMonitorPlatoonDistress

Aaron Warner edited this page Jan 15, 2020 · 2 revisions

BaseMonitorPlatoonDistress doesn't seem to work by default (its not used by the default AI). Not sure if its been broken forever or someone within faf team broke it.

` BaseMonitorPlatoonDistress = function(self, platoon, threat) if not self.BaseMonitor then return end

    local found = false
    for k, v in self.BaseMonitor.PlatoonDistressTable do
        -- If already calling for help, don't add another distress call
        if v.Platoon == platoon then
            continue
        end

        -- Add platoon to list desiring aid
        table.insert(self.BaseMonitor.PlatoonDistressTable, {Platoon = platoon, Threat = threat})
    end

    -- Create the distress call if it doesn't exist
    if not self.BaseMonitor.PlatoonDistressThread then
        self.BaseMonitor.PlatoonDistressThread = self:ForkThread(self.BaseMonitorPlatoonDistressThread)
    end
end,`

The for loop will not run if the table is empty. Modify to

` BaseMonitorPlatoonDistress = function(self, platoon, threat) if not self.BaseMonitor then return end

    local found = false
    if self.BaseMonitor.PlatoonAlertSounded == false then
        table.insert(self.BaseMonitor.PlatoonDistressTable, {Platoon = platoon, Threat = threat})
    else
        for k, v in self.BaseMonitor.PlatoonDistressTable do
            -- If already calling for help, don't add another distress call
            if v.Platoon == platoon then
                continue
            end

            -- Add platoon to list desiring aid
            table.insert(self.BaseMonitor.PlatoonDistressTable, {Platoon = platoon, Threat = threat})
        end
    end

    -- Create the distress call if it doesn't exist
    if not self.BaseMonitor.PlatoonDistressThread then
        self.BaseMonitor.PlatoonDistressThread = self:ForkThread(self.BaseMonitorPlatoonDistressThread)
    end
end,`
Clone this wiki locally