When Complete and Working, You pass it a Wrecks Entity ID and it loots it!
TODO:
Make it Salvage the wreck if you have a salvager
pass 2 more variables into it
A set of Strings and a set of ints,
It Loots anything with one of the strings in its name
doesnt loot anything with the typeID of the ints
if i dont pass anything it loots everything.
Credits: Amadeus for the starting Snippet, and Stealthy for help and the parts that use iterators.
Code:
function LootWreck(int64 EntityID)
{
variable int64 EntityID
variable index:item ContainerCargo
variable entity entityToLoot = ${Entity[${EntityID}]}
variable int i = 1
variable int temp = 0
variable index:item cargo
variable iterator cargoIterator
; Make sure that there is actually a cargo container there that matches the name we set
if !${entityToLoot(exists)}
{
return
}
if ${entityToLoot(exists)}
{
echo Looting ${entityToLoot.Name}
}
; If it exists, get close enough to it!
if (${entityToLoot.Distance} > 2500)
{
Entity[${entityToLoot}]:Approach
do
{
wait 20
}
while ${entityToLoot.Distance} > 2450
}
; Always open the cargo container window
Entity[${entityToLoot}:GetCargo[cargo]
do
{
wait 20
}
cargo:GetIterator[cargoIterator]
if ${cargoIterator:First(exists)}
{
do
{
cargoIterator.Value:MoveToMyship
}
while ${cargoIterator:Next(exists)}
}
; After everything is looted...let's clean up our Cargo
Me.Ship:StackAllCargo
; Now close the cargo window (if it's still open)
Entity[${entityToLoot}]:CloseCargo
wait 5
echo Looting Complete
}
Make it Salvage the wreck if you have a salvager
pass 2 more variables into it
A set of Strings and a set of ints,
It Loots anything with one of the strings in its name
doesnt loot anything with the typeID of the ints
if i dont pass anything it loots everything.
Credits: Amadeus for the starting Snippet, and Stealthy for help and the parts that use iterators.