PDA

View Full Version : use potions if over x amount of potions



zezztah
01-23-2016, 02:17 PM
hello, im looking if anyone got a script where you automatically use potions if it is over x amount of potions.
I couldn't find it anywhere such a setting in either the lua or config. I think it is encoded for sure.

This due to a script im using where the monster drops great spirit potions and the bot just picks em up and drags em to the supplies bp even though i removed it from Looter. Even tried adding it to looter and changed it to Use on self and Ground. But none of that works.

Thanks in advance!

Oscagi
01-23-2016, 04:40 PM
ManaID = "Mana Potion"
ManaMax = 200
ManaToUse = 80 -- Mana in %.

Module.New('UsePotionsAboveX', function()
if Self.ItemCount(Item.GetID(ManaID)) >= ManaMax and (Self.ManaPercent() <= ManaToUse) then
Self.UseItemWithMe(Item.GetID(ManaID))
else
end
end)

Self.ManaPercent = function ()
return math.abs(Self.Mana() / (Self.MaxMana() * 0.01))
end


If you only want use it when u stay on the cave do a label with name OnCave/OutCave and use Module.Start('UsePotionsAboveX') || Module.Stop('UsePotionsAboveX') i put % of mana bcs its better then use it when ure full of mana.


/Oscagi

zezztah
01-23-2016, 06:04 PM
thanks brother!

edit:
script works like a charm! thanks again

Oscagi
01-23-2016, 06:41 PM
Enjoy it, if u need something more just feel free to ask.