Respawn-Promotion (xml+python)

The_J

Say No 2 Net Validations
Administrator
Supporter
Joined
Oct 22, 2008
Messages
42,140
Location
DE/NL/FR
A Respawn-Promotion :).
Download

Requested by cfkane for his Fictionalization IV mod.

Credits: The python is totally based on tsentom1's Survival Promotion. Tsentom has also helped me.
The buttons are from FK2006 (this buttonpack).


attachment.php


attachment.php


attachment.php


attachment.php



Download

What it does:
I've added 2 new promotions, respawn1+2.
Every promotion gives the unit +1 life.
If the unit dies, the higher respawn-promotion is lost, and the unit is in the capital reborn.
A unit with respawn2 can die, is reborn, loses respawn2, but still has respawn1. If the unit then again dies, it will lose respawn1, but is still reborn. After that, the unit is a normal unit, but can also again get the respawn-promotions.


For modders:
I've added #### Respawn Start ## and ## Respawn End ## in the CvEventManager.py, so you can easy find it.
To add more promotions to the respawn-function will be no problem.
Code:
Spoiler :

PHP:
## Respawn Start ##

		pPlayer = gc.getPlayer(pLoser.getOwner())
		pPID = pPlayer.getID()
		if ((pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LIVE1')))or(pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LIVE2')))):
                        iUnit = pLoser.getUnitType()
                        pClearPlot = self.findClearPlot(pLoser)
                        pPlot = pLoser.plot()
                        for iCity in range(1):
                                pCity = pPlayer.getCity(iCity)
        			iX =pCity.getX()
        			iY = pCity.getY()                            		
				
				

				newUnit = pPlayer.initUnit(iUnit, iX,iY, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
				pLoser.setDamage(0, False)
				newUnit.convert(pLoser)
				pLoser.setDamage(100, False)
				newUnit.finishMoves()
				
				CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_REBORN",()),'',0,'Art/Interface/Buttons/PromosKing1.dds',ColorTypes(44), iX, iY, True,True)
				if newUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LIVE2')):
                                        newUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_LIVE2'), False)
                                        newUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_LIVE1'), True)
                                elif newUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LIVE1')):
                                        newUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_LIVE1'), False)
				

## Respawn End ##

If yo have any questions, ask me or tsentom1 :).
(tsentom, i hope, you don't mind it, that i say that)

And give me and tsentom credit, when you use it :D.
 

Attachments

  • Civ4ScreenShot0111.JPG
    Civ4ScreenShot0111.JPG
    131.7 KB · Views: 10,730
  • Civ4ScreenShot0112.JPG
    Civ4ScreenShot0112.JPG
    131.5 KB · Views: 10,670
  • Civ4ScreenShot0113.JPG
    Civ4ScreenShot0113.JPG
    136 KB · Views: 10,635
  • Civ4ScreenShot0114.JPG
    Civ4ScreenShot0114.JPG
    141.6 KB · Views: 10,580
Back
Top Bottom