Useful Competitors Lua problem


#1

I have tried to fix this code many times but it ends up not working. Please look over this code and help me adjust it as needed. Thanks! :grinning:

            while True do
            local enemy = hero:findNearestEnemy()
            local item = hero:findNearestItem()
               if not (enemy.type is "peon") then end
                   hero:attack(enemy)
               if not (item.type is "poison") then end
                   hero:move(item.pos)

#2

Please give more information about what is happening when you run your code, if it is informing you about any errors, and etc. A screenshot would help…


#3

sorry that i haven’t replied in a while. I have not been on discourse in a while. Ill get a screen shot now.


#4

@Ring I believe you need to use hero:moveXY(item.pos.x, item.pos.y), because you do not have the required boots to use the method “move”


#5

I do. my boots have “Move” as an option. also i think im done with code combat for a bit…