westamastaflash
Lord Commander
- Joined
- Nov 1, 2007
- Messages
- 933
When creating a unit via python, is there a way to tell the system *not* to give the unit the traits of the Civilization?
I didn't see a function that does a "clear all promotions" or "give me a list of promotions"...
So I wrote some code that goes through all the promotions and removes them all, then adds the ones that I want.
Is there any other way to do this that doesn't require the map?
I didn't see a function that does a "clear all promotions" or "give me a list of promotions"...
So I wrote some code that goes through all the promotions and removes them all, then adds the ones that I want.
Code:
newUnit = pPlayer.initUnit(standardMeleeUnit, caster.getX(), caster.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
def clearAllPromotions(objUnit):
def clearPromotion(iPromotion):
objUnit.setHasPromotion(iPromotion, False)
map(clearPromotion, range(0, gc.getNumPromotionInfos() - 1))
# Clear Promotions
clearAllPromotions(newUnit)
Is there any other way to do this that doesn't require the map?