Uveso wrote:Hello Ghoustaq,
You need the following commands:
To get a list of all your massextractors:
- Code: Select all
MassExtractorUnitList = aiBrain:GetListOfUnits(categories.MASSEXTRACTION * (categories.TECH1 + categories.TECH2 + categories.TECH3), false, false)
To count all extractors inside the list:
- Code: Select all
count = table.getn(MassExtractorUnitList)
If you want to know the actual unit cap of your army:
- Code: Select all
currentCap = GetArmyUnitCap(brain.index)
And to set a new unit cap:
- Code: Select all
SetArmyUnitCap(brain.index, newCap)
hello!Uveso:
I wrote a segment of the script.lua as below:
local tblArmy = ListArmies()
for index,army in tblArmy do
local MassExtractorUnitList = tblArmy:GetListOfUnits(categories.MASSEXTRACTION * (categories.TECH1 + categories.TECH2 + categories.TECH3), false, false)
local count = table.getn(MassExtractorUnitList)
local currentCap = GetArmyUnitCap(army)
SetArmyUnitCap(army, count/0.5)
end
Unfortunately, it doesn't work in my skirmish map.
Can you check it? I'm sure there is something wrong with it 'causeI am not professional in scripting.