....asking for a promotion requiring a resource

If you meant something like this:
If I have banana, and I build axeman, axeman gets free city raider I
Python = Yes
 
I think it would require some SDK work and an additional XML tag in BonusInfos, <FreePromotion>, which tells the game which promotion to grant.

Yes, it would require some SDK work and an additional XML tag...
But i think not in the BonusInfo...it would be better in the PromotionInfo!
And not <Free Promotion>...

...but rather...

<PrereqBonuses>
<BonusType>BONUS_ANTIMATTER</BonusType>
</PrereqBonuses>

And you need changes in the UnitSchema...

"All" you have to do is def. this xml tag <PrereqBonuses>...with/in SDK...
But it is SDK, that means it is hard to realizable for me, and i dont want to change the DLL code so much because of stability.
 
If you want it based on trade network ( means even if you don't have it, but you import it from other players)

Code:
	def onUnitBuilt(self, argsList):
		'Unit Completed'
		city = argsList[0]
		unit = argsList[1]
		player = PyPlayer(city.getOwner())

## Castra Praetoria Start ##
		pPlayer = gc.getPlayer(city.getOwner())
		if pPlayer.getNumTradeableBonuses(gc.getInfoTypeForString("BONUS_IRON")) > 0:
			unit.setHasPromotion(gc.getInfoTypeForString("PROMOTION_ACCURACY")), true)
## Castra Praetoria End ##

Up to you to adjust the variables.
You can even set it such that promotion is given only when the player has more than X iron resources for instance
 
There are some alternatives to use:
countOwnedBonuses (BonusType eBonus)
getNumAvailableBonuses (BonusType eBonus)
hasBonus (BonusType eBonus)

I didn't bother to try them since I don't need them.
getNumAvailableBonuses will give you the number of oil for instance in your terriority even if they are not improved.
 
There are some alternatives to use:
countOwnedBonuses (BonusType eBonus)
getNumAvailableBonuses (BonusType eBonus)
hasBonus (BonusType eBonus)

I didn't bother to try them since I don't need them.
getNumAvailableBonuses will give you the number of oil for instance in your terriority even if they are not improved.


Okey, thanks a lot Platyping! :worship:
I'll try all and see what happens! :crazyeye:
 
Back
Top Bottom