FAQ  •  Register  •  Login

Troll Bot

<<

Fordcars

User avatar

Posts: 1016

Joined: Fri Apr 20, 2012 3:51 pm

Location: Some city, somewhere

Post Tue Apr 02, 2013 6:45 pm

Troll Bot

I was bored so I made this bot, it follows the closest person and shoots bursts at them, useful for trolling when you add 40 of them ;)

  Code:
---------TROLLBOT
---------by fordcars

items = { }

function getName() -- Called once
    return("tROLL bOT")
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()
        bot:setThrustToPt( targetShiploc )
        bot:setAngle(targetShiploc)
        bot:fireWeapon(Weapon.Burst)
    end
end
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.
<<

Fordcars

User avatar

Posts: 1016

Joined: Fri Apr 20, 2012 3:51 pm

Location: Some city, somewhere

Post Tue Dec 24, 2013 4:57 pm

Re: Troll Bot

Updated for 019!
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.
<<

tazinator

Posts: 352

Joined: Fri Jul 05, 2013 7:35 pm

Post Tue Mar 18, 2014 11:27 pm

Re: Troll Bot

changed 1 line.
be inspired!
  Code:
---------TROLLBOT
---------by fordcars

items = { }

function getName() -- Called once
    return("tROLL bOT")
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()
        bot:setThrustToPt( targetShiploc )
        bot:setAngle(targetShiploc)
        bot:activateModule(Module.Turbo)
    end
end

 
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
<<

Fordcars

User avatar

Posts: 1016

Joined: Fri Apr 20, 2012 3:51 pm

Location: Some city, somewhere

Post Wed Mar 19, 2014 7:07 pm

Re: Troll Bot

Hehe nice!
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.
<<

tazinator

Posts: 352

Joined: Fri Jul 05, 2013 7:35 pm

Post Thu Mar 20, 2014 5:16 pm

Re: Troll Bot

FORCEBOT!
based on trollbot...
this time... YOU'RE THE TROLL

Warning: Do not use in open spaces. They will never stop.

  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

 
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

Return to Bots

Who is online

Users browsing this forum: No registered users and 2 guests