FAQ  •  Register  •  Login

two problems

Forum rules
This forum is for technical discussion only. If you are interested in gameplay or client-side issues, please post in Bitfighter Features.
<<

tazinator

Posts: 352

Joined: Fri Jul 05, 2013 7:35 pm

Post Fri Mar 21, 2014 1:59 am

two problems

main problem: I want this to shoot bullets only when the targetship shoots. it just leaves instead
  Code:
function onTick()
    table.clear(items)
    targetShip = findClosest(findAllObjects(items, ObjType.Ship))
    if(targetShip ~= nil) then
    local targetShiploc = targetShip:getPos()
    local angle = targetShip:getAngle()
    local shield = targetShip:isModActive(Module.Shield)
    local turbo = targetShip:isModActive(Module.Turbo)
    local weapon = targetShip:getActiveWeapon()
    bot:findVisibleObjects(items, ObjType.Bullet)
    local bulletOwner = bullet:getOwner()
        if(bot:canSeePoint(targetShiploc))  then
        if(shield == true) then
            bot:fireModule(Module.Shield)
        end
        if(turbo == true) then
            bot:fireModule(Module.Turbo)
        end
        if(weapon == Weapon.Phaser) or (weapon == Weapon.Triple) or (weapon == Weapon.Bouncer) and (bulletOwner == targetShip) then
            bot:fireWeapon(Weapon.Phaser)
        end
        if(weapon == Weapon.Burst) and (bulletOwner == targetShip) then
            bot:fireWeapon(Weapon.Burst)
        end
    end
    local playerVel = targetShip:getVel()
        if(bot:canSeePoint(targetShiploc))  then
            bot:setVel(1.1*playerVel) --1.1 is speed multiplier
            bot:setAngle(angle)
        else
            bot:setAngle(angle)
        end
    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 Fri Mar 21, 2014 4:17 pm

Re: two problems

Can you post what the log says?
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.

Return to Technical Discussion

Who is online

Users browsing this forum: No registered users and 1 guest