I would like to add a 'loot' feature where the autons will dock at every wreck or container within 50 or 100 ls and collect any items in the wreck. This will also use the new 'explored' property to change the color of the wreck in the LRS.
Creating a list of objects to loot is no problem. But I'm struggling with ship orders. Simple ones like "Form up" and "Wait" are easy.
This code (based on PSD code, ty PM) sorta works, the auton will sequentially dock with each wreck, but the color change happens instantly to all wrecks in the list on giving the 'Loot' command.
Code: Select all
(block Nil
(objSetData gSource 'behavior 'looting)
(objSendMessage gSender gSource "Looting")
(enum finalList list
(block Nil
(shpOrder gSource 'dock list)
(objSetProperty list 'explored True)
)
)
(shpOrder gSource 'escort gPlayership (objGetData gSource 'formAngle))
)
Then the auton would fly to the next wreck and repeat until either all the wrecks within the given distance were looted or the auton was full.
Any tips on how to do this? Would there need to be separate Events for travelling to the wreck, a sort of <WhenDocked> event on docking with it and changing the color, another for the procedural looting, then again for the travel to the next wreck, if any? I'm not sure why the 'explored' code is running all at once before the auton reaches the wreck.
Additionally it would be good if both autons could be looting at the same time, but not the same wrecks. I think this would just involve splitting the list unless there is some other way?