Page 1 of 1

Setting unit proficiency help

Posted: Wed Oct 29, 2025 8:12 pm
by Knightpawn
Apologies if there is an obvious answer to this question:

How can I adjust the unit proficiency to multiple units sitting on a base? If I select them all from the "Aircraft Ops" menu, doing Unit Orders - Senario Editor - Set unit proficiency does not have any effect. And from the OOB window I cannot select more than one unit each time. Do I have to do it one by one? Is there a more quick way?

Re: Setting unit proficiency help

Posted: Thu Oct 30, 2025 6:44 pm
by Dimitris
Scripting?

Re: Setting unit proficiency help

Posted: Fri Oct 31, 2025 7:30 am
by Knightpawn
Dimitris wrote: Thu Oct 30, 2025 6:44 pm Scripting?
There are some gen-x guys like us that are 100% coding-illiterate and we are looking to find a select-all , open drop down menu and select a parameter. Show some mercy :-)

Re: Setting unit proficiency help

Posted: Fri Oct 31, 2025 1:50 pm
by Kushan04
Do you want to set all units on a side to the same proficiency? You can do that via the Side menu.

If you want to randomize proficiency for all units on a side, you can use these functions.

Code: Select all

function RandomizeUnitProficiency(unitGUID, chanceNovice, chanceCadet, chanceRegular, chanceVeteran, chanceAce)
	local chance = math.random(1,100)
	local proficiency

	if chance <= chanceNovice then 
		proficiency = 0 -- Novice
	elseif chance <= chanceCadet then 
		proficiency = 1 -- Cadet
	elseif chance <= chanceRegular then 
		proficiency = 2 -- Regular
	elseif chance <= chanceVeteran then 
		proficiency = 3 -- Veteran
	else 
		proficiency = 4 -- Ace
	end

	ScenEdit_SetUnit({guid=unitGUID, proficiency=proficiency})
end

function RandomizeUnitProficiency_BySide(side, chanceNovice, chanceCadet, chanceRegular, chanceVeteran, chanceAce)
	local sideUnits = VP_GetSide({side=side}).units
	for k,v in ipairs(sideUnits) do
		local unit = ScenEdit_GetUnit({guid=v.guid})
		if unit and unit.type ~= 'Group' then
			RandomizeUnitProficiency(unit.guid, chanceNovice, chanceCadet, chanceRegular, chanceVeteran, chanceAce)
		end
	end
end

RandomizeUnitProficiency_BySide('Blue', 20, 50, 80, 90, 100)
1) Run both of the function RandomizeUnitProficiency functions in the Lua console or when the scenario is loaded.
2) Run this but with your side name and whatever chance values you want. "RandomizeUnitProficiency_BySide('Blue', 20, 50, 80, 90, 100)". In this example there's a 20% chance units will be Novice, 30% chance they'll be set to Cadet, 30% Regular, 10% for Veteran and Ace.

Re: Setting unit proficiency help

Posted: Fri Oct 31, 2025 2:10 pm
by Mark352
This script worked for a group of 12 aircraft. In the example code groups of four are each set to a different proficiency. I"m not much of coder so I use AI, primarily CoPilot, to help. The AI doesn't always get it right but, along with Command Lua Docs it helps me to learn what can be done with Lua in CMO. I couldn't resist looking into this because I haven't played with unit proficiency much. Learn something new in CMO everyday.

Code: Select all

local sideName = "Blue"

-- Define proficiency tiers
local function setProficiency(unitName, proficiency)
    local unit = ScenEdit_GetUnit({name = unitName, side = sideName})
    if unit then
        ScenEdit_SetUnit({guid = unit.guid, proficiency = proficiency})
        print("Set " .. unitName .. " to " .. proficiency)
    else
        print("Unit not found: " .. unitName)
    end
end

-- Hawk #1 to #4 → Regular
for i = 1, 4 do
    setProficiency("Hawk #" .. i, "Regular")
end

-- Hawk #5 to #8 → Veteran
for i = 5, 8 do
    setProficiency("Hawk #" .. i, "Veteran")
end

-- Hawk #9 to #12 → Ace
for i = 9, 12 do
    setProficiency("Hawk #" .. i, "Ace")
end

Re: Setting unit proficiency help

Posted: Fri Oct 31, 2025 3:01 pm
by TyphoonFr
For a base, I was perfectly happy with just that until now, but I see there are some cool features.

Code: Select all

local ab = ScenEdit_GetUnit({name='BAN de Landivisiau', guid='J7POY9-0HMUDSQ3UL3TH'}) 

for i=1, #(ab.hostedUnits['Aircraft']), 1 do

local hu = ScenEdit_GetUnit({name=ab.hostedUnits['Aircraft'][i]})

su = ScenEdit_SetUnit({name=hu.guid, proficiency = math.random(0,4) }) 

end

Re: Setting unit proficiency help

Posted: Sun Nov 02, 2025 7:06 pm
by Knightpawn
Thank you all