2 -- Based on when pilot is hit by something, then will attempt to retaliate
5 -- triggered when pilot is hit by something
6 function attacked ( attacker
)
8 if task
~= "attack" and task
~= "runaway" then
13 -- now pilot fights back
14 ai
.pushtask(0, "attack", attacker
)
16 elseif task
== "attack" then
17 if ai
.targetid() ~= attacker
then
18 ai
.pushtask(0, "attack", attacker
)
24 function taunt ( target
)
26 if num
== 0 then msg
= "You dare attack me!"
27 elseif num
== 1 then msg
= "You are no match for the Empire!"
28 elseif num
== 2 then msg
= "The Empire will have your head!"
29 elseif num
== 3 then msg
= "You'll regret this!"
31 if msg
then ai
.comm(attacker
, msg
) end
36 target
= ai
.targetid()
38 -- make sure pilot exists
39 if not ai
.exists(target
) then
44 dir
= ai
.face( target
)
45 dist
= ai
.dist( ai
.pos(target
) )
46 second
= ai
.secondary()
48 if ai
.secondary() == "Launcher" then
53 if dir
< 10 and dist
> 300 then
55 elseif (dir
< 10 or ai
.hasturrets()) and dist
< 300 then