ViterboKnight
King
- Joined
- Feb 6, 2006
- Messages
- 796
There are some events that give a free promotion to every unit of a certain class or combat type (axemen, melee, etc), both existing and future.
In Python, I can easily give a promotion to every existing unit.
However, to also affect the future units, I think I have to use some more code.
I've found those methods in the class CvPlayer: isFreePromotion and setFreePromotion, that seem to do exactly what I want.
I haven't found any occurence of those methods in the Python scripts of BTS, so I'm not sure about how those methods must be used.
Here is the problem: they just don't work!
Some code that I've used, as example:
player = gc.getPlayer(iPlayer)
sName = player.getCivilizationAdjective(0)
This works!
if unit.getUnitCombatType() == unitCombatNaval:
unit.setHasPromotion(promotionFlanking,true)
This works!
bIsFreeProm = player.isFreePromotion(unitCombatNaval,promotionFlanking)
This doesn't work! Execution stops at this line, and an error occurs.
Can anyone help me?
In Python, I can easily give a promotion to every existing unit.
However, to also affect the future units, I think I have to use some more code.
I've found those methods in the class CvPlayer: isFreePromotion and setFreePromotion, that seem to do exactly what I want.
I haven't found any occurence of those methods in the Python scripts of BTS, so I'm not sure about how those methods must be used.
Here is the problem: they just don't work!
Some code that I've used, as example:
player = gc.getPlayer(iPlayer)
sName = player.getCivilizationAdjective(0)
This works!
if unit.getUnitCombatType() == unitCombatNaval:
unit.setHasPromotion(promotionFlanking,true)
This works!
bIsFreeProm = player.isFreePromotion(unitCombatNaval,promotionFlanking)
This doesn't work! Execution stops at this line, and an error occurs.
Can anyone help me?