The If-Stravaganza level help? (LUA)


#1

Please take a look at the picture below:

This what is the code that I wrote for the if-statement level. I’m 100% sure that I’ve written the code correctly and even searched up for the solution, in which I got similar to this. Though the code does not work when I execute it, instead it returns me with an error message saying “this.findNearestEnemy is not a function” as highlighted on line 4 of my code.

Does anyone know the solution to this? I’ve tried everything, thanks


#2

Do you have the right glasses on?


#3

try : instead of . and try to cleave, because you have a warrior

 local enemy = hero:findNearestEnemy()
     if enemy and self:isReady("cleave") then self:cleave(enemy)
     else 
        if enemy then self:attack(enemy) 
        else
        end
    end

#4

Yeah your prediction was correct, I didn’t have the right glasses on >_<

But it’s strange since the glass that I’m using in the screenshot had the “findNearestEnemy” function and is more advanced then the beginner glass - which only had one function, the “findNearestEnemy”. Yet I had to equip that specific one in order for it to work. Could this be an unnoticed bug?


#5

it says i cant use ‘local’ or ‘enemy’


#6

Post your code. Make sure you are using the right language, local is only for LUA, use var for JS and nothing for Python.

Lua: local enemy =

Js: var enemy =

Python: enemy =