So i was tinkering on this level a bit until i find a way to fix the level that doesn’t let me load and i decided to play this level. I can easily do one or two tasks but im trying to get the other bonus but i ran into a problem that i dont understand.
Here is the code, i know it can be improved a bit but i just want to know whats causing this error i will give screenshots with the code and I will place it in text:
You can see the error that its giving me, now here is the code in text:
while true do local target = hero:findNearestEnemy() if target and hero:canCast("chain-lightning", target) then hero:cast("chain-lightning", target) elseif target and target.type == "scout" or target.type == "ogre" or target.type == "catapult" and hero:canCast("lightning-bolt", target) then hero:cast("lightning-bolt", target) elseif target then hero:attack(target) end end