Ok run this a few times and it gets consistantly 36-38 chests each time, I have no idea how you could possible get to 50, just seems a bit far fetched.
This teleports between 2 chests and opens them both then teleports again, coords are set in a table. For now it is still doing an CObjectList() every time it teleports, not sure if it adds much time at all in the long run but if rock did the number each chest type thing then you would only need to do it once at start. Like I said though not sure it is slowing it down much.
I set it up as a userfunction for testing, just do commandline and then call it with
It will talk with NPC in instance and then start event and off it goes, so just enter instance and then call it.
Code: Select all
function logchest()
local path = {
{X= -139 , Z= -291, Y= 5 },
{X= -106 , Z= -253, Y= 4 },
{X= -73 , Z= -219, Y= 5 },
{X= -38 , Z= -184, Y= 6 },
{X= -5 , Z= -147, Y= 7 },
{X= 30 , Z= -110, Y= 8 },
{X= 67 , Z= -78, Y= 10 },
{X= 101 , Z= -38, Y= 13 },
{X= 135 , Z= -4, Y= 15 },
{X= 169 , Z= 33, Y= 13 },
{X= 101 , Z= 104, Y= 14 },
{X= 66 , Z= 68, Y= 15 },
{X= 32 , Z= 32, Y= 14 },
{X= -2 , Z= -4, Y= 12 },
{X= -35 , Z= -39, Y= 9 },
{X= -70 , Z= -74, Y= 6 },
{X= -104 , Z= -110, Y= 4 },
{X= -140 , Z= -148, Y= 4 },
{X= -173 , Z= -183, Y= 5 },
{X= -208 , Z= -220, Y= 7 },
{X= -286 , Z= -154, Y= 8 },
{X= -252 , Z= -118, Y= 7 },
{X= -216 , Z= -79, Y= 7 },
{X= -182 , Z= -43, Y= 8 },
{X= -148 , Z= -8, Y= 9 },
{X= -111 , Z= 27, Y= 10 },
{X= -81 , Z= 60, Y= 12 },
{X= -44 , Z= 99, Y= 15 },
{X= -9 , Z= 134, Y= 16 },
}
player:target_NPC("Kekonee")
yrest(500)
RoMScript("ChoiceOption(2)")
yrest(1000)
local starttime = os.time()
local count = 0
local tablechest = {}
local function openchest()
local tablechest = {}
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
local obj = objectList:getObject(i);
if obj.Id == 123536 then
--pawn = CPawn(obj.Address)
obj.distance = distance(obj,player)
--logInfo("secret2","{X= "..pawn.X..", Z="..pawn.Z.."},")
table.insert(tablechest, table.copy(obj))
end
end
-- sort by distance
local function distancesortfunc(a,b)
return b.distance > a.distance
end
table.sort(tablechest, distancesortfunc)
for i = 1, 2 do
if (os.time() - starttime) > 60 then break end
local ttkeeper = os.time()
if 30 > tablechest[i].distance then
repeat
player:target(tablechest[i].Address)
yrest(100)
Attack()
yrest(300)
player:updateCasting()
yrest(200)
until player.Casting or ((os.time() - starttime) > 60) or ((os.time() - ttkeeper) > 3)
yrest(500)
count = count + 1
end
end
end
for i = 1, #path do
if (os.time() - starttime) > 60 then break end
teleport(path[i].X,path[i].Z,path[i].Y)
openchest(true)
end
print(count)
end