Platyping's Python

Quick question

I was testing out my mod and randomly throughout the game i get messages saying "The Empire State buildings has given us _____". They come in threes but the ESB is not even buildable yet and I definatly do not have it.

So I checked my even manager and I realized I have two empire state building codes
Code:
## Empire State Building Start ##
		b_Empire = gc.getInfoTypeForString("BUILDINGCLASS_EMPIRE_STATE")
		if pCity.getNumActiveBuilding(b_Empire) == true:
			freebie = 0
			while freebie < 3:
				randBonus = CyGame().getSorenRandNum(gc.getNumBonusInfos(), "Freebie")
				bonusinfo = gc.getBonusInfo(randBonus)
				if bonusinfo.getBonusClassType() < 3 and bonusinfo.getTechObsolete() == -1 and randBonus != gc.getInfoTypeForString("BONUS_COAL"):	## Coal, Rush, Modern, Wonder Types  and Obsolete ones Excluded
					pCity.changeFreeBonus(randBonus,1)
					CyInterface().addMessage(iNewOwner,true,20,CyTranslator().getText("TXT_EMPIRE_BONUS",(bonusinfo.getDescription(),)),'',0,'',-1,-1,-1, false,false)
					freebie +=1
## Empire State Building End ##
and
Code:
## Empire State Building Start ##
		if iBuildingType == gc.getInfoTypeForString("BUILDINGCLASS_EMPIRE_STATE"):
			iPlayer = pCity.getOwner()

			freebie = 0
			while freebie < 3:
				randBonus = CyGame().getSorenRandNum(gc.getNumBonusInfos(), "Freebie")
				bonusinfo = gc.getBonusInfo(randBonus)

			#### Coal, Rush, Modern, Wonder Types  and Obsolete ones Excluded
				if bonusinfo.getBonusClassType() < 3 and bonusinfo.getTechObsolete() == -1 and randBonus != gc.getInfoTypeForString("BONUS_COAL"):
					pCity.changeFreeBonus(randBonus,1)
					CyInterface().addMessage(iPlayer,true,20,CyTranslator().getText("TXT_EMPIRE_BONUS",(bonusinfo.getDescription(),)),'',0,'',-1,-1,-1, false,false)
					freebie += 1
## Empire State Building End ##

Now by the look of it I should delete the first one. Do you think that will fix the problem (since I dont know what caused it, i can't duplicate it to see if its still there)
 
Both don't look correct to me.
I checked my codes, I didn't write them like that lol.
Check by buildingtype, not building class
if iBuildingType == gc.getInfoTypeForString("BUILDING_EMPIRE_STATE_BUILDING"):

You may want to redownload and compare the codes
 
So updating all the of your codes in my mod. Quick question
for the begining of CN tower
Code:
## CN Tower Start ##
		if iBuildingType == gc.getInfoTypeForString("BUILDING_CN_TOWER"):
			[B]iPlayer = pCity.getOwner()
			pPlayer = gc.getPlayer(iPlayer)[/B]
			iTeam = pPlayer.getTeam()
I can delete the two bolded lines if I have
Code:
		pPlayer = gc.getPlayer(pCity.getOwner())
at the begining on onbuildingbuilt correct?
 
Yes, provided pPlayer is not changed throughout the codes.
You can take a look at Megapack or Gigapack.

I make sure variables like iPlayer, pPlayer, iTeam and pTeam that are going to be used by many wonders are defined right at the start of the section(Eg onBuildingBuilt), but never change throughout the section
 
Just a note though, since I do not know what wonders you took into your mod.
For CN Tower you can merge the two lines into one like what you did, because iPlayer is not used thereafter.

However, since I believe you are merging multiple wonders using the same section (onBuildingBuilt), there may be one or some wonders which are using iPlayer in codes after the two lines. In this case, you still can define the variables right at the start like Megapack and Gigapack, but you have to split the one line into two, else iPlayer is not defined and errors pop up
 
I actually just saw that about two minutes ago and just fixed that thanks!

For empire state building, is there no way to remove the resources? Since there is nothing under oncityrazed im assuming its impossible to remove

Also @ Ezekiel I would suggest changing it so the wonder unlocks shrines for everyone, and the owner can build it without the great prophet since its an ancient wonder and chances are you won't have a great prophet yet, so most likely this will give a lot more benefits in later eras as you get more prophets. If you do that though, give an obsolete tech to the shrine
 
@Empire
Why would you want to remove the resources?
Nothing is under oncityrazed, because the resources are added to the city itself, just like hollywood.
When hollywood is razed, the bonus resources are all gone, same thing for empire, thus no need for codes under razing.

@Ezekiel
Hmm, what you suggested can definitely be done, although without the GP requirement, 1 free priest per city may be too OP in ancient era. Recent works, I don't add the obsolete tech anymore because... obsolete tech takes up an icon in the techscreen lol
 
@Empire
It works exactly how Hollywood works.
If it provides you 2 deer and 1 banana for instance, and your empire already have 5 deer but no banana, then your whole empire will be +1 Health now due to the banana, or more if you have grocery etc.
Then you can trade away the extra deer just like how you can trade away the extra music, drama, and whatever is the last one from BTS resource wonders.
Of course, if you have corps like Sid Sushi or Cereal Mills, and empire grants you 3 fish or 3 rice, then the corps bonus increase as well.
Simple

@Ezekiel
Yup, it isn't meant to grant godly bonus in the ancient era, because chances are very soon you will get a GP due to itself or other early wonders like StoneHenge or Oracle.
Most ancient wonders give GP by the way.
Thus, within the ancient/classical era, the most you will have is 1 or 2 cities with GP settled, so the most you can build 1 or 2 shrines = 1 or 2 free priests, thus not OP.
As you advance through the eras, chances are you don't see GP too often anymore as the late game wonders are mostly other types.
Also, most people settle great people in few cities, they don't spread them across the whole empire, indirectly making this wonder negligible in late game => obsolete
Thus, this ancient wonder will never be so powerful that it grants 1 free spec per city like Liberty, unless... you only have 1 city lol

@cure for cancer
Remade long ago

Imperial Academy
Spoiler :
Civ4ScreenShot0001-14.jpg

National Wonder
Gets a tech boost every time you build a science building.
Science building defined by advisor science.
Wonders like oxford, great library included as well.
Tech boost = 25% of building cost.

Artwork looted from RFCA


Countdown to 200: 5
 
Thought of before as benefit of Hubblespace initially, but cant think of a solution when capital was shifted to shift the vision because capital conquered.
Because I can't think of a way to check if the city captured was a capital.
 
Nope, buildings that should be destroyed are destroyed first before the python codes are activated, including national wonders, religious buildings etc with conquer rate 0.
Non-world wonders with values in between are also determined whether to keep or destroy first as well
 
There are 2 main issues

1) Manually building the palace which triggers onBuildingBuilt and shifts the capital.
I can of course adds the vision to the new capital easily.
But I cannot check where is the old capital to remove the vision.

2) When capital is captured.
As mentioned, I cannot check if the city captured is a capital or not.
Especially if it is the last city (civ destroyed), palace will not even be placed in another city, so that will not solve the problem.
 
I have a solution!

CyCity().getScriptData()
CyCity().setScriptData(STRING szNewValue)

on city built you need to check if the city is a capital if so setScriptData("Player Capital")
Code:
if pCity.getScriptData() == "Player Capital": #on city lost/captured
    pPlayer = gc.getPlayer(pCity.getPreviousOwner())
    if pPlayer.isAlive():
        pPlayer.getCapitalCity().setScriptData("Player Capital")
    pCity.setScriptData("")

if pCity.isCapital(): #or if building is palace, whatever
    pCity.setScriptData("Player Capital")
    # do the loop city thingy here!!!!
    if pLoopCity.getScriptData() == "Player Capital" and not pLoopCity.isCapital():
        pLoopCity.setScriptData("")

that should work I guess :p give it a try!
 
Back
Top Bottom