Platyping's Python

@Dumanios
Thanks for appreciating :goodjob: Glad you like it. By the way, I took a look at your mod and noticed you added Tsentom's Herc Factory Wonder. The last time I tried it, it doesn't work. It allows you to build units pass the national limit, but after each turn, you will get a message "production lost and converted to gold" thingy.

WTC

Nope, not a remake. An apple fell on my head and I realised this is a much simpler and easier way of getting the same results:

Old Code:
Spoiler :
Code:
## World Trade Center Start ##
		pPlayer = gc.getPlayer(iPlayer)
		bc_WTC = gc.getInfoTypeForString("BUILDINGCLASS_WORLD_TRADE_CENTER")
		if pPlayer.getBuildingClassCount(bc_WTC) == 1:
			if pPlayer.isNoCorporations() == false:
				pTeam = gc.getTeam(pPlayer.getTeam())
				b_WTC = gc.getInfoTypeForString("BUILDING_WORLD_TRADE_CENTER")

			#### Check which city has active WTC
				(loopCity, iter) = pPlayer.firstCity(false)
				while(loopCity):
					if loopCity.getNumActiveBuilding(b_WTC) == true:

					#### Gold
						GoldChange = loopCity.getCorporationCommerce(0)
						GoldModifier = loopCity.getCommerceRateModifier(0)
						GoldChange =  int(GoldChange * (100 +GoldModifier)/100)
						pPlayer.changeGold(GoldChange)

					#### Research
						ResearchChange = loopCity.getCorporationCommerce(1)
						ResearchModifier = loopCity.getCommerceRateModifier(1)
						iCurrentTech = pPlayer.getCurrentResearch()
						ResearchChange = int(ResearchChange * (100 +ResearchModifier)/100)
						pTeam.changeResearchProgress(iCurrentTech, ResearchChange, iPlayer)

					#### Culture
						CultureChange = loopCity.getCorporationCommerce(2)
						CultureModifier = loopCity.getCommerceRateModifier(2)
						CultureChange = int(CultureChange * (100 +CultureModifier)/100)
						loopCity.changeCulture(iPlayer, CultureChange, true)

					#### Food
						FoodChange = loopCity.getCorporationYield(0)
		#### Not used for BTS		FoodModifier = loopCity.getYieldRateModifier(0)				## Not used for BTS
		#### Not used for BTS		FoodChange = int(FoodChange *(100 +FoodModifier)/100)			## Not used for BTS
						loopCity.changeFood(FoodChange)

					#### Production
						ProductionChange = loopCity.getCorporationYield(1)
						ProductionModifier = loopCity.getYieldRateModifier(1)			## Bonus From Buildings like Forge
						iCoal = gc.getInfoTypeForString("BONUS_COAL")				## Coal Bonus for IronForge
						ProductionModifier += loopCity.getBonusYieldRateModifier (1, iCoal)		
						iIron = gc.getInfoTypeForString("BONUS_IRON")				## Iron Bonus for IronForge
						ProductionModifier += loopCity.getBonusYieldRateModifier (1, iIron)
						ProductionModifier += loopCity.getProductionModifier()
						ProductionChange = int(ProductionChange *(100 +ProductionModifier)/100)	## Others like Industrious Trait or Military Academy
						loopCity.changeProduction(ProductionChange)

						break
					(loopCity, iter) = pPlayer.nextCity(iter, false)
## World Trade Center End ##

New Code:
Spoiler :
Code:
## World Trade Center Start ##
		pPlayer = gc.getPlayer(iPlayer)
		bc_WTC = gc.getInfoTypeForString("BUILDINGCLASS_WORLD_TRADE_CENTER")
		if pPlayer.getBuildingClassCount(bc_WTC) == 1:
			pTeam = gc.getTeam(pPlayer.getTeam())
			b_WTC = gc.getInfoTypeForString("BUILDING_WORLD_TRADE_CENTER")

			(loopCity, iter) = pPlayer.firstCity(false)
			while(loopCity):
				if loopCity.getNumActiveBuilding(b_WTC) == true:
					for icommerce in range (0, 3):
						iCorpCom = loopCity.getCorporationCommerce(icommerce)
						loopCity.setBuildingCommerceChange (bc_WTC, icommerce, iCorpCom)

					for iyield in range (0, 2):
						iCorpYield = loopCity.getCorporationYield(iyield)
						loopCity.setBuildingYieldChange (bc_WTC, iyield, iCorpYield)
					break
				(loopCity, iter) = pPlayer.nextCity(iter, false)
## World Trade Center End ##

As a result:
--- Still have to go through whole loop under state property
+++ More efficient since less info required
+++ Can work with all mods without additional code changes
+++ Changes reflected in screen itself unlike previous method where benefits added in invisible way

Old code left here for whoever interested in the formulae one day somehow...
 
Abu Simbel Temples
Spoiler :



Twin Temples. Buy 1 get 1 free!!!

City only gets free random temple if the religion is founded
Religion not added to the city by default although it seems logical to add the religion to the city if temple is there.

Example:
I build Buddhist Temple in Athens.
As a result, Athens get free Hindu Temple.
But, Hinduism does NOT spread to Athens.

For users who wish to add the religion as well when the free temple is built, uncomment the obvious line of code (get rid of all the ## comments in front)
 
What did you do that went wrong?
If all you do is change the name, it should be ok
 
What did you do that went wrong?
If all you do is change the name, it should be ok

I changed the PROJECT_THEORY_OF_EVERYTHING (or whatever it was) to PROJECT_THEORY_OF_REALTIVETY and i looked in python and i changed the one time it said PROJECT_THEORY_OF_EVERYTHING to PROJECT_THEORY_OF_REALTIVETY

and it crashes): Ill probably delete it and re-enter it with just changing name
 
Try it with the original TOE first
1) Try as a separate mod, it should work
2) If you transfer it to your own mod, try again, you may have added the art files to wrong directory for instance
3) If 1 and 2 work, but after you changed TOE to TOR, then it does not work, you may have missed out some TOE entries. There are TWO python files by the way, so there shouldnt be just ONE TOE entry
 
quick question, does python not work with worldbuilder. I have the ice hotel tsenton1 made, and when i add it via worldbuilder to a city, the ice/tundra around the city doesnt change (it is suppose to add gold to it). Either i have the python wrong or worldbuilder additions dont work. It didnt work with your lotus temple either. But it did work with Sprigfield armory. So what im guessing is when you place a wonder, if it has an imediate effect it doesnt work, but if it has one later it does

Either that or my python code is messed up
 
Hi :) Is possible write some what enable capture city style choosing?
Example.
I´m european - eu_cityset
I build wonder XY
when i capture arabian city, will new city looks as arabian
variant B/ I capture city - dialog say: do you want convert city to the european, or may city stay oriental...

Is it possible?
 
@dacubz145 as far as I know, python codes for ice hotel, old lotus etc are triggered on building "built". If you give it to the player free, then it is not counted as built, so the codes will not trigger.

Springfield has codes that trigger when units are built, thus, whether the springfield is built or given free does not matter.

@Hrochland doubt it is possible via python, SDK may be able to do that
 
Torre de Belem
Spoiler :



What it does:
Adds 25% defense in all coastal cities, which cannot be bombarded away.

What it actually does:
Adds invisible feature in all coastal cities, which adds the 25% defense.
Well, not actually invisible, it is floodplains :goodjob:

Of course, when rival takes over the city, 25% is gone.
But if Belem owner takes over rival's coastal city, 25% will be there

Artwork by Hrochland
 
Added a Notes to Modders section for modders who have difficulties adding/changing wonders to their personal mods
 
Torre de Belem
Spoiler :



What it does:
Adds 25% defense in all coastal cities, which cannot be bombarded away.

What it actually does:
Adds invisible feature in all coastal cities, which adds the 25% defense.
Well, not actually invisible, it is floodplains :goodjob:

Of course, when rival takes over the city, 25% is gone.
But if Belem owner takes over rival's coastal city, 25% will be there

Artwork by Hrochland

I like this one, does the pernement defense exclude gunpowder units?
 
Take it as planting a forest in the city. The defense bonus cannot be bombarded to 0 unlike walls or culture. And doesn't care whether the attacker is advanced units like tanks and planes, or crappy ones like warriors
 
Take it as planting a forest in the city. The defense bonus cannot be bombarded to 0 unlike walls or culture. And doesn't care whether the attacker is advanced units like tanks and planes, or crappy ones like warriors

I like that, dont like that in xml its impossibble (atleast i havent found a way) to cive a city a defensive bonust versus gunpowered units as well:mad:


every thought about doing events?
 
not for the time being, lazy to explore the effects of events
 
By the way dacubz145, since you are using Ice Hotel in your mod, I remember it was set as national wonder by default. I advise you to turn it to world wonder to minimise exploits.

@stolenrays thanks. I browsed through your wonders as well to look for inspirations^^ Usually I look at the wonder name, and go to wiki to read abit about what is the purpose of the wonder and think of something to do. But my ideas are getting saturated lol (limited brain cells :crazyeye:), so if you have some ideas for your wonders, that will be nice. However, I noticed some of your wonders are linked to recent political leaders, which is why I did not choose them, because they may be sensitive to some players.

Edit: By the way, that time when i was making Swords Of Qadisiyah, I downloaded the standalone version which contains all the artdefine XMLs etc, but the button was pointing to a folder which does not exist in the standalone. In the end, I went to download your Kuwait mod to get the button. As for Cyrus Cylinder, I take it directly from the same mod, so I am not sure if the button is missing in the standalone either
 
Top Bottom