Tarquelne
Follower of Tytalus
- Joined
- Dec 8, 2001
- Messages
- 3,718
Can't remember if we actually use PyOnDeath through any promotions, I know that Alcinus uses it for his resurrection capability. Can look at how he works for some ideas there.
I think pyondeath is part of unitinfos. Which would make the closest thing for promotions PythonPostCombatLost?
Here's something that almost works:
Spoiler :
Code:
def onPostCombatLostSurvival(caster):
pPlayer = gc.getPlayer(caster.getOwner())
iUnit = caster.getUnitType()
if CyGame().getSorenRandNum(9, "Survival Roll ") >= 1:
CyInterface().addMessage(caster.getOwner(),True,25,CyTranslator().getText("TXT_KEY_MESSAGE_SURVIVAL", (caster.getName(), )),'',1,'Art/Interface/Buttons/Promotions/Plaguecarrier.dds',ColorTypes(8),caster.getX(),caster.getY(),True,True)
# pPlot = pCaster.plot()
# pPlot2 = findClearPlot(-1, pCaster.plot())
# if pPlot2 != -1:
# newUnit = pPlayer.initUnit(iUnit, pPlot2.getX(), pPlot2.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
newUnit = pPlayer.initUnit(iUnit, caster.getX(), caster.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
newUnit.convert(caster)
newUnit.setDamage(90, False)
newUnit.finishMoves()
newUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_SURVIVAL'), False)
I don't know if the commented-out plot-changing python works. I *do* know that newUnit.convert(caster) doesn't allow the creation of a new unit. The function works without it, but (obviously) doesn't carry over a unit's promotions.
Oh yeah - for testing purposes the "roll" is set to almost always succeed.
,
and
) in the pedia? Specifically, I would like them to show up in the strategy part and above all on the hint that you see when choosing what to build next in a city. Because I want to add buildings modifying the terrain yields and will be using python for these so they want show up in the pedia as part of the building.*

