PDA

View Full Version : Mana full if no monster on screen



Kaguya
11-23-2015, 02:32 PM
Hi guys I have a problem with a script which is used for potting myself almost to full if no monsters on screen.

The majority of this script was that he turns of walker , put himself almost to full and then enable the walker again/

function ManaPercent()
return math.ceil((Self.Mana()/Self.MaxMana()*100))
end
Module.New("Mana Restore", function(module)
if (ManaPercent() < 90) and (#Self.GetTargets(1) == 0) and (Self.ItemCount(ManaID) > 238) and RestoreMana then
setWalkerEnabled(false)
while (ManaPercent() < 90) and (#Self.GetTargets(3) == 0) and (Self.ItemCount(ManaID) > 238) do
Self.UseItemWithMe(ManaID)
wait(500,700)
end
setWalkerEnabled(true)
end
module:Delay(500)
end,RestoreMana)


The problem is, it don't work anymore do you have any idea why ?

Foulwerp
11-23-2015, 11:34 PM
function ManaPercent()
return math.ceil(Self.Mana() / Self.MaxMana() * 100)
end

Module.New("Mana Restore", function(Module)
while (ManaPercent() < 90) and (#Self.GetTargets(8) == 0) and (Self.ItemCount(238) > 0) do
if Walker.IsEnabled() then
Walker.Stop()
end
Self.UseItemWithMe(238)
wait(500, 1000)
end
Walker.Start()
Module:Delay(500)
end)

I rewrote it a little I don't see the need to do a whole if then do the same exact checks in the while. Just use the while loop.

Self.GetTargets(range) meaning Self.GetTargets(1) will only get mobs within 1 step of you. Which means that there are still 4-6 steps that monsters could be on the screen. I would use range 8 so that you know they are actually off screen.


while (ManaPercent() < 90) and (#Self.GetTargets(3) == 0) and (Self.ItemCount(ManaID) > 238) do

That is your problem you put the potion ID for the amount to have, so it only works if you have more than 238 mana potions.

shadowart
11-24-2015, 12:12 AM
Note that a script like this is going to reduce both your exp and profits while doing nothing for your safety if you're a mage - which I'm guessing that you are since there's a 238 in there.