Promotions and weird ways to use them.

Elucidus

King
Joined
Mar 3, 2002
Messages
983
Location
USA
I couldn't find a better place to put this thread but my questions are simple.

Can you have one promotion replace another promotion? For instance say I have a promotion for a type of armor that grants bonuses vs archers, but then I want to replace it with an armor that protects better against axes for instance.

Is this possibile? Or would this require some python work.

Also there is a mod where you can buy promotions with money, is there any way to do this for only certain types of promotions? I am think of having like a blacksmith with armor types, well with preexisting units having them able to purchase the armor upgrade.

Any thoughts or ideas on this? Let me know. Thanks,

Yours in gaming,
Elucidus.
 
If you are aiming for a old era-only mod, then you could use Fall Further to accomplish both with just XML, or just peek at the DLL to figure out how to run such things for yourself if you know C++. But if you are just spicing up the old eras and still allowing progression to modern era, it won't be quite as handy for you.


All said though, it'll require some DLL work ideally, python work if you have to. Certainly not possible with just XML though.
 
The code you want to intercept is in CvEventManager.py

Code:
	def onUnitPromoted(self, argsList):
		'Unit Promoted'
		pUnit, iPromotion = argsList
		player = PyPlayer(pUnit.getOwner())
		if (not self.__LOG_UNITPROMOTED):
			return
		CvUtil.pyPrint('Unit Promotion Event: %s - %s' %(player.getCivilizationName(), pUnit.getName(),))

In this segment iPromotion is the promotion the unit just gained, and pUnit is the unit. So you want something like:

Code:
	def onUnitPromoted(self, argsList):
		'Unit Promoted'
		pUnit, iPromotion = argsList
		player = PyPlayer(pUnit.getOwner())

		if iPromotion == gc.getInfoTypeForString('PROMOTION_BONUS_VS_ARCHERS'):
			pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_BONUS_VS_AXES'), False)

		if (not self.__LOG_UNITPROMOTED):
			return
		CvUtil.pyPrint('Unit Promotion Event: %s - %s' %(player.getCivilizationName(), pUnit.getName(),))

So this code would remove the promotion 'PROMOTION_BONUS_VS_AXES' if the unit ever gained the promotion 'PROMOTION_BONUS_VS_ARCHERS'.

The kind of fancy stuff Xienwolf was talking about that would require SDL code would be like creating "obsoletes" XML attributes for promotions so that if if a unit gained a promotion it automatically removes those it obsoletes (instead of hard coding each instance as above) or creating "promotion groups" where a unit is only allowed to have one in a group, gaining one automatically removes all the rest, etc.

Basically the advantage of the SDK over python is that it allows you to create new XML attributes and create code around their use. If you ever want to add attributes you will have to do SDK work. The disadvantage is that more confusing for people that aren't used to C++ programming.
 
The other reason that looking at a Fall from Heaven based DLL won't be too handy for you is that using that DLL requires you add a few totally new XML files, and lately it changes how the AI acts quite considerably as well. Thus in normal Civ it becomes fairly useless.
 
Yeah I think this Python stuff will do what I need. Its nothing too fancy, but i did toyu with the idea of obsoletes. Now to figure out how to allow promotions to be bought with gold, and only certain promotions, and evene then only for units in cities with certain improvements in them. :D

Its a ways off I know, but you guys have been a great help thank you.

I have done some SDK mods before, but only minimal stuff. As it were.

Thanks again

~Luc
 
Back
Top Bottom