PDA

View Full Version : Find free dp



p0pas
08-20-2012, 02:35 PM
There shoud be function like FindFreeDp() or some shit like that cuz char is trying to get to dp when there is still somone there.

desche188
08-20-2012, 02:45 PM
do you newest forgee.lua?

if not

Self.ReachDepot = function (tries) local tries = tries or 3 setWalkerEnabled(false) local DepotIDs = {3497, 3498, 3499, 3500} local DepotPos = {} for i = 1, #DepotIDs do local dps = Map.GetUseItems(DepotIDs[i]) for j = 1, #dps do table.insert(DepotPos, dps[j]) end end local function gotoDepot() local pos = Self.Position() print("Depots found: " .. tostring(#DepotPos)) for i = 1, #DepotPos do location = DepotPos[i] Self.UseItemFromGround(location.x, location.y, location.z) wait(1000, 2000) if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then wait(5000, 6000) if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then setWalkerEnabled(true) return true end else print("Something is blocking the path. Trying next depot.") end end return false end repeat reachedDP = gotoDepot() if reachedDP then return true end tries = tries - 1 sleep(100) print("Attempt to reach depot was unsuccessfull. " .. tries .. " tries left.") until tries <= 0 return falseend

desche188
08-20-2012, 02:52 PM
http://forums.xenobot.net/showthread.php?2392-Lua-functions-by-Forgee&highlight=forgee