Hi, So my code is saying that i don’t have an object. If anyone sees this thank you so much!!
# Practice using modulo to loop over an array
# Choose the mix and order of units you want to summon by populating this array:
summonTypes = ["soldier","soldier","soldier"]
def summonTroops():
# Use % to wrap around the summonTypes array based on len(hero.built)
solider = summonTypes[len(hero.built) % len(summonTypes)]
if hero.gold > hero.costOf(summonTypes["soldier"]):
hero.summon(summonTypes[soldier])
#type = summonTypes[???]
hero.say("I should summon troops!")
def Item():
item = hero.findNearestItem()
if item:
hero.moveXY(item.pos.x,item.pos.y)
def Attack():
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
while True:
summonTroops()
Item()
Attack()
Thank you so much.