Hi all I'm working on 3 Alien attack drones (1 type pictured) I have a half working script the drone will spot and chase the player but still arnt attacking
heres what I have so far
local attack_delay = {}
function drone_init(e)
attack_delay[e] = 250
descent = 0
totaldescent = 0
rotation = 0
flying = 1
attacking = 0
firing = 0
end
GravityOff(e);
function drone_main(e)
CollisionOff(e)
--PlayerDist = GetPlayerDistance(e)
descent = math.random(-500,500)
rotation = math.random(-100,100)
if GetPlayerDistance(e) < 500 then
flying = 0
attacking = 0
firing = 1
end
if GetPlayerDistance(e) < 1000 and GetPlayerDistance(e) >50 then
flying = 0
attacking = 1
firing = 0
end
if GetPlayerDistance(e) > 1500 then
flying = 1
attacking = 0
firing = 0
end
if flying == 1 then
MoveForward(e,100)
if g_Entity[e]['y'] < 700 then
MoveUp(e,20)
end
RotateY(e,rotation)
totaldescent = totaldescent + descent
elseif attacking == 1 then
MoveForward(e,100)
if g_Entity[e]['y'] > g_PlayerPosY then
MoveUp(e,-20)
end
RotateToPlayer(e)
totaldescent = totaldescent + descent
elseif stinging == 1 then
MoveForward(e,100)
MoveUp(e,20)
RotateToPlayer(e)
if GetTimer(e) > attack_delay[e] then
HurtPlayer(e,1)
attack_delay[e] = GetTimer(e) + 250
end
totaldescent = totaldescent + descent
end
if totaldescent <-50 then
MoveUp(e,10)
totaldescent = totaldescent + 10
anyone know what I'm missing? Thx