Tsentom1 Python Wonders

So I noticed, when I got to playing the game only the last mod I loaded came up. Oh well, now I just have to learn how to combine these mods. Atleast I know how to get them in game now :p
 
Combining shouldn't be to hard.

You can look at the structure of one of the modcomps, and just use it as base.
If the next modcomp, which you want to merge, has additional files, which are not already present in the old one, then just add them.
If there's an overlap, then you have to find the new entries and copy them over. In the xml files, the new entries are normaly at the end of every file, in the python files you have to search for the name of the modcomp and copy it over to the right section.
 
Combining shouldn't be to hard.

You can look at the structure of one of the modcomps, and just use it as base.
If the next modcomp, which you want to merge, has additional files, which are not already present in the old one, then just add them.
If there's an overlap, then you have to find the new entries and copy them over. In the xml files, the new entries are normaly at the end of every file, in the python files you have to search for the name of the modcomp and copy it over to the right section.

The one caveat that will save you some time are the XML/Text files--any and all game text files are cumulative, so you don't have to waste your time combining those. Just add them all in the same folder!
 
Has anyone else had problems with the Leonardo's workshop wonder? Mine doesn't seem to work at all. I playted a test-game and built it (I actually built it, I didn't just plop it down anywhere), movie played, culture went up all that stuff, except the upgrade costs were the same. So it must be the python. Can someone help me out here?

I have attached the python file used in my mod, CvGameUtils.py, it was the only one that came in the download. Thanks in advance to anyone who could help me out with this. :goodjob:
 
Has anyone else had problems with the Leonardo's workshop wonder? Mine doesn't seem to work at all. I playted a test-game and built it (I actually built it, I didn't just plop it down anywhere), movie played, culture went up all that stuff, except the upgrade costs were the same. So it must be the python. Can someone help me out here?

I have attached the python file used in my mod, CvGameUtils.py, it was the only one that came in the download. Thanks in advance to anyone who could help me out with this. :goodjob:

It works for me.

Did you just update the py-file? I'm pretty sure there's a xml file in the mod too where a single twith needs to bu changed (or it that only some of the others - Spinxs for example).

\Skodkim
 
I edited the XML too, otherwise I wouldn't have been able to build it. Could you post your python file so I could compare it?

Wouldn't make much sence since both my python file is based on the one from HiTM
and because I added a lot of Tsentom1's python wonders and some other stuff in there.

\Skodkim
 
@ The Capo: Do you have another python code which changes upgrade cost?
 
@ The Capo: Do you have another python code which changes upgrade cost?

AFAK I do not. My mod uses NextWar as a base and has BUG added so far. I have also added some religions (modularly) and a few civs, as well as ethnic unit and city art. The only wonders I have added have been Sun Tzu's War Academy (which doesn't alter python) and Leonardo's workshop which does. This is the only python file I edited for Leonardo's workshop. Is the merge for this file done correctly? If so should I post all my python files?
 
Wouldn't make much sence since both my python file is based on the one from HiTM
and because I added a lot of Tsentom1's python wonders and some other stuff in there.

\Skodkim

Yeah, but I'd still be able to compare what you have in yours with what I have in mine.
 
Yeah, but I'd still be able to compare what you have in yours with what I have in mine.

Here you go. Don't really remember if you need both files for this particular wonder (look in the download) but here they are :)

\Skodkim
 
Thanks a lot man. :goodjob:

I know this may sound stupid, but you can confirm that Leo's works for you, corrrect?

Because mine appears to be exactly like yours and I built the wonder and everything but the upgrade costs were the same:

Code:
	def getWidgetHelp(self, argsList):
		eWidgetType, iData1, iData2, bOption = argsList
		
		return u""
		
	def getUpgradePriceOverride(self, argsList):
		iPlayer, iUnitID, iUnitTypeUpgrade = argsList

## Leonardo's Workshop Start ##

		pPlayer = gc.getPlayer(iPlayer)
		pUnit = pPlayer.getUnit(iUnitID)

		iPrice = gc.getDefineINT("BASE_UNIT_UPGRADE_COST")
		iPrice += (max(0, (pPlayer.getUnitProductionNeeded(iUnitTypeUpgrade) - pPlayer.getUnitProductionNeeded(pUnit.getUnitType()))) * gc.getDefineINT("UNIT_UPGRADE_COST_PER_PRODUCTION"))

		if ((not pPlayer.isHuman()) and (not pPlayer.isBarbarian())):
			pHandicapInfo = gc.getHandicapInfo(gc.getGame().getHandicapType())
			iPrice = iPrice * pHandicapInfo.getAIUnitUpgradePercent() / 100
			iPrice = iPrice * max(0, ((pHandicapInfo.getAIPerEraModifier() * pPlayer.getCurrentEra()) + 100)) / 100

		iPrice = iPrice - ((iPrice * pUnit.getUpgradeDiscount()) / 100)

		b_Leonardo = gc.getInfoTypeForString("BUILDING_LEONARDO")
		obsoleteTech = gc.getBuildingInfo(b_Leonardo).getObsoleteTech()
		if ( gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1 ):
			for iCity in range(pPlayer.getNumCities()):
				ppCity = pPlayer.getCity(iCity)
				if ppCity.getNumActiveBuilding(b_Leonardo) == true:
					iPrice = ((gc.getDefineINT("BASE_UNIT_UPGRADE_COST"))/2)
					iPrice += (((max(0, (pPlayer.getUnitProductionNeeded(iUnitTypeUpgrade) - pPlayer.getUnitProductionNeeded(pUnit.getUnitType()))) * gc.getDefineINT("UNIT_UPGRADE_COST_PER_PRODUCTION")))/2)

					if ((not pPlayer.isHuman()) and (not pPlayer.isBarbarian())):
						pHandicapInfo = gc.getHandicapInfo(gc.getGame().getHandicapType())
						iPrice = ((iPrice * pHandicapInfo.getAIUnitUpgradePercent() / 100)/2)
						iPrice = ((iPrice * max(0, ((pHandicapInfo.getAIPerEraModifier() * pPlayer.getCurrentEra()) + 100)) / 100)/2)

						iPrice = ((iPrice - ((iPrice * pUnit.getUpgradeDiscount()) / 100))/2)

		if pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LEADER')):

			iPrice = 0
		
		return iPrice

## Leonardo's Workshop End ##	

## Leonardo's Workshop Start ##	
#
## NOTE: You need to comment out (add a # before) the original return -1 (done below) ##
#
#		return -1	# Any value 0 or above will be used
#
## Leonardo's Workshop End ##	
	
	def getExperienceNeeded(self, argsList):
		# use this function to set how much experience a unit needs
		iLevel, iOwner = argsList
		
		iExperienceNeeded = 0

That's the code I use, I copied a bit before and after so you can see the context.
 
I did notice something when I ran a DeugDLL on it. I have BUG in my mod, and aparently this assert failure comes up with BUG (see attachment). I also noticed that part of the code for Leonardo's workshop references this tag (PROMOTION_LEADER) in the python. Could that be the reason it isn't working for me?
 
I did notice something when I ran a DeugDLL on it. I have BUG in my mod, and aparently this assert failure comes up with BUG (see attachment). I also noticed that part of the code for Leonardo's workshop references this tag (PROMOTION_LEADER) in the python. Could that be the reason it isn't working for me?

Interesting. I have used this modcomp for a long time and i can confirm that it works. I think I have seen that assert failure somewhere in these forums but I can't quite remember where, I'll have to check it...
But about the PROMOTION_LEADER I'm not sure if that should crash it (well basicly it could), you can test it by commenting out this part
Code:
		if pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LEADER')):

			iPrice = 0
try then if it works.
 
So basically do this to those lines:

Code:
#		if pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LEADER')):

#			iPrice = 0

Thanks again for your help NSG, I'll give it a go right now.

EDIT: That didn't work. Damn, I really wanted this wonder!
 
Hmm...:hmm:
I can see in the FAssert that it BUGs (:lol:) about CvGlobals.cpp, can you get your hands in your mod's source code? Just wondering why it's about PROMOTION_LEADER and GraphicOptionInfos.

Well, if by that you mean SDK there is none! I am just using BUG and there isn't a CvGlobals.cpp file involved at all. I asked EmperorFool about it (actually a couple people have) but he hasn't fixed it yet. So I suppose for the time being I'll have to deal with this until he fixes it, huh?
 
Well, if by that you mean SDK there is none! I am just using BUG and there isn't a CvGlobals.cpp file involved at all. I asked EmperorFool about it (actually a couple people have) but he hasn't fixed it yet. So I suppose for the time being I'll have to deal with this until he fixes it, huh?

Ok, I can't get any ideas what on earth could do that. Seems like we'll have to wait for EmperorFool. :sad:
 
ignore that promotion. I guess it comes from mongoose sdk. I had it in too.

Your python should work fine as long as you don't have any other python which changes "def getUpgradePriceOverride".
 
Does anybody know if it is possible to edit the Topkapi palace so, instead of only giving you a chance of building your vassal's UUs, it allows you to build either any UU from one of the civs in the game you are playing OR just any civ in BtS at all?
 
Back
Top Bottom