ROBOT ERROR
- Code:
- -- Selects the appropriate weapon to use for a specific target
function selectWeapon(target)
if(target ~= nil) then
local weapon = nil
-- Currently decides based solely on distance away
if(point.distSquared(target:getPos(),botPos) > 100000) then
weapon = Weapon.Phaser
elseif(point.distSquared(target:getPos(),botPos) < 50000) (point.distSquared(target:getPos(),botPos) > 10000) then
bot:activateModule(Module.Turbo)
else
weapon = Weapon.Burst
bot:activateModule(Module.Shield)
end
return weapon
end
end
This code doesn't work. It's obvious the elseif line is done wrong. explain it please!
I also want to change that else statement into an elseif, see below
else becomes
elseif energy >20% (enough energy to use burst and shield)
else would instead be a run away command
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
viewtopic.php?f=33&p=21002#p21002