PDA

View Full Version : BuyMana isn't working



shurtup
08-30-2016, 12:02 AM
local MinMana = 25 --- Minimo de Mana para sair da hunt
local MaxMana = 230 --- Maximo de Mana para levar para hunt


elseif (labelName == Refill) then
Walker.Stop()
print([[ComprandoAgora...]])
if (Self.ItemCount(IDMana) < MaxMana) or (Self.ItemCount(IDHealth) < MaxHealth) then
Self.SayToNpc({"hi", "flasks", "yes", "yes", "yes", "yes", "yes", "yes", "trade"}, 65)
wait(2000)
if (Self.ItemCount(IDMana) < MaxMana) then
print([[ComprandoMana...]])
BuyItems(IDMana, MaxMana)
wait(500)
end
if (Self.ItemCount(IDHealth) < MaxHealth) then
BuyItems(IDHealth, MaxHealth)
wait(500)
end
wait(200, 500)
end
Walker.Start()

My script isn't buying manas. it just passes by. and i have the ID and MaxMana set.
What is going on?

AAscripts
08-30-2016, 02:30 AM
it must be like this to work:



local MinMana = 25 ---Minimo de Mana para sair da hunt
local MaxMana = 230 ---Maximo de Mana para levar para hunt

local MinHealth = 20
local MaxHealth = 50

local IDMana = 268 --- Mana pots id
local IDHealth = 266 --- Heal pots id

elseif (labelName == "Refill") then
Walker.Stop()
print([[ComprandoAgora]])
if(Self.ItemCount(IDMana) < MaxMana or Self.ItemCount(IDHealth) < MaxHealth) then
Self.SayToNpc({"hi", "vial", "yes", "trade"}, 65)
wait(2000)
Self.ShopBuyItemsUpTo(IDMana, MaxMana)
wait(2000)
Self.ShopBuyItemsUpTo(IDHealth, MaxMana)
wait(2000)
Walker.Start()


this code is good to buy pots when you are checking supplies


if (labelName == "CheckSupplies") then -- Add this labelname into yours waypoints
if(Self.ItemCount(IDMana) < MaxMana or Self.ItemCount(IDHealth) < MaxHealth) then
Walker.Goto("Bank") -- labelName to go to the bank
Walker.Start()
else
print([[Suficientes supp. Agora to hunt]])
wait(2000)
Walker.Goto("ToHunt") -- labelName to go hunt if there is enought supplies
Walker.Start()


but i recommend you to have another labelName for buying pots like this:


elseif (labelName == "BuyPots") then -- when it reaches the npc this will be execute
Walker.Stop()
wait(1000)
Self.SayToNpc({"Hi", "Vial", "yes", "trade"}, 80)
wait(1000)
Self.ShopBuyItemsUpTo(mpID, mpBuy)
wait(1000)
Self.ShopBuyItemsUpTo(hpID, hpBuy)
wait(1000)
Walker.Start()