Code: Select all
If turret is placed, add turret to THELIST -- have this working, and THELIST is just a psedoname
If turret is removed/destroyed, remove turret from THELIST -- have this working
Cycle through THELIST -- have this working
If turret has target
if targetRange > 50
break
else
find new target -- I know how to do this, just not coded
end
else
find new target
if no new target, idle -- I think I can get this to work
end
However so far all of my attempts to store ID on the biters, or target info on the turrets have failed. I cannot add a .target field to the turrets stored in THELIST, I cannot add an ID field to the biters I want to track. I have tried:
Code: Select all
if not glob.artillerytable[entry].target then
glob.artillerytable[entry].target = {}
end
I can create and maintain a parallel list for storing the targets and data, but how am I supposed to track my targets easily?! If I want to verify that my turrets current target is still valid, how can I find that same biter again later? The interval between acquiring a target, and checking later means that the position data will be completely different by then, so I can't use that, and I can't add a field to it ...
Any thoughts on this? I'm completely out of ideas right now.