kolton / d2bot-with-kolbot

d2bot game manager by D3STROY3R with kolbot libs by kolton for d2bs
345 stars 332 forks source link

Drinking antidote/thawing potions #2878

Open kolirio opened 3 years ago

kolirio commented 3 years ago

I have a zerkbarb helping in the runs but his build doesnt have good cold or poison resistance, so I wanted to make him stack a few thawing and antidote potions. Using the function included in OrgTorch.js in the scripts, changed it a little bit:

  if (Chug) {
      if (Config.BaalAssistant.Chug) {
          Town.buyAntidotes(Config.BaalAssistant.Chug);
          for (chugs = 0; chugs < Config.BaalAssistant.Chug; chugs++) {
              delay(500);
              print("glug glug");
              let antidote = me.getItem(514);
              if (antidote) {
                  antidote.interact();
              }
          }
          Town.move("stash");
      }
          delay(100);
  }

Previously i had to define those variables in the script for it to work, and also noticed the function buyAntidotes in Town.js so i replicated a buyThawings. That goes well, as the bot is buying thawing potions if I declare now a function in the scripts

if (Chug) { if (Config.BaalAssistant.Chug) { Town.buyThawings(Config.BaalAssistant.Chug); for (chugs = 0; chugs < Config.BaalAssistant.Chug; chugs++) { delay(500); print("glug glug"); let thawing = me.getItem(517); if (thawing) { thawing.interact(); } } Town.move("stash"); } delay(100); }

But it will not drink the thawing potions.

Any insight would be very valuable.

The change I did in the Town.js for it to buy thawings is:

buyThawings: function (quantity) { let i, thawing, npc = this.initNPC("Shop", "buy Thawing");

  if (!npc) {
      return false;
  }

  thawing = npc.getItem("wms");

  if (!thawing) {
      return false;
  }

  try {
      for (i = 0; i < quantity; i++) {
          thawing.buy(false);
      }
  } catch (e) {
      print(e.message);

      return false;
  }

  return true;

},

gtoilet commented 3 years ago

you will need to set an exception when to drink like when your bo runs out and it recasts same principle when your froze you need to have that trigger the drink

kolirio commented 3 years ago

Well its just supposed to stack the potions right after buying. Each antidote/thawing potion gives you +res and +max res for 30 seconds, and they stack. The function with the antidote works well - it goes, buys the potions and drinks them right after buying. But its just working for the antidote. So I think this is supposed to make it drink the potions, for the antidote this works fine

      for (chugs = 0; chugs < Config.BaalAssistant.Chug; chugs++) {
          delay(500);
          print("glug glug");
          let antidote = me.getItem(514);
          if (antidote) {
              antidote.interact();

Problem is i cannot make it work too for the thawings. Maybe because of the getItem, maybe there is something else I need to define elsewhere.

gtoilet commented 3 years ago

517 is thawing potion so maby just change the getItem#

WiZzMaN47 commented 3 years ago

antidote.interact() Drinks a antidote right... Does thawing.interact() Work?

On Mon, Jan 4, 2021, 12:51 PM chase notifications@github.com wrote:

517 is thawing potion so maby just change the getItem#

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kolton/d2bot-with-kolbot/issues/2878#issuecomment-754180969, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFN3U2PN5QU5HIPETT66ATSYIL37ANCNFSM4VQOTOUA .

texxxmex commented 3 years ago

Does it buy thawing potions? Where exactly does it get stuck?