@Vokarya the issue is the advanced Cargo mod changed units so they can have more than 1 special unit type. You need to pass an index parameter to getSpecialUnitType. So you need to have a for loop over the number of special unit types on a unit.
However to make matters more complicated, Thomas SG (or the people who merged his code) failed to include the getNumSpecialUnitTypes for python, so in fact, it's impossible to implement code now correctly...
I'll add the missing python method that was not exposed from C++.
So roughly the code should look like this:
Code:iFighter = gc.getInfoTypeForString("SPECIALUNIT_FIGHTER") iNumFighters = 9 iNumPlayerFighters = 0 (loopUnit, iter) = player.firstUnit(False) while (loopUnit): for i in range(0, loopUnit.getNumSpecialUnitTypes()): if loopUnit.getSpecialUnitType(i) == iFighter: iNumPlayerFighters += 1 (loopUnit, iter) = player.nextUnit(iter, False) if iNumPlayerFighters < iNumFighters: return False
Edit: getNumSpecialUnitTypes was added for you in 948, so update and the above code should work.
I thought it would be something like that.
Also, is there an exposed Python function for getting a count of all units of a combat class? I would like the Nuclear Protest event to count all Doomsday units, not just Tactical Nukes and ICBMs. Something like getUnitClassCount, but applied to UNITCOMBATs, not UNITCLASSes. If there isn't, you don't need to make one, but if there is, I would like to know what it is.
I suppose I could also use getNumNukeUnits in this case. I don't know the Python in-depth, but it looks to me like that would work.