Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------SCRIPT MADE BY @Froostiin----------------
- ---------------------MAMMOTH AND BADGER-------------------
- -----------------------START AT DEPOT---------------------
- local minCap = 30 -- Minimum capacity to keep hunting.
- local BPActive = false -- Wanna hunt without loot anything? So put this false and when the script reset BP it will just open the main BP to put mana pot and rings/soft.
- local LootBP = "Blue Backpack" -- Backpack that will carry loots.
- local GoldBP = "Brocade Backpack" -- Backpack that will carry gold.
- local Rings = true -- Wanna use any ring to hunt? If yes put true, elseif put false
- local BPRingDP = "Beach Backpack" -- Need to be different than all the other bps | BP where the rings are in DP
- local ringID = 3098 -- ID of ring
- local ringmin = 1 -- Minimum of rings in your bp
- local ringmax = 5 -- Number of rings that you will take on DP BP
- local Soft = true -- Wanna use softboots auto refiller? if yes put true, if not put false
- local StackDP = 0 -- Slot of BP that will be Stackable Items.
- local RareDP = 1 -- Slot of BP that will be Non-Stackable Items.
- local mpID = 268 -- Mana Potion ID.
- local minMP = 25 -- If less then script will exit spawn.
- local buyMP = 100 -- Amount of MPs to buy.
- local costMP = 50 -- Potion Price.
- local hpID = 266 -- Health Potion ID.
- local minHP = 10 -- If less then script will exit spawn.
- local buyHP = 20 -- Amount of HPs to buy.
- local costHP = 45 -- Potion Price.
- local brokesoft = 6530
- local brokesoftmin = 0
- registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
- print ([[
- Mammoth and Badger Svargrond by @Froostiin for Knights]])
- wait(2000)
- function onWalkerSelectLabel(labelName)
- if (labelName == "CheckSupplies") then
- if ((Self.ItemCount(mpID) > minMP) and (Self.Cap() > minCap) and (Self.ItemCount(hpID) > minHP) and (Self.ItemCount(ringID) > ringmin)) then
- if (Soft and Self.ItemCount(6530) > 0) then
- gotoLabel("RefillSoft")
- end
- else
- gotoLabel("Start")
- end
- elseif (labelName == "RefillSoft") then
- setWalkerEnabled(false)
- elseif (labelName == "DepositGold") then
- local cashMP = costMP*(buyMP-Self.ItemCount(mpID))
- local cashHP = costHP*(buyHP-Self.ItemCount(hpID))
- setWalkerEnabled(false)
- Self.SayToNpc({"hi", "deposit all", "yes"}, 65, 10)
- if (cashMP > 0) then
- Self.SayToNpc({"withdraw " .. cashMP, "yes"}, 65)
- wait(700,1000)
- end
- if (cashHP > 0) then
- Self.SayToNpc({"withdraw " .. cashHP, "yes"}, 65)
- wait(700,1000)
- end
- Self.SayToNpc({"balance", "bye"}, 65,5)
- setWalkerEnabled(true)
- elseif (labelName == "DepositItems") then
- setWalkerEnabled(false)
- wait(1900,2400)
- Self.ReachDepot()
- Self.DepositItems({7432, 1}, {3443, 1}, {10307, 0}, {10321, 0}, {10299, 0}, {10296, 0}, {7381, 2})
- wait(1500,1900)
- setWalkerEnabled(true)
- elseif (labelName == "BuyManas") then
- setWalkerEnabled(false)
- Self.SayToNpc({"hi"}, 65)
- wait(700,1000)
- while ((Self.ItemCount(283)+Self.ItemCount(284)+Self.ItemCount(285)) > 0) do
- Self.SayToNpc({"vials", "yes", "yes"}, 65, 10)
- wait(1200,1500)
- end
- Self.SayToNpc({"trade"}, 65)
- wait(1500,3000)
- while (Self.ItemCount(mpID) < buyMP) do
- Self.ShopBuyItemsUpTo(mpID, buyMP)
- wait(500,900)
- end
- while (Self.ItemCount(hpID) < buyHP) do
- Self.ShopBuyItemsUpTo(hpID, buyHP)
- wait(500,900)
- end
- Self.SayToNpc({"bye"}, 65)
- setWalkerEnabled(true)
- elseif (labelName == "ResetBps") then
- if (BPActive) then
- local backpack1, backpack2 = Container.GetByName(LootBP), Container.GetByName(GoldBP)
- setWalkerEnabled(false)
- Self.CloseContainers()
- repeat
- wait(900)
- until (Self.UseItemFromEquipment("backpack") > 0)
- wait (1000)
- Container.GetFirst():OpenChildren(Item.GetID(LootBP), Item.GetID(GoldBP))
- if (backpack1:isOpen() == false or backpack2:isOpen() == false) then
- gotoLabel("ResetBps")
- end
- else
- setWalkerEnabled(false)
- Self.CloseContainers()
- Self.OpenMainBackpack(true)
- end
- setWalkerEnabled(true)
- elseif (labelName == "CheckSupplies2") then
- if (Self.ItemCount(mpID) > minMP) and (Self.Cap() > minCap) and (Self.ItemCount(hpID) > minHP) and (soft and Self.ItemCount(6530) < 1) and (Rings and Self.ItemCount (ringID) > ringmin) then
- gotoLabel("Hunt")
- elseif gotoLabel("GoDP") then
- end
- end
- end
- --==## FUNCTIONS ##==--
- Self.ReachDepot = function (tries)
- local tries = tries or 3
- Walker.Stop()
- 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
- Walker.Start()
- 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 false
- end
- Map.GetUseItems = function (id)
- if type(id) == "string" then
- id = Item.GetID(id)
- end
- local pos = Self.Position()
- local store = {}
- for x = -7, 7 do
- for y = -5, 5 do
- if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
- itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
- table.insert(store, itemPos)
- end
- end
- end
- return store
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement