Simple Python Things

The_J, how hard would it be to add a check for city size with the Circus Hagenbeck? That way, only cities larger than size X (Size 10, probably) could get the circus. Otherwise, it doesn't make sense for a huge circus to visit far north ice villages.
 
Is not difficult:
PHP:
pCity = pPlayer.getCity(iCity)
if pCity.isNone():continue
if pCity.getPopulation ()<=10:continue ##<----this here
pCity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"),1)


But i will not add it to my code, because it should be completly random.
 
Is not difficult:
PHP:
pCity = pPlayer.getCity(iCity)
if pCity.isNone():continue
if pCity.getPopulation ()<=10:continue ##<----this here
pCity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"),1)
But i will not add it to my code, because it should be completly random.

Thanks. I wanted it for the World Fair, as it only went to the worlds largest cities.
 
Excellent, Excellent - many thanks, The_J
Your modcomps are fantastic and this now close chapter in my mod what I had very long time open :) :)
I must write to my mod credits beside Master Lexx, Chalid, Sto, Geo, Fierabras, Asio and Stmartin. (time order) Many thanks to you all
thanks The_J

Hroch

P.S. If you want building, I will glad make some for you :hatsoff:
 
a number last weeks :) I must tune my mod to 3,19 and finish what I start. The_J´s work inspired me and I´m glad some from good guys still here :)
many many thanks for my lost building upload, Arian
 
Excellent, Excellent - many thanks, The_J
Your modcomps are fantastic and this now close chapter in my mod what I had very long time open :) :)
I must write to my mod credits beside Master Lexx, Chalid, Sto, Geo, Fierabras, Asio and Stmartin. (time order) Many thanks to you all
thanks The_J

Nice to see it used, thanks :).

P.S. If you want building, I will glad make some for you :hatsoff:

If i'll need one, i'll ask :).
 
I've re-uploaded all my 6 promotions (Marauder advanced, Sneak, Industry Espionage, Celebrity, Respawn, Heroic Strength), because all had a bug, which could have lead to an invalid promoting order for the AI.
I've also fixed an bug, which maybe could have caused OOS errors in multiplayer.
I haven't found this bugs myself, credits for this work go to EmperorFool :).

I've also changed the Heroic Strength and Celebrity button to the 2 new by hrochland, and added the missing messages in the Marauder promotion.
 
Just a quick question - for the newly updated versions of your promotion modcomps, how much of and where in the old coding did you change?
 
Oh, sorry, should have mentioned it.
The part, which is labeled with "AI" (in most times the second part) has been changed, and the important thing here is the last part, which has an additional check. But i've also changed structure a bit, so that the promotion is only named one time and stored while running the script. That will make it a bit fast (but i guess, that's not needed here).

The marauder promotion has also got the messages, which i forgot, so you should also re-merge the first part.
 
The_J, I'm having some issues with the Circus HagenBeck code. I moved it out of the EventManager and into it's own file, where it is loaded by the BUGeventmanager at the games startup. Initally, this seemed to work, but after I set AIAutoPlay for a few hundred turns with the Circus Hagenbeck and my changes, The game spawn a total 4 Circus Hagenbecks, which never rotated cities. Could you take a look at the code, and tell me what I did wrong?
Spoiler :
Code:
from CvPythonExtensions import *
import CvEventInterface
import CvUtil
import BugUtil
import PyHelpers


gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
###################################################


class WorldFair:
	def __init__(self, eventManager):
	
		eventManager.addEventHandler("GameStart", self.onGameStart)
		eventManager.addEventHandler("BeginGameTurn", self.onBeginGameTurn)

	def onGameStart(self, argsList):
		'Called at the start of the game'
		self.oldcity = [-1,-1]
		if (gc.getGame().getGameTurnYear() <> gc.getDefineINT("START_YEAR")):
			for iPlayer in range (gc.getMAX_PLAYERS()):
				player = gc.getPlayer(iPlayer)
				if player.isAlive():
					numbuildings = player.countNumBuildings(gc.getInfoTypeForString("BUILDING_WORLDSFAIR"))
					if numbuildings>0:
						for iCity in range(player.getNumCities()):
							pCity = player.getCity(iCity)
							if pCity.getNumBuilding(gc.getInfoTypeForString("BUILDING_WORLDSFAIR"))>0:
								self.oldcity = [iPlayer,iCity]                                                 
                                        
 
	def onBeginGameTurn(self, argsList):
		'Called at the beginning of the end of each turn'
		iGameTurn = argsList[0]	
		if (CyGame().getTurnYear(iGameTurn)>=1851) and ( iGameTurn % 3 ==0 ):
			counter = 0
			while True:
				counter = counter+1
				if counter>=100:break
				dice = gc.getGame().getMapRand()
				iPlayer = dice.get(gc.getMAX_PLAYERS (), "Players")
				pPlayer = gc.getPlayer(iPlayer)
				if pPlayer.isNone():continue
				if pPlayer.isAlive():
					iCity = dice.get(pPlayer.getNumCities () , "Cities" )
					pCity = pPlayer.getCity(iCity)
					if pCity.isNone():continue
					if pCity.getPopulation ()<=10:continue
					pCity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_WORLDSFAIR"),1)
					CyInterface().addMessage(iPlayer,false,20,CyTranslator().getText("TXT_KEY_CIRCUS_MOVED",(pCity.getName (),pCity.getName ())),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), pCity.getX(), pCity.getY(), True,True) 
					if self.oldcity <>[-1,-1]:
						otherplayer = gc.getPlayer(self.oldcity[0])
						othercity = otherplayer.getCity(self.oldcity[1])
						othercity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_WORLDSFAIR"),0)
						CyInterface().addMessage(self.oldcity[0],false,20,CyTranslator().getText("TXT_KEY_CIRCUS_LOST",(othercity.getName (),othercity.getName ())),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), othercity.getX(), othercity.getY(), True,True)
						self.oldcity = [iPlayer,iCity]                                 
                                        
					break



Also, I would much prefer to have the circus unlocked when 60% of the players have a specific tech than a preset year. The game rarely lines up with the date.
 
I see a problem:

You are setting self.oldcity only if it has already been set to something before. If you have not done an advanced start, it ought to start with self.oldcity = [-1,-1] (set in onGameStart). It will then never change this, so it won't delete the building from the old city. You need to set self.oldcity to store the new information whether or not you remove a previous version, so take it out of the "if self.oldcity <>[-1,-1]" block (change the indentation of "self.oldcity = [iPlayer,iCity]" to the same level as the "if" and the following "break").
 
I see a problem:

You are setting self.oldcity only if it has already been set to something before. If you have not done an advanced start, it ought to start with self.oldcity = [-1,-1] (set in onGameStart). It will then never change this, so it won't delete the building from the old city. You need to set self.oldcity to store the new information whether or not you remove a previous version, so take it out of the "if self.oldcity <>[-1,-1]" block (change the indentation of "self.oldcity = [iPlayer,iCity]" to the same level as the "if" and the following "break").


You mean like this?
Code:
                    if self.oldcity <>[-1,-1]:
                        otherplayer = gc.getPlayer(self.oldcity[0])
                        othercity = otherplayer.getCity(self.oldcity[1])
                        othercity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_WORLDSFAIR"),0)
                        CyInterface().addMessage(self.oldcity[0],false,20,CyTranslator().getText("TXT_KEY_CIRCUS_LOST",(othercity.getName (),othercity.getName ())),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), othercity.getX(), othercity.getY(), True,True)
                    self.oldcity = [iPlayer,iCity]
 
I've just found these Modcomps. Very useful. May I use some of them? Thanks for the great work. :goodjob:
 
I've just found these Modcomps. Very useful. May I use some of them? Thanks for the great work. :goodjob:

Sure :). It's nice to see, when something, what you've done, is used in other mods :).
And if i didn't want that, i wouldn't have released them here.



Another thing: There seems to be a small problem in the wonder messages, i'll change it tomorrow.
 
Another thing: There seems to be a small problem in the wonder messages, i'll change it tomorrow.

After a bit testing, i just claim, that the problem was caused by an outdated civ version -> no problem here.
 
No new things, sorry, just some bugfixes:

1) Reuploaded the European Coal And Steel Community. Unknown resources will now not more be overwritten. Thanks to TC01, who has mentioned this in his action-button-thread.

The fix:
Spoiler :

Change
PHP:
if pPlot.getBonusType(PlotOwner)==-1:

to
PHP:
if pPlot.getBonusType(-1)==-1:




2) Reuploaded the celebrity promotion.
- Fixed a typo, which affected the appying of happiness. Thanks to SaibothLie to mention this :).
- Fixed a bug, that the happiness was not applied to a city, when a unit was build, which had the celebrity promotion as starting promotion.

Fixes:
Spoiler :

1) Search for "PROMOTION_CELEBRITY1" and delete the 1 at the end.
2) Just merge the section after onUnitBuilt



3) Re-uploaded the wonder messages.
I'm still not sure, if there even was a bug, but EmperorFoll has mentioned various things, so i'm a bit uncertain.

Fixes:
Spoiler :

1) After onCityRazed, change in my added code iPlayer to city.getOwner()
2) After onCityAcquiredAndKept change in my added code iOwner to pCity.getOwner()




I hope, the next thing will be done soon (this here).
 
Hi, The_J
Your last minimod I remade to my mod and all works right. Thanks.
With adding new religion I have a new idea, If you have time :hatsoff:
is possible make minimod:
ecumenical_council_building as world wonder (12 culture and 6 spy points and +2 favour with others civs) in city what have 6 and more religions?

thanks for answer :)
Hroch
 
Top Bottom