Platyping's Python

Beit HaMikdash
Spoiler :
Civ4ScreenShot0012-5.jpg

Been so long I almost forgot what posts to update :mischief:

Something similar to Chrysler Building which does something to Corp HQs
This one does something to Holy Cities.

Since this is an ancient wonder whereas Chrysler is modern wonder, thus the benefits are not as awesome, else too OP.

Adds a priest to each holy city, if city is holy site of 3 religions, then city gets 3 priests.
To make it different enough from Chrysler to be released, it also sets the city as the new holy city of the state religion. The old one is no longer the holy city of course :mischief:

80% cut and paste, 20% creativity

Artwork from Hrochland


Countdown to 200: 11

Edit:
Removed Movement benefit from Peterhof Palace to avoid exploit.
It now only gives 1 xp for pillage, so cannot pillage a town to emptiness in 1 turn and won't be so OP

Gigapack updated
 
Expanded your code
Code:
if CyMap().getMapScriptName () =="1914.CivBeyondSwordWBSave":
			if iGameTurn == 3:
				iBatmanTeam = -1
				iRobinTeam = -1
				iSupermanTeam = -1
				iSpidermanTeam = -1
				iJokerTeam = -1
				for iPlayerX in range(gc.getMAX_CIV_PLAYERS()):
					pPlayerX = gc.getPlayer(iPlayerX)
					if pPlayerX.isAlive():
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_TURK"):
							iBatmanTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_TURK"):
							iRobinTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_ROBIN"):
							iSupermanTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_ROBIN"):
							iSpidermanTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_ROBIN"):
							iJokerTeam = pPlayerX.getTeam()
				if iBatmanTeam > -1 and iRobinTeam > -1 and iBatmanTeam != iRobinTeam:
					gc.getTeam(iBatmanTeam).declareWar(iRobinTeam)
				if iSupermanTeam > -1 and iRobinTeam > -1 and iSupermanTeam != iRobinTeam:
					gc.getTeam(iSupermanTeam).declareWar(iRobinTeam)
				if iSpidermanTeam > -1 and iRobinTeam > -1 and iSpidermanTeam != iRobinTeam:
					gc.getTeam(iSpidermanTeam).declareWar(iRobinTeam)
				if iJokerTeam > -1 and iRobinTeam > -1 and iJokerTeam != iRobinTeam:
					gc.getTeam(iJokerTeam).declareWar(iRobinTeam)
That is correct, right?
 
No idea what u trying to do.
If playerX is turk, batman = playerX
If playerX is turk, robin = playerX
Effectively, batman and robin are the same player.
Same for the other cases
 
You can say so, although if there are gonna be alot of players, you might want to use elif in the loop instead of if for all the if statements.

Eg:
if playerX is Chinese:
Batman is playerX
if playerX is Arabian:
Robin is playerX

Change to
if playerX is Chinese:
Batman is playerX
elif playerX is Arabian:
Robin is playerX

Since a player is either Chinese or Arabian, using elif instead of if, if he is Chinese, the rest will be skipped
 
You can say so, although if there are gonna be alot of players, you might want to use elif in the loop instead of if for all the if statements.

Eg:
if playerX is Chinese:
Batman is playerX
if playerX is Arabian:
Robin is playerX

Change to
if playerX is Chinese:
Batman is playerX
elif playerX is Arabian:
Robin is playerX

Since a player is either Chinese or Arabian, using elif instead of if, if he is Chinese, the rest will be skipped
That makes sence to me, but the part i bolded confuses me a bit. It sounds similar to a switch statement in java, if it is one of those, it will skip the rest. But with elif it does not need to be activated correct? Meaning if i have six civs it checks for, and its not one of those, it will just discount it correct?
 
in that case it will run into an else statement, elif stands for else if

if greece
else if turkey
else if china
else

so if you had six civs to check and it was the second one then yes, the rest would be skipped. But when you reach the end of the six civs if a match isn't found then it either does nothing or runs into the else statement.

Hope that helped
 
you put in a CyTeam instance instead of the iTeam.

also you seem to have missed another variable

VOID declareWar (TeamType eTeam, BOOL bNewDiplo, WarPlanType eWarPlan)

so instead try pAttackingTeam.declareWar(iDefendingTeam, True, eWarPlan)

where eWarPlan is the number representing either:

-1 = NO_WARPLAN
0 = WARPLAN_ATTACKED_RECENT
1 = WARPLAN_ATTACKED
2 = WARPLAN_PREPARING_LIMITED
3 = WARPLAN_PREPARING_TOTAL
4 = WARPLAN_LIMITED
5 = WARPLAN_TOTAL
6 = WARPLAN_DOGPILE

remember to use the API to check your methods!

Btw, I am writing a guide on how to use the API and basic python scripts so when thats done take a look :p (that includes you plat, you need to make sure it is up to scratch :D)
 
Got this error with this code is activated
Code:
if CyMap().getMapScriptName () =="1914.CivBeyondSwordWBSave":
			if iGameTurn == 10:
				iBatmanTeam = -1
				iRobinTeam = -1
				iSupermanTeam = -1
				iSpidermanTeam = -1
				iJokerTeam = -1
				for iPlayerX in range(gc.getMAX_CIV_PLAYERS()):
					pPlayerX = gc.getPlayer(iPlayerX)
					if pPlayerX.isAlive():
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_TURK"):
							iBatmanTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_RUSSIA"):
							iRobinTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_SERBIA"):
							iSupermanTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_BRITAIN"):
							iSpidermanTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_FRANCE"):
							iJokerTeam = pPlayerX.getTeam()
				if iBatmanTeam > -1 and iRobinTeam > -1 and iBatmanTeam != iRobinTeam:
					iBatmanTeam.declareWar(iRobinTeam, True, 5)
				if iSupermanTeam > -1 and iRobinTeam > -1 and iSupermanTeam != iRobinTeam:
					iSupermanTeam.declareWar(iRobinTeam, True, 5)
				if iSpidermanTeam > -1 and iRobinTeam > -1 and iSpidermanTeam != iRobinTeam:
					iSpidermanTeam.declareWar(iRobinTeam, True, 5)
				if iJokerTeam > -1 and iRobinTeam > -1 and iJokerTeam != iRobinTeam:
					iJokerTeam.declareWar(iRobinTeam, True, 5)
 

Attachments

  • Civ4ScreenShot0020.JPG
    Civ4ScreenShot0020.JPG
    89.5 KB · Views: 71
Code:
	def onEndGameTurn(self, argsList):
		'Called at the end of the end of each turn'
		iGameTurn = argsList[0]
## Batman fights Robin ##
		if CyMap().getMapScriptName () =="1914.CivBeyondSwordWBSave":
			if iGameTurn == 5:
				iBatmanTeam = -1
				iRobinTeam = -1
				for iPlayerX in range(gc.getMAX_CIV_PLAYERS()):
					pPlayerX = gc.getPlayer(iPlayerX)
					if pPlayerX.isAlive():
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_BATMAN"):
							iBatmanTeam = pPlayerX.getTeam()
						if pPlayerX.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_ROBIN"):
							iRobinTeam = pPlayerX.getTeam()
				if iBatmanTeam > -1 and iRobinTeam > -1 and iBatmanTeam != iRobinTeam:
					gc.getTeam(iBatmanTeam).declareWar(iRobinTeam, true, -1)
you put in a CyTeam instance instead of the iTeam.

also you seem to have missed another variable

VOID declareWar (TeamType eTeam, BOOL bNewDiplo, WarPlanType eWarPlan)

so instead try pAttackingTeam.declareWar(iDefendingTeam, True, eWarPlan)

where eWarPlan is the number representing either:

-1 = NO_WARPLAN
0 = WARPLAN_ATTACKED_RECENT
1 = WARPLAN_ATTACKED
2 = WARPLAN_PREPARING_LIMITED
3 = WARPLAN_PREPARING_TOTAL
4 = WARPLAN_LIMITED
5 = WARPLAN_TOTAL
6 = WARPLAN_DOGPILE

remember to use the API to check your methods!

Btw, I am writing a guide on how to use the API and basic python scripts so when thats done take a look :p (that includes you plat, you need to make sure it is up to scratch :D)

Sorry Jamie, mine got QC before I copy and paste :D
And dacubz, the answer was already posted above your question
 
gc.getTeam(iBatmanTeam) instead of iBatmanTeam
 
Wonder of June
Potala Palace
Spoiler :
Civ4ScreenShot0014-2.jpg


Countdown to 200: 10
 
Not sure what the answer is. I switched the declare war thing like he said

did i miss something??

yup, I told you to switch the first arguement (you had pDefender instead of iDefender)

pAttacker.declareWar(iDefender, True, 0)

you did this

iAttacker.declareWar(iDefender, True, 0)

you are trying to call a method on a number which isn't possible

so as plat says, use
pAttacker = gc.getTeam(iAttacker)

also, what does "Mine got QC" mean plat?
 
Back
Top Bottom