Challenge: The One Wizard

LUA, but any help appreciated. I have been playing around with the code, but am having trouble due to the somewhat limited options and trying to make them all work together correctly.

while true do
    local enemy = hero:findNearestEnemy()
    local distance = hero:distanceTo(enemy)
        if enemy then
            if hero:isReady("lightning-bolt") then
                hero:cast("lightning-bolt", enemy)
            elseif hero:canCast("regen") then
                hero:cast("regen", self)
            else
                hero:attack(enemy)
            end
end
end

I know this has been asked before, but I’d like to discuss the possibilities if anyone is willing.

Here is my current code now that I am working on. I still haven’t integrated “root” into this version and will target “Freesa” and more.

while true do
local enemy = hero:findNearestEnemy()
if enemy then
    distance = hero:distanceTo(enemy)
        if enemy.type == "ogre" then
            hero:moveXY(10, 36)
        elseif distance < 10 and hero:canCast("chain-lightning", enemy) then
            hero:cast("chain-lightning", enemy)
        elseif hero:canCast("lightning-bolt", enemy) then
                hero.cast("lightning-bolt", enemy)
        elseif hero:canCast("regen", hero) and hero.health < 50 then
                hero:cast("regen", hero)
        else
            hero.attack(enemy)
        end
end
end

I solved it. In the spirit of the forum, I won’t post a solution, but I will give some hints.

  1. use this (or your equivalent if not in LUA):
    if enemy.type == “catapult” then

For example, moving around and doing stuff while avoiding the catapult fire.

  1. Take sure you are using all of your spells and considering when they are best used.

  2. Time stepping on the pressure plate (the circle) for the moment the ogres spawn in, or shortly after.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.