My game is saying there's an error but I have no clue where it is. (Level Cloudrip Commander)


#1
while hero.gold > hero.costOf("soldier"):
    hero.summon("soldier")
    
soldiers = hero.findFriends()
soldierIndex = 0
# Add a while loop to command all the soldiers.
while True:
    soldier = soldiers[soldierIndex]
    hero.command(soldier, "move", {"x": 50, "y": 40})
    hero.move({'x': 50, 'y': 40})
    soldierIndex += 1


It’s saying "command’s argument minion should have type unit, but got null. Hero placeholder needs something to command.

What’s null, for starters? And it’s not pinpointing a specific line, either.


#2

the problem is you are using an infinite loop, try changing the

while True:

Into a

while soldierIndex < soldiers:

#3

while soldier index < len(soldiers) cuz soldierIndex is a number of soldiers and len(soldiers) will give you the number of soldiers. After commanding a soldier increase soldierIndex += 1


#4

null:

  1. having no legal binding force; invalid
  2. having or associated with the value zero
  3. a zero
  4. combine (a signal) with another in order to create a null; cancel out.

Copyright 2018 Google Dictionary, All Rights Reserved.


#5

XD @SuperSmacker
Thanks