def summonTroops():
summon = ["griffin-rider", "paladin"]
index = n % 2
type = summon[index]
if hero.gold >= hero.costOf(type):
hero.summon(type)
n += 1
return
else:
return
Instead of alternating between griffin and paladin, it keeps summoning griffin. Why?
This code is working fine
I tested it like that
n = 0;
def summonTroops():
summon = ["griffin-rider", "paladin"]
index = n % 2
type = summon[index]
if hero.gold >= hero.costOf(type):
hero.summon(type)
n += 1
return
else:
return
while True:
summonTroops()
Problem is somewhere else
I think you have problem with “n” somewhere in the code
hmm
i removed the “griffin-rider” from the summon list, and the paladins got summoned… but when i add the griffins back in as the second term of the array (summon[1]), it does the bug and keeps summoning griffins again.
maybe i used n as a variable somewhere else in my code too…?
OMG i am sooo annoyed right now… i have to go back and search through my thousand loc. Thanks for pointing that out though 