I need to know if witch switches all the monsters or just yours.
Swap your players in lanes
1
and2
. Don’t need a second parameter:hero.play("switch")
.
From Docs
also what is wrong with this
while True:
for monster in hero.findTheirMonsters:
if monster.type == "threat":
hero.summon("threat")
for monster in hero.findTheirMonsters:
if monster.type == "big":
hero.summon("big")
for monster in hero.findTheirMonsters:
if monster.type == "charger":
hero.summon("charger")
for monster in hero.findTheirMonsters:
if monster.type == "driver":
hero.summon("driver")
for monster in hero.findTheirMonsters:
if monster.type == "sniper":
hero.summon("sniper")
hero.summon("threat", 1)
hero.play("boost", 1)
hero.play("hot", 1)
hero.play("goliath", 1)
Have no idea. Is there some error raised? Or it behave differently from your plans?
What’s the answer you expect from such answer. My advice – learn to ask.
You can do this in a much neater way, you can make only one for-loop and then all the if and elif statements inside it. And the error you are getting is because if there isn’t a player, it can’t get its type. What you can do is to check if there’s a player first. Example of both things:
for monster in hero.findTheirMonsters(): # Don't forget the parentheses when calling a function!
if monster:
if monster.type == "type a":
# Execute a certain piece of code
elif monster.type == "type b":
# Execute another piece of code
# etc...
Summon what the lane?
I think this would work better:
while True:
lane = 1 # you need a lane
for monster in hero.findTheirMonsters(lane):
hero.summon(monster.type, lane)
hero.summon("threat", lane) # I don't think this is needed, but ok...
hero.play("boost", lane)
hero.play("hot", lane)
hero.play("goliath", lane)
Yes, I know, but I mean for summoning I just added it to hero.findTheirPlayers
because it would make it more reliable for order
i have no idea thats what I was talking about