This is the iterator I use and it doesn't filter hidden units out.
Unit Group -For each unit armyUnit in (Any units in (Entire map) owned by player Any Player matching Excluded: Structure, Worker, Resource (Raw), Resource (Harvestable), Missile, Item, Dead, Hallucination, Summoned, Map Boss, with at most Any Amount) do (Actions)
Actions
addUnitCost(armyUnit,costAccums[(Owner of armyUnit)])
I found the function I needed. It is UnitCargoGroup(unit: Unit): UnitGroup
And this is the iteration I use to accumulate the army value of the units inside Nydus Networks:
------- Units inside nydus networks are not included in the `Entire Map` region. So their upkeep is treated sepparately here.
ForEachUnitInGroup(nydusNetwork,(UnitGroup("NydusNetwork",player,(RegionEntireMap()),Excluded: Dead,1)))
actions
ForEachUnitInGroup(armyUnit,(UnitCargoGroup(nydusNetwork)))
actions
addUnitCost(armyUnit,costAccums[player])
Now the mod calculates the army value correctly.
Thank you MaskedImposer for mentioning the word "cargo". It helped me to find the function I needed.
I did a extension mod that adds army upkeep based on unit value that is implemented iterating all the units in the map.
It would works fine if the units inside nydus networks were part of the region "entire map", but they aren't.
So, how can I get the group of units inside the nydus channels?
The mod's name is "upkeep" and is already published for those who want to see it.
I think cargo units are treated as hidden units. Try allowing hidden units in your iterations. They tend to be excluded.
In reply to MaskedImposter:
This is the iterator I use and it doesn't filter hidden units out.
Thank you anyway MaskedImposter
I found the function I needed. It is UnitCargoGroup(unit: Unit): UnitGroup
And this is the iteration I use to accumulate the army value of the units inside Nydus Networks:
Now the mod calculates the army value correctly.
Thank you MaskedImposer for mentioning the word "cargo". It helped me to find the function I needed.