PDA

View Full Version : Reach NPC - wait as long as npc is not reachable



Atari
10-09-2016, 11:29 AM
Hi. I have problem with buying potions in Farmine. On label "potions" bot is buying potions just when the NPC (Rabaz) is reachable. When Rabaz is not reachable, bot waiting for a few seconds and going away without shopping. How to fix it?
How to do that character will standing near the table as long as he have to reach npc?


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

Elvang
10-09-2016, 11:03 PM
Hi. I have problem with buying potions in Farmine. On label "potions" bot is buying potions just when the NPC (Rabaz) is reachable. When Rabaz is not reachable, bot waiting for a few seconds and going away without shopping. How to fix it?
How to do that character will standing near the table as long as he have to reach npc?


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

You would make a loop that tries to buy until you have a certain amount of potions.



while(less than potions)
do
buyPotions
end


Alternatively you can just make the bot go through the door and talk to the npc, or trap him beforehand.