Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Average Percentage Attrition

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Average Percentage Attrition Page: [1]
Login
Message << Older Topic   Newer Topic >>
Average Percentage Attrition - 1/1/2022 5:32:48 PM   
SeaQueen


Posts: 1451
Joined: 4/14/2007
From: Washington D.C.
Status: offline
Lately I've been fascinated by air interdiction. The problem is that unless it's CAS, they're usually hunting for elements of larger operational level units (brigades or divisions) and not individual platoons. Realistic mission objectives might be stated something like, "Draw down the XXth Guards Motor Rifle Brigade to 25%." That presents a problem when you're dropping bombs on the sections, platoons and batteries that make it up. How does one determine that the brigade a given game unit belongs to has been drawn down to the desired level? It can't be just 25% of the units destroyed, because damaging units ought to count too. They're talking about 25% of the total available combat power. I wrote this function to help answer that question. Destroyed units count as 100% attrition, while damaged units count for something less than that. It then averages over all the constituent units you add to the list.

-- Returns the average percentage damage of a given set of units.  Intended to be used for calculating the attrition of larger ground forces.

unitOfInterest = {
-- guids go here
}

function averageAttrition(units, mySide)
    totalDpPercent = 0
    avgDpPercent = 0        
    for u, unt in ipairs(units) do
        if(ScenEdit_GetUnit( { side=mySide, guid=unt } )  ~= nil) then
            unit = ScenEdit_GetUnit( { side=mySide, guid=unt } )        
            print(unit.name.." Damaged: "..unit["damage"].dp_percent)
            totalDpPercent = totalDpPercent + unit["damage"].dp_percent
        else
            totalDpPercent = totalDpPercent + 100
        end        
    end
    avDpPercent = totalDpPercent / (#units)
    return avDpPercent
end

print(averageAttrition(unitOfInterest, "RED"))


< Message edited by SeaQueen -- 1/1/2022 6:39:17 PM >
Post #: 1
RE: Average Percentage Attrition - 1/3/2022 1:40:54 PM   
Parel803

 

Posts: 579
Joined: 10/10/2019
From: Netherlands
Status: offline
nice, thx. Gonna test it out.
regards GJ

(in reply to SeaQueen)
Post #: 2
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Average Percentage Attrition Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.250