kolton / d2bot-with-kolbot

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

How to go straight to Canyon of the Magi after Summoner? #1408

Closed firekil closed 5 years ago

firekil commented 5 years ago

I would like to open and take the portal to Canyon of the Magi after killing the summoner so that I can do Duriel right after.

In the Mephisto.js script you have this line:

if (Config.Mephisto.TakeRedPortal) {
        Pather.moveTo(17590, 8068);
        delay(1500);
        Pather.moveTo(17601, 8070);
        Pather.usePortal(null);
}

Can I do something similar for the Summoner?

DarkHorseDre commented 5 years ago

I guess you could if you know the coords for the red portal (try: while(true){say(me.x+","+me.y);delay(2000);})

the issue i see is that once your summoner script ends you will need to run duriel script, which will make the toon tp to town.. there are a few ways around this but will involve some mods I reckon (e.g. call the duriel script from the summoner etc. but then the more creative types may have already solved this :p )

5noop commented 5 years ago
    let journal = getUnit(2, 357);

    if (!journal) {
        throw new Error("Journal not found");
    }

    Pather.moveTo(journal.x, journal.y);
    journal.interact();
    delay(500);
    me.cancel();

    for (let i = 0; i < 20; i++) {
        if (Pather.getPortal(46)) {
            break;
        }
        delay(50);
    }

    if (i === 19) {
        throw new Error("Arcane portal not found")
    }

    Pather.usePortal(46);

But then as @DarkHorseDre said you shouldn't start the existing Duriel script because it will make you go to town. So what you could do for example is to copy what you need from Duriel script and paste it in the Summoner script.

firekil commented 5 years ago

Ok so adding (as 5noop suggested)

if (Config.Summoner.Journal) {
        let journal = getUnit(2, 357);

        if (!journal) {
            throw new Error("Journal not found");
        }

        Pather.moveTo(journal.x, journal.y);
        journal.interact();
        delay(500);
        me.cancel();
}
Pather.usePortal(46);

after the line Attack.clear(15, 0, 250); // The Summoner in Summoner.js lets me open and take the portal. (I also added Config.Summoner.Journal = true; in the config file under the Summoner option)

So it looks like this and I can easily toggle it on or off:

Scripts.Summoner = false;
        Config.Summoner.Journal = true;
        Config.Summoner.FireEye = false;

After that I commented out Town.doChores and Pather.useWaypoint(46) in the Duriel script. I assumed it would jump straight to pre-cast and then move to the tomb. However I still encounter an error whereas the Duriel script tells me "Failed to move to Tal Rasha's Tomb". Should I move to the canyon of magi WP before beginning the Duriel script or is there some other solution?

noah- commented 5 years ago

this would be a good feature for a pr

5noop commented 5 years ago

@firekil: The bot will automatically go to town between 2 scripts so put everything in the Summoner script, killing Duriel included. Also you are missing a part of what I wrote in your post.

@noah-: any way to do something smarter than a copy/paste of the Duriel script in the Summoner script ?

firekil commented 5 years ago

@5noop the part I left out was returning an error and it seemed to work fine without it. I think it only returns to town because Town.doChores is called in every script.

DarkHorseDre commented 5 years ago

@5noop can the summoner script call the duriel script? if so, can a check on journal config and me.area be used to tell the duri script to not do town chores but instead continue to duri? something like:

var i, unit;

if (!Config.Summoner.Journal && me.area !== 46) { Town.doChores(); Pather.useWaypoint(46); } Precast.doPrecast(true); //do this as first action if we are continuing from summoner (we are in canyon and Config.Summoner.Journal is true) .. ..

5noop commented 5 years ago

@DarkHorseDre Yeah a script is a function so we can call it as long as the file is included. Your idea should work but then we would have a Summoner parameter in the Duriel script, I'm not a huge fan of that. Still better than copy/paste the whole Duriel script in Summoner though. Maybe I can only put the condition with me.area !==46

@firekil where is the error ? it works fine for me

DarkHorseDre commented 5 years ago

word.

well I was simplifying. I'm ultimately talking about a config parameter for the summoner to Duriel link. could be something more appropriate? "config.killduriaftersummoner" or similar?

5noop commented 5 years ago

If we follow the convention it should be Config.Summoner.KillDuriel. It's just that I don't like the idea of using a Summoner config parameter in anything else than the Summoner script, scripts should be as standalone as possible. A global parameter would be even worse imo, the char config file is messy enough.

Anyway a check with me.area should be good enough.

noah- commented 5 years ago

could add something in both the summoner and duriel script to check if the other is enabled and modify what to do based on that (use book and do duriel vs go to town and do normal)

DarkHorseDre commented 5 years ago

yeah that wasn't literal @5noop , and I hear you, but we already link rakanishu to gris and other boss links. Theres no way to avoid either setting global params or link params from script to script - the modular design can only stretch so far to accommodate what we do naturally - after all, thats what the boss should be mimicking! For firekil's needs I think a param will allow him to do what he wants without affecting the solo/normal running of either script..

5noop commented 5 years ago

Theres no way to avoid either setting global params or link params from script to script

True but I want to avoid them as much as possible :) and I like noah's idea because we don't need parameters then, gonna submit a pr soon

DarkHorseDre commented 5 years ago

xD

..but but but thats what I already suggested

if so, can a check on journal config and me.area be used to tell the duri script to not do town chores but instead continue to duri?

👼

5noop commented 5 years ago

Maybe I misunderstood you then (: Anyway you can check what I did here https://github.com/kolton/d2bot-with-kolbot/pull/1419/commits/ebbde6abd28556d4279e8c67fbbc316bc5dd4fb9

firekil commented 5 years ago

Hey guys thanks for helping with this.

@5noop nevermind your code works fine, I had copied it wrong before.

I tried a bunch of different things like moving him to the wp before starting the Duriel script and copying the Duriel script into Summoner.js but nothing seems to work.

5noop commented 5 years ago

This has been added to master, you can update.

firekil commented 5 years ago

Sweet awesome, I'll try it out when I get home. Thank you for taking the time to do this.

firekil commented 5 years ago

This works beautifully. If both the Summoner and Duriel scripts are set to true, the bot will now automatically takes the red portal to Canyon of Magi and start Duriel right away. Thanks guys.