XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 2 of 2

Thread: Reach NPC - wait as long as npc is not reachable

  1. #1

    Join Date
    Oct 2016
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reach NPC - wait as long as npc is not reachable

    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?

    Code:
    	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()

  2. #2
    Moderator Elvang's Avatar
    Join Date
    Dec 2010
    Location
    B.C. Canada
    Posts
    1,365
    Mentioned
    104 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Atari View Post
    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?

    Code:
    	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.

    Code:
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •