Post Thu Mar 20, 2014 5:26 pm

Force Bot

Also based on trollbot. Very different with just a few lines change though!

  Code:
---------FORCEBOT
---------based on TROLLBOT by fordcars
---------by Thomas of Hilo, pseudonym tazinator

items = { }

function getName() -- Called once
    return("FORCEBOT")
end

function main() -- This is the first code ran, after loose code
    targetShip = nil
end


function onTick()
    table.clear(items)
    targetShip = findClosest(findAllObjects(items, ObjType.Ship))

    if(targetShip ~= nil) then
        local targetShiploc = targetShip:getLoc()
    local angle = targetShip:getAngle()
        bot:setAngle(targetShiploc)
    bot:setVel(point.new(1000*math.cos(angle), 1000*math.sin(angle)))
        --bot:fireWeapon(Weapon.Burst)
    end
end

 


Warning: Do not use in open space. I don't think they can stop
Play my new level! Two different teams fight over a nexus: One mainly defends while the other attacks! is fun
viewtopic.php?f=33&p=21002#p21002