--=== version 2.0 ===-- -- /script local duration, remaining = GetExtraActionCooldown(1); SendSystemChat(remaining) -- /script local icon = GetExtraActionInfo(2) SendSystemChat(icon) -- thi12-2 invisibility -- thi_new35-1 feign death -- ran18-1 snipe -- kni15-2 binding chains -- _war24-2 ghost cavalier transformation -- thi_new45-4 gass trap -- drug_006 avure reguvination (full heal) -- kni48-1 Protective Shield -- telestep = true -- added code to teleport to make it step a little after each teleport mapname = { [1]={ X=3342 , Z=3956, Y=7, Links={[1]={Num=2},}}, [2]={ X=3392 , Z=3944, Y=7, Links={[1]={Num=1},[2]={Num=3},}}, [3]={ X=3441 , Z=3933, Y=7, Links={[1]={Num=2},[2]={Num=4},}}, [4]={ X=3489 , Z=3921, Y=7, Links={[1]={Num=3},[2]={Num=5},[3]={Num=26},}}, [5]={ X=3538 , Z=3916, Y=7, Links={[1]={Num=4},[2]={Num=6},}}, [6]={ X=3582 , Z=3931, Y=7, Links={[1]={Num=5},[2]={Num=7},}}, [7]={ X=3608 , Z=3963, Y=7, Links={[1]={Num=6},[2]={Num=8},}}, [8]={ X=3635 , Z=4010, Y=7, Links={[1]={Num=7},[2]={Num=9},}}, [9]={ X=3654 , Z=4047, Y=7, Links={[1]={Num=8},[2]={Num=10},}}, [10]={ X=3671 , Z=4090, Y=7, Links={[1]={Num=9},[2]={Num=11},}}, [11]={ X=3693 , Z=4128, Y=7, Links={[1]={Num=10},[2]={Num=12},[3]={Num=24},}}, [12]={ X=3706 , Z=4163, Y=7, Links={[1]={Num=11},[2]={Num=13},}}, [13]={ X=3707 , Z=4202, Y=7, Links={[1]={Num=12},[2]={Num=14},}}, [14]={ X=3697 , Z=4247, Y=7, Links={[1]={Num=13},[2]={Num=15},}}, [15]={ X=3680 , Z=4297, Y=7, Links={[1]={Num=14},[2]={Num=16},}}, [16]={ X=3664 , Z=4346, Y=7, Links={[1]={Num=15},[2]={Num=17},}}, [17]={ X=4166 , Z=4415, Y=7, Links={[1]={Num=16},[2]={Num=18},[3]={Num=31},}}, [18]={ X=4406 , Z=3929, Y=7, Links={[1]={Num=17},[2]={Num=19},[3]={Num=30},}}, [19]={ X=4097 , Z=3378, Y=7, Links={[1]={Num=18},[2]={Num=20},[3]={Num=29},}}, [20]={ X=3611 , Z=3421, Y=7, Links={[1]={Num=19},[2]={Num=21},[3]={Num=27},}}, [21]={ X=3359 , Z=3778, Y=7, Links={[1]={Num=20},[2]={Num=22},[3]={Num=36},[4]={Num=26},}}, [22]={ X=3329 , Z=3954, Y=7, Links={[1]={Num=21},[2]={Num=1},}}, [23]={ X=4021 , Z=3944, Y=7, Links={[1]={Num=30},[2]={Num=35},[3]={Num=37},}}, [24]={ X=3830 , Z=4094, Y=7, Links={[1]={Num=35},[2]={Num=32},[3]={Num=11},}}, [25]={ X=3676 , Z=4124, Y=7, Links={}}, [26]={ X=3506 , Z=3836, Y=7, Links={[1]={Num=21},[2]={Num=34},[3]={Num=4},}}, [27]={ X=3681 , Z=3549, Y=7, Links={[1]={Num=34},[2]={Num=20},[3]={Num=28},}}, [28]={ X=3827 , Z=3577, Y=7, Links={[1]={Num=33},[2]={Num=27},}}, [29]={ X=4012 , Z=3551, Y=7, Links={[1]={Num=33},[2]={Num=30},[3]={Num=19},[4]={Num=37},}}, [30]={ X=4169 , Z=3837, Y=7, Links={[1]={Num=29},[2]={Num=23},[3]={Num=18},[4]={Num=37},}}, [31]={ X=4007 , Z=4128, Y=7, Links={[1]={Num=32},[2]={Num=17},}}, [32]={ X=3873 , Z=4097, Y=7, Links={[1]={Num=24},[2]={Num=31},}}, [33]={ X=3835 , Z=3629, Y=7, Links={[1]={Num=33},[2]={Num=28},[3]={Num=29},[4]={Num=34},[5]={Num=37},}}, [34]={ X=3657 , Z=3728, Y=7, Links={[1]={Num=26},[2]={Num=27},[3]={Num=33},[4]={Num=35},[5]={Num=37},}}, [35]={ X=3847 , Z=4029, Y=7, Links={[1]={Num=23},[2]={Num=34},[3]={Num=24},[4]={Num=37},}}, [36]={ X=3062 , Z=3556, Y=7, Links={[1]={Num=21},}}, [37]={ X=3890 , Z=3788, Y=7, Links={[1]={Num=23},[2]={Num=34},[3]={Num=33},[4]={Num=29},[5]={Num=30},[6]={Num=35},}}, } candles = { [55]={ X=4021 , Z=3944, Y=88, Links = {}}, [56]={ X=3830 , Z=4094 ,Y=88, Links = {}}, [57]={ X=3676 , Z=4124 ,Y=88, Links = {}}, [58]={ X=3506 , Z=3836 ,Y=88, Links = {}}, [59]={ X=3681 , Z=3549 ,Y=88, Links = {}}, [60]={ X=3827 , Z=3577 ,Y=88, Links = {}}, [62]={ X=4012 , Z=3551 ,Y=88, Links = {}}, [63]={ X=4169 , Z=3837 ,Y=88, Links = {}}, [64]={ X=4007 , Z=4128 ,Y=88, Links = {}}, [65]={ X=3873 , Z=4097 ,Y=88, Links = {}}, [66]={ X=3835 , Z=3629 ,Y=88, Links = {}}, [67]={ X=3657 , Z=3728 ,Y=88, Links = {}}, [68]={ X=3847 , Z=4029 ,Y=88, Links = {}}, } candlesearch = {[1] ={ X=3838, Z=4024, Y=7},[2] ={ X=4051, Z=3629, Y=7},[3] ={ X=3546, Z=3902, Y=7},[4] ={ X=4024, Z=4052, Y=7},} for k,v in pairs(settings.profile.skills) do v.AutoUse = false end local function travel(_dest,_move,_function) player:update() local path = {} if type(_dest) == "table" then -- _dest are coords if _dest.X ~= nil then dest = {_dest.X,_dest.Z,_dest.Y} else dest = _dest end end --=== determine location ===-- local closest = 1; for i,v in pairs(mapname) do local oldClosestWp = mapname[closest]; if v.Y == nil then if( distance(player.X, player.Z, oldClosestWp.X, oldClosestWp.Z) > distance(player.X, player.Z, v.X, v.Z) ) then closest = i; end else if( distance(player.X, player.Z, player.Y, oldClosestWp.X, oldClosestWp.Z, oldClosestWp.Y) > distance(player.X, player.Z, player.Y, v.X, v.Z, v.Y) ) then closest = i; end end travellocation = closest end --=== determine destination ===-- local closest = 1; for i,v in pairs(mapname) do local oldClosestWp = mapname[closest]; if v.Y == nil then if( distance(dest.X, dest.Z, oldClosestWp.X, oldClosestWp.Z) > distance(dest.X, dest.Z, v.X, v.Z) ) then closest = i; end else if( distance(dest[1], dest[2],dest[3], oldClosestWp.X, oldClosestWp.Z, oldClosestWp.Y) > distance(dest[1], dest[2],dest[3], v.X, v.Z, v.Y) ) then closest = i; end end traveldestination = closest end for pointnum,point in pairs(mapname) do for Num,link in pairs(point.Links) do if mapname[pointnum].Links[Num].dist == nil then mapname[pointnum].Links[Num].dist = distance(point.X, point.Z, mapname[Num].X, mapname[Num].Z) end end end local function findPath(_from, _val) -- initialize local dist = {} -- Current total distances to each point local previous = {} -- Current previous points that yield the shortest distance to those points local completed = {} -- points already checked and finished with local Q = {}-- queue of current points being worked on. Only the index numbers dist[_from] = 0 Q[_from] = true local function getSmallestDist(_Q) -- Look for shortest path in Q local shortestdist = math.huge -- So we don't have to check for nil all the time local shortest for k,__ in pairs(_Q) do if shortestdist > dist[k] then shortestdist = dist[k] shortest = k end end return shortest end local destination_found = false while next(Q) ~= nil do -- not empty -- find point with shortest dist local currNum = getSmallestDist(Q) if currNum == nil then error("I think it finished without finding a path to the destination.") end if mapname[currNum]~= nil then -- This line is not needed. Added because of faulty database currPoint = table.copy(mapname[currNum]) -- see if it's the destination if currNum == _val then destination_found = currNum end if destination_found then -- destination reached print("Destination found") break end -- bring in connected Links that aren't already completed for k,v in pairs(currPoint.Links) do if Q[v.Num] then -- Already in the Q. Update dist. local tmp = dist[currNum] + v.dist if dist[v.Num] > tmp then dist[v.Num] = tmp previous[v.Num] = currNum end elseif not completed[v.Num] then -- add new point Q[v.Num] = true dist[v.Num] = dist[currNum] + v.dist previous[v.Num] = currNum end end end -- This line is not needed. Added because of faulty database -- pop from the Q. completed[currNum] = true Q[currNum] = nil end if next(Q) == nil then print("Didn't find path to destination.") player:sleep() end if destination_found then -- return path -- 'currNum' is the destination table.insert(path,{X=mapname[destination_found].X,Z=mapname[destination_found].Z,Y=mapname[destination_found].Y}) while previous[destination_found] do destination_found = previous[destination_found] --table.insert(path,destination_found) table.insert(path,{X=mapname[destination_found].X,Z=mapname[destination_found].Z,Y=mapname[destination_found].Y}) end end end findPath(traveldestination,travellocation) fly() local count = #path for k,v in pairs(path) do --player:moveTo(CWaypoint(v.X,v.Z,v.Y),true,false,30) teleport(v.X,v.Z,v.Y,true) print(count..": points left to go before destination.") count = (count - 1) end print("Arrived at destination.") end --=== changing teleport settings teleport_SetStepSize(50) teleport_SetStepPause(800) --=== first candle ===-- local elemental = GetIdName(113614) -- Elemental Candstick local point = 1 local agro = 1 local _go local function firstcandle() repeat player:update() local cecandle = player:findNearestNameOrId(elemental,nil) if cecandle then firstaddress = cecandle.Address print("found a candle, teleporting to it now") travel({cecandle.X,cecandle.Z}) repeat player:target_Object(elemental); yrest(500) player:update() until player:hasBuff(505594) _go = true else print("cant find a candle moving location") for k,v in pairs(candlesearch) do if k == point then travel({v.X,v.Z}) end end point = point + 1 end until _go local cecandleone = player:findNearestNameOrId(elemental,nil) end local function secondcandle() _go = false repeat player:update() local cecandle = player:findNearestNameOrId(elemental,nil,cecandleone) if cecandle then secondaddress = cecandle.Address print("found a candle, teleporting to it now") travel({cecandle.X,cecandle.Z}) repeat player:target_Object(elemental); yrest(500) player:update() until player:hasBuff(505595) _go = true else print("cant find a candle moving location") for k,v in pairs(candlesearch) do if k == point then travel({v.X,v.Z,v.Y}) end end point = point + 1 end until _go local cecandletwo = player:findNearestNameOrId(elemental,nil) end local function thirdcandle() _go = false repeat player:update() local cecandle = player:findNearestNameOrId(elemental,nil,cecandletwo) if cecandletwo == cecandle.Address or cecandleone == cecandle.Address then for k,v in pairs(candlesearch) do if k == agro then travel({v.X,v.Z,v.Y}) end end thirdcandle() end if cecandle then print("found a candle, teleporting to it now") travel({cecandle.X,cecandle.Z,}) repeat player:target_Object(elemental); yrest(500) player:update() until not player:hasBuff(505594) _go = true else print("cant find a candle moving location") for k,v in pairs(candlesearch) do if k == point then travel({v.X,v.Z,v.Y}) end end point = point + 1 end until _go end --[[ --=== for testing paths, before mobs spawn is best. --=== must have model to remove the solid doors travel({3835,4298,49}) travel({3842,3838,49}) travel({3847,3379,49}) travel({3842,3838,49}) travel({3437,4069,49}) travel({3842,3838,49}) travel({4240,3610,49}) travel({3842,3838,49}) travel({3444,3607,49}) travel({3842,3838,49}) travel({4245,4067,49}) ]] if not player:hasBuff(505594) then fly() teleport(nil,nil,40) player:target_NPC("Luke Xavi"); yrest(2000); sendMacro("ChoiceOption(3);"); yrest(2000); sendMacro("ChoiceOption(1);"); yrest(5000); teleport(nil,nil,74) player:update() for i = 1,30,1 do teleport(nil,nil,74+i) player:turnDirection(1) yrest(50) end yrest(1000) teleport(nil,nil,120) teleport(3062,3556) teleport(nil,nil,7) teleport(3890,3788) firstcandle() end if not player:hasBuff(505595) then secondcandle() end thirdcandle() -- must already have first 2 buffs to be at this point teleport({3838,3994}) yrest(10000) -- 10 seconds to let mobs despawn for i = 1,30,1 do teleport(nil,nil,7+i) player:turnDirection(1) yrest(50) end teleport({nil,nil,50}) teleport({3842,3838,49}) -- get to chest room --=== Open chests ===-- function clickchest(address) local chest = memoryReadRepeat("byte", getProc(), address + 0x2F0) or 0 if chest ~= 0 then return true else return false end end function matchests() local matchest repeat matchest = player:findNearestNameOrId(113617,nil,clickchest) if matchest then teleport(matchest.X,matchest.Z,matchest.Y+15) repeat player:target_Object(matchest.Id, nil, nil, true); until clickchest(matchest.Address) ~= true end until matchest == nil end function runechests() local runechest repeat runechest = player:findNearestNameOrId(113618,nil,clickchest) if runechest then teleport(runechest.X,runechest.Z,runechest.Y+15) repeat player:target_Object(runechest.Id, nil, nil, true); until clickchest(runechest.Address) ~= true end until runechest == nil end matchests() runechests() player:sleep()