I downloaded your script anyway to give it a go

Moderators: Scripting / Modding Moderators, Moderators for English X Forum
Code: Select all
Victim = Find nearest missile aiming at me
if Victim doesn't exist
Find nearest enemy in range of my turret
end
Code: Select all
024 * Phase 1, Targeting
025 * Scan for missiles
026 $missile = [THIS] -> find nearest missile aiming to me
027 if $missile -> exists
028 if [THIS] -> is $missile in firing range of turret $turretid
029 $victim = $missile
030 goto label targetlocked
031
032 else
033 $victimarray = [THIS] -> get array of missiles aiming to me
034 $size = size of array $victimarray
035 if $size > 1
036 skip if $size < $maxtargets
037 $size = $maxtargets
038
039 $count = 0
040 while $count < $size
041 $missile = $victimarray[$count]
042 if [THIS] -> is $missile in firing range of turret $turretid
043 $victim = $missile
044 goto label targetlocked
045 end
046 inc $count =
047 end
048 end
049
050 end
051 end
052
053
054
055 * Scan for small targets
056 $victim = find ship: sector=$sec class or type=Little Ship race=null flags=$flags1 refobj=[THIS] maxdist=$distance maxnum=null refpos=null
057
058 if not [THIS] -> is $victim in firing range of turret $turretid
059 $victimarray = find ship: sector=$sec class or type=Little Ship race=null flags=$flags2 refobj=[THIS] maxdist=$distance maxnum=$maxtargets refpos=null
060 $size = size of array $victimarray
061
062 $count = 1
063 while $count < $size
064 $victim = $victimarray[$count]
065 skip if not [THIS] -> is $victim in firing range of turret $turretid
066 break
067 inc $count =
068 $victim = null
069 end
070
071 end