Maybe the if friend: cancels out the “attack” command above it, but it’s hard to be sure since the code isn’t formatted properly.
Please format your code properly by putting the proper back ticks or using the preformated text button. It’s explained in the FAQ that everyone should read “before posting.”
If you give two successive orders to a unit in the same loop cycle (or without letting time pass)
the second order will override the first:
command(attack) + command(move) = command(move)
Hi, the problem is that your hero’s only able to move towards one item, because you’ve only defined on item.
And since move takes practically no time he’ll only move towards it properly when move’s looped.
You should try and use something like:
while hero.gold …
but remember to define the item inside the loop.