Iceciro
Special Ability: Decimate
You are both a gentleman and a scholar -thank you for the responses.
if pPlot().getPlotCounter() > 9:
iHell = iHell +1
TypeError: 'CyPlot' object is not callable
ERR: Python function AI_chooseTech failed, module CvGameInterface
Traceback (most recent call last):
File "CvGameInterface", line 179, in AI_chooseTech
[B]File "CvGameUtils", line 1412, in AI_chooseTech[/B]
2) Is there a promotion field to give units access to weapon tiers (bronze/mithril/iron?)
#Assess the enemy
if eTeam.getAtWarCount(True) >= 1:
if eTeam.isHasTech(gc.getInfoTypeForString('TECH_ARCHERY')) == False or eTeam.isHasTech(gc.getInfoTypeForString('TECH_BRONZE_WORKING')) == False:
iGetMilitary = 0
for iTeam2 in range(gc.getMAX_PLAYERS()):
eTeam2 = gc.getTeam(iTeam2)
iTeam = (pPlayer.getTeam())
[B] if eTeam2.isAtWar(gc.getTeam(iTeam)):[/B]
if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_BRONZE_WORKING')):
iGetMilitary = iGetMilitary +1
if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_ARCHERY')):
iGetMilitary = iGetMilitary +1
if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_CONSTRUCTION')):
iGetMilitary = iGetMilitary +1
if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_WARFARE')):
iGetMilitary = iGetMilitary +1
if eTeam2.hasBonus(gc.getInfoTypeForString('BONUS_COPPER')):
iGetMilitary = iGetMilitary +1
if iGetMilitary > 1:
print ("Enemy are superior, be defensive!")
iTech = gc.getInfoTypeForString('TECH_ARCHERY')
if eTeam.isHasTech(iTech) == True:
if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR'):
if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
iTech = gc.getInfoTypeForString('TECH_CONSTRUCTION')
if eTeam.isHasTech(iTech) == True:
ArgumentError: Python argument types in
CyTeam.isAtWar(CyTeam, CyTeam)
did not match C++ signature:
isAtWar(class CyTeam {lvalue}, int)
Coding at 3am = bad code! Can you tell im a noob yet?
Thanks again.
Edit: Still getting an error in PythonErr.log
Code:ArgumentError: Python argument types in CyTeam.isAtWar(CyTeam, CyTeam) did not match C++ signature: isAtWar(class CyTeam {lvalue}, int)
if eTeam.isAtWar(eTeam2):
if eTeam.isAtWar(iSvartalfarTeam):
loop
if unit has promotion:
remove promotion
if unit does NOT have promotion:
End
Return
>>> for n in range(2, 10):
... for x in range(2, n):
... if n % x == 0:
... print n, 'equals', x, '*', n/x
... break
... else:
... # loop fell through without finding a factor
... print n, 'is a prime number'
...
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
for i in range(pUnit.countHasPromotion(iProm)):
pUnit.setHasPromotion(iProm, false)
Python has two kinds of loop, for and while.
while loops work pretty much like while loops in, for instance, c. The equivalent of python for loops are usually called "for each" in other languages.
You may also be interested in the other control structures for loops:
Spoiler :4.4 break and continue Statements, and else Clauses on Loops
The break statement, like in C, breaks out of the smallest enclosing for or while loop.
The continue statement, also borrowed from C, continues with the next iteration of the loop.
Loop statements may have an else clause; it is executed when the loop terminates through exhaustion of the list (with for) or when the condition becomes false (with while), but not when the loop is terminated by a break statement. This is exemplified by the following loop, which searches for prime numbers:
Code:>>> for n in range(2, 10): ... for x in range(2, n): ... if n % x == 0: ... print n, 'equals', x, '*', n/x ... break ... else: ... # loop fell through without finding a factor ... print n, 'is a prime number' ... 2 is a prime number 3 is a prime number 4 equals 2 * 2 5 is a prime number 6 equals 2 * 3 7 is a prime number 8 equals 2 * 4 9 equals 3 * 3
Code:for i in range(pUnit.countHasPromotion(iProm)): pUnit.setHasPromotion(iProm, false)
And I knew there'd be a simple way. Thanks!
That strips all of the stacked promotions from a unit