Platyping's Python

Another question for the function onGreatPersonBorn.

In the Download of Changdeokgung the following line of CvEventManager is above the codes of the wonder:
if (not self.__LOG_GREATPERSON):

In the same file of the Gigapack, the line is behind the codes of the wonders. Like that it didn´t work for me. When I put the line above and the following lines one step to the right side, it worked.

Before (not working):
Code:
	def onGreatPersonBorn(self, argsList):
		'Unit Promoted'
		pUnit, iPlayer, pCity = argsList
		player = PyPlayer(iPlayer)
		if pUnit.isNone() or pCity.isNone():
			return

		pPlayer = gc.getPlayer(iPlayer)
## Changdeokgung Start ##
		if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_CHANGDEOKGUNG")) == 1:
			if pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_SCIENTIST"):
				pCity.changeFreeSpecialistCount(s_Scientist, 1)
			elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_PROPHET"):
				pCity.changeFreeSpecialistCount(s_Priest, 1)
			elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_ARTIST"):
				pCity.changeFreeSpecialistCount(s_Artist, 1)
			elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_MERCHANT"):
				pCity.changeFreeSpecialistCount(s_Merchant, 1)
			elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_ENGINEER"):
				pCity.changeFreeSpecialistCount(s_Engineer, 1)
			elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_GREAT_SPY"):
				pCity.changeFreeSpecialistCount(s_Spy, 1)
## Tomb of Khalid ibn al-Walid Start ##
		if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_TOMB_OF_KHALID")) == 1:
			if pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_GREAT_GENERAL"):
				pPlayer.changeCombatExperience(pPlayer.greatPeopleThreshold(true) /5)
## Platyping Wonders End ##
		[COLOR="Red"]if (not self.__LOG_GREATPERSON):[/COLOR]
			return
		CvUtil.pyPrint('A %s was born for %s in %s' %(pUnit.getName(), player.getCivilizationName(), pCity.getName()))

After Change (working):
Code:
	def onGreatPersonBorn(self, argsList):
		'Unit Promoted'
		pUnit, iPlayer, pCity = argsList
		player = PyPlayer(iPlayer)
		if pUnit.isNone() or pCity.isNone():
			return
[COLOR="Red"]		if (not self.__LOG_GREATPERSON):[/COLOR]
			pPlayer = gc.getPlayer(iPlayer)
## Changdeokgung Start ##
			if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_CHANGDEOKGUNG")) == 1:
				if pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_SCIENTIST"):
					pCity.changeFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_SCIENTIST"), 1)
				elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_PROPHET"):
					pCity.changeFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_PRIEST"), 1)
				elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_ARTIST"):
					pCity.changeFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_ARTIST"), 1)
				elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_MERCHANT"):
					pCity.changeFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_MERCHANT"), 1)
				elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_ENGINEER"):
					pCity.changeFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_ENGINEER"), 1)
				elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_GREAT_SPY"):
					pCity.changeFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_SPY"), 1)
## Tomb of Khalid ibn al-Walid Start ##
			if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_TOMB_OF_KHALID")) == 1:
				if pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_GREAT_GENERAL"):
					pPlayer.changeCombatExperience(pPlayer.greatPeopleThreshold(true) /5)
## Platyping Wonders End ##

			return
		CvUtil.pyPrint('A %s was born for %s in %s' %(pUnit.getName(), player.getCivilizationName(), pCity.getName()))
 
you'll find that won't always work because self.__LOG_GREATPERSON could presumably be true :p

anyway, not sure how that change would make any difference?
 
Hmm, that time I was wondering if there is any difference so I tested and didn't cause me any problems.
But now when I tried again gave me runtime error as well.
Shifted it back down similar to solos.
 
Since there are bugs to fix in Gigapack, time to release a simple wonder.

Boudhanath
Spoiler :
Civ4ScreenShot0018_zpsa33977be.jpg


Simple idea which I read about in RFCE, so I convert idea into realism.
Poor Culture is considered as the first level, Legendary is 6th Level.
Thus, Max is 6 Happiness, 24 Culture.
Enough for an ancient era wonder I guess.
Can't find any ancient cultural wonders so just added the priests there to well... make it religious

Artwork by Hrochland


Walls of Babylon
Fixed CIV4CityLSystem file in Megapack and Gigapack resulting in no graphics for it.


Megapack and Gigapack updated
 
Thanks again :D
Finally a wonder that you did not say it is OP

Gediminas' Tower
Spoiler :
Civ4ScreenShot0019_zpsbff99cc7.jpg

Well, each time a unit stationed in a city wins a combat, may get free CG promotion.
Of course, to get CG2, unit must have CG1, and to get CG3, unit must have CG2.

Since it is pretty easy to get CG3 especially for Protective Leaders, I added a CG4 that is obtainable only via this wonder, so that it is still useful.
Civ4ScreenShot0021_zps20cdc787.jpg


Artwork by Hrochland
 
Boudica or Tokugawa with that... :eek:
 
Periodic Table
Spoiler :
Civ4ScreenShot0000_zps43e66207.jpg


Elements:
Iron, Gold, Silver, Aluminium, Copper, Uranium

Just a simple on Built project, not every turn effect
If player has tech reveal of the bonus, he will get a message, else the bonus is added but the player is not informed.


Via Appia
Codes cut using pPlot.getTeam()
 
Hey Platyping,

Would it be possible to make a wonder that gives a reduction on tech cost of a certain flavorvalue or advisortype?
I found 2 pythonfunctions that can check for

flavorvalue: INT getFlavorValue (INT i)

and for

advisortype: INT getAdvisorType ()


Would be great to have a wonder that reduces the cost of all religion-flavored techs or military advisor techs.
 
Cannot literally "reduce" or "increase" tech cost via python.

What can be done is "adjust" the amount of research done of that tech.
For instance, if Satellites need 10,000 hammers to research, there is no way in python to adjust it so that you require 8000 instead.
What I can do is, when you have the wonder, add 2,000 to Satellites so that it is now 2000/10000 completed. Thus, in a sense, you require 8,000 to complete it now thanks to the wonder.
Of course, when the wonder is captured, then the 2000 is removed and added to the new owner, so now you need 10,000 to complete Satellites again.
But then, if you already completed Satellites when the wonder is captured, then the 2000 will not be removed, since it is stupid if you suddenly lose a tech due to the loss of the wonder.

In a sense, it will work similar to Newton's University or Large Hadron Collider

Checking the tech list, it seems that if you want it for religious techs, you will need a very early wonder though, since majority of religious techs are in ancient era. The last religious tech is Divine Right, so if the wonder is somewhere in Classical/Medieval Era, it may be pretty useless unless it grants like 50% to all or 1 free religious tech.

A cultural one or military one may make more sense, since there are more of those in late games.
If you are happy with the way it works, then choose the wonder and let me know.
 
Cannot literally "reduce" or "increase" tech cost via python.

What can be done is "adjust" the amount of research done of that tech.
For instance, if Satellites need 10,000 hammers to research, there is no way in python to adjust it so that you require 8000 instead.
What I can do is, when you have the wonder, add 2,000 to Satellites so that it is now 2000/10000 completed. Thus, in a sense, you require 8,000 to complete it now thanks to the wonder.
Of course, when the wonder is captured, then the 2000 is removed and added to the new owner, so now you need 10,000 to complete Satellites again.
But then, if you already completed Satellites when the wonder is captured, then the 2000 will not be removed, since it is stupid if you suddenly lose a tech due to the loss of the wonder.

In a sense, it will work similar to Newton's University or Large Hadron Collider

Checking the tech list, it seems that if you want it for religious techs, you will need a very early wonder though, since majority of religious techs are in ancient era. The last religious tech is Divine Right, so if the wonder is somewhere in Classical/Medieval Era, it may be pretty useless unless it grants like 50% to all or 1 free religious tech.

A cultural one or military one may make more sense, since there are more of those in late games.
If you are happy with the way it works, then choose the wonder and let me know.

I have no particular wonder in mind, nor particular flavor or advisor techs. I was just wondering if it is possible at all :)
Consider it as an idea for a potential new wonder ;)
 
The thing is... there are alot of unused artwork for religious wonders.
But there are none left for most others except the newly made Torre Del Oro by Hrochland, or the super modern ones by dacubz145.

Dacubz145 ones are out, since this wonder obviously has to be built early else there is no point since you already got most techs if it is a very modern wonder.
Thus... if you want, I can use Torre Del Oro for military techs, or just use an early Religious one and treat it as a cultural wonder :D

P.S.
Seems like alot of Military Techs though :D
 
yup mine would be out of the question - unless you wanted to do something really ancient with Bluestonehenge. There isnt much detail on that though, but what there is it would probably be a religious wonder

Theres some interested art in cool3a2's huns civ that Ive never seen before - the palaces could definatly be wonders but arent specificly anything
 
Torre del Oro
Spoiler :
Civ4ScreenShot0002-25.jpg

Pretty much a cut and paste job from Newton.
Unlike Newton which is a built and forget style, for this wonder, the effects are adjusted to the new owner and taken away from old owner if the wonder is captured.

Yeah, I know it is made of stone. But since there are so many stone wonders, and this tower is named Tower of Gold, I guess it doesn't hurt :D

Artwork by Hrochland
 
Torre del Oro
Spoiler :
Civ4ScreenShot0002-25.jpg

Pretty much a cut and paste job from Newton.
Unlike Newton which is a built and forget style, for this wonder, the effects are adjusted to the new owner and taken away from old owner if the wonder is captured.

Yeah, I know it is made of stone. But since there are so many stone wonders, and this tower is named Tower of Gold, I guess it doesn't hurt :D

Artwork by Hrochland

Looks good to me :goodjob:
 
Tomb of the Unknowns
Spoiler :
Civ4ScreenShot0003-20.jpg

National Wonder

Not sure if this is useful at all, because I have never seen AI raze cities, except 1 population ones
Artwork by Dacubz145
 
Hey platyping,

Is it possible to add an obsolete tech for your Matsumoto Castle wonder?

EDIT
I guess this already does the trick:

Code:
if loopCity.getNumActiveBuilding(b_Matsumoto) == true:

I suppose if the player has the obsolete tech than this equation would be false and the city defense wouldn't be restored to 100%, right?
 
Back
Top Bottom