My Python help thread

No, I did not.
 
Well, I really err... hadn't played it in a while so who knows how long this bug has been around, but I just discovered that some of the building button paths looked like this:

,Art/Interface/Buttons/Buildings/Granary.dds

I haven't retested the game yet. Could that have been causing the problem?

Note: This is actually the path from the Longhouse's artdefine tag, but it's possible that the Granary Crash occurred when I was playing as the Iroquois.
 
,Art/Interface/Buttons/Buildings/Granary.dds

I haven't retested the game yet. Could that have been causing the problem?

Yes, that is the problem. Check again every artDefine, that causes everytime a crash.
 
Yes, that is the problem. Check again every artDefine, that causes everytime a crash.

Well, I was about to write a long, complected message about how the bubbles don't work either in the warrior and I've never touched the Granary, but then, just for fun, I checked, and you are EXACTLY RIGHT! Thankyouthankyouthankyou!!! :bowdown::king::thanx::thanx::thanx::thanx::thanx:
 
Now, more Python questions:

How do I make the Zeal trait?

Zeal
Spoiler :
Free Zeal promotion for Melee, Mounted, Archery, and Gunpowder units built in cities with the state religion.


How do I make a description for a Python trait? My economical trait works fine, but in the civiliopedia, I get this:
Spoiler :


EDIT:

Hacking through python toward the El Dorado of a successful Zeal trait. Got most of the code at least closee to right, but a bit is still missing.

Code:
###Zeal Start###
		    
	def onUnitCreated(self, argsList):
		'Unit Completed'
		unit = argsList[0]
		player = PyPlayer(unit.getOwner())
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_ZEAL')
                    if (pPlayer.hasTrait(iTrait)):
                        unit.?______?

		if (not self.__LOG_UNITBUILD):
			return
###Zeal End###

What goes in the question marks, and how many errors are there?
 
Trait:
PHP:
	def onUnitBuilt(self, argsList):
                print 'onUnitBuilt'
		'Unit Completed'
		city = argsList[0]
		unit = argsList[1]
		player = PyPlayer(city.getOwner())
###from here        		
		iCurPlayer = city.getOwner ()
		pCurPlayer = gc.getPlayer(iCurPlayer)
		if pCurPlayer.hasTrait(gc.getInfoTypeForString("TRAIT_WHATEVER")):
		      iReligion = pCurPlayer.getStateReligion () 
		      if iReligion >=0:
		              if city.isHasReligion(iReligion):
		                  unit.setHasPromotion(gc.getInfoTypeForString("PROMOTION_WHATEVER"), True)



Description: Under the ShortDescription tag you can add a tag named Help, which will display the text.
For example:
PHP:
        <TraitInfo>
			<Type>TRAIT_EXPLORERS</Type>
			<Description>TXT_KEY_TRAIT_EXPLORERS</Description>
			<ShortDescription/>
			<Help>TXT_KEY_TRAIT_EXPLORERS_HELP</Help>
			<iHealth>0</iHealth>
 
Top Bottom