35 lines
620 B
Lua
35 lines
620 B
Lua
include("../scripts/ai/include/basic.lua")
|
|
|
|
-- Required control rate.
|
|
control_rate = 2
|
|
|
|
function control()
|
|
if ai.taskname() == nil then
|
|
enemy = ai.getenemy()
|
|
|
|
if enemey ~= 0 then
|
|
-- Make hostile to enemy (mainly player).
|
|
ai.hostile(enemy)
|
|
ai.pushtask(0, "attack", enemy)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Required "attacked" function.
|
|
function attacked(attacker)
|
|
task = ai.taskname()
|
|
if task ~= "attack" then
|
|
-- Now pilot fights back.
|
|
ai.pushtask(0, "attack", attacker)
|
|
|
|
elseif task == "attack" then
|
|
if ai.targetid() ~= attacker then
|
|
ai.pushtask(0, "attack", attacker)
|
|
end
|
|
end
|
|
end
|
|
|
|
function create()
|
|
end
|
|
|