[Change] Minor AI tweaks.

This commit is contained in:
Allanis 2014-04-29 17:25:54 +01:00
parent d6b0ab0e16
commit 0811f18dd7
3 changed files with 9 additions and 2 deletions

View File

@ -85,9 +85,11 @@ end
--Attack target.
function e_attack(target)
if command then
if target ~= nil then
ai.pushtask(0, "attack", target)
end
end
end
-- Hold position.
function e_hold()

View File

@ -83,6 +83,11 @@ function attacked(attacker)
if ai.target() ~= attacker then
ai.pushtask(0, "attack", attacker)
end
elseif task == "runaway" then
if ai.target() ~= attacker then
ai.poptask()
ai.pushtask(0, "runaway", attacker)
end
end
end

View File

@ -14,7 +14,7 @@ function control()
enemy = ai.getenemy()
-- There is an enemy.
if enemy ~= 0 then
if enemy ~= nil then
if ai.dist(enemy) < enemy_dist or ai.haslockon() then
ai.pushtask(0, "runaway", enemy)
return