kolton / d2bot-with-kolbot

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

SoulQuit in WorldStone run #1575

Closed ARkaine2 closed 4 years ago

ARkaine2 commented 5 years ago

There's an ability to choose SoulQuit on Baal run (Scripts.Baal). But is it possible to make SoulQuit on WorldStone run (Scripts.Worldstone)? Or (some additional subquestion from me) is there a way to skip/ignore souls (or any kind of monsters) during Worldstone (or any other) run?

DarkHorseDre commented 5 years ago

yeah just search the scripts for the config soulquit to see what they do.

in baal js, theres this if block:

if (Config.Baal.SoulQuit && getUnit(1, 641)) {
        say("Souls found! NG.");
        return true;
    }

So if you want it hard coded you just copy that block, remove the say line if you don't want it, change the unit id if you want, and you're done.

if you don't want it hard coded, you need to add a new config entry (e.g. Wordlstone.SoulQuit) to config.js and enable in your char config.

ARkaine2 commented 5 years ago

Thanks for your answer that clarified almost everything about my question, but I got problem when I copied this part of code into Worldstone.js

I copied:

    if (Config.Baal.SoulQuit && getUnit(1, 641)) {
        return true;
    }

Into the Worldstone.js

It looks like so:

function Worldstone() {
    Town.doChores();
    Pather.useWaypoint(129);
    Precast.doPrecast(true);
    Attack.clearLevel(Config.ClearType);

    if (Config.Baal.SoulQuit && getUnit(1, 641)) {
        return true;
    }

    if (Pather.moveToExit(128, true)) {
        Attack.clearLevel(Config.ClearType);
    }

    if (Pather.moveToExit([129, 130], true)) {
        Attack.clearLevel(Config.ClearType);
    }

    return true;

}

But KolBot's doesn't stop the run in the Worldstone Keep (when character meets souls). If I rename "Config.Baal.SoulQuit" into "Config.Worldstone.SoulQuit" i get error message.

DarkHorseDre commented 5 years ago

Yeah you didn't say what the error is but it will be because you didn't create the entry in config.js like i said.

Config.Baal.SoulQuit = is one config option which exists in config.js and set in character config (look for these and see how its used)

Config.Worldstone.SoulQuit = doesn't exist unless you add it like i said. it will be used in the same way, but independently of baal.soul.quit

You will also need to place a check for souls on each level of worldstone, not just at the start of level 2 as you did.

if youre not sure how to do any of this youre gonna need someone to walk you through it which I cannot as I'm at work and cannot test

ARkaine2 commented 5 years ago

You will also need to place a check for souls on each level of worldstone, not just at the start of level 2 as you did.

Souls are actualy only on level 2 (if talk about Worldstone Keep) and in the Throne (which basicaly has Baal.SoulQuit). So the task is pretty simple, but of course requires some necessary knowledge.

if youre not sure how to do any of this youre gonna need someone to walk you through it which I cannot as I'm at work and cannot test.

Thanks for you helping.

Still doesn't work. When character meets souls on WSK L2 he acts like nothing happened.

Worldstone.js contains:

function Worldstone() {
    Town.doChores();
    Pather.useWaypoint(129);
    Precast.doPrecast(true);
    Attack.clearLevel(Config.ClearType);

    if (Config.Worldstone.SoulQuit && getUnit(1, 641)) {
        return true;
    }

    if (Pather.moveToExit(128, true)) {
        Attack.clearLevel(Config.ClearType);
    }

    if (Pather.moveToExit([129, 130], true)) {
        Attack.clearLevel(Config.ClearType);
    }

    return true;

}

Config.js contains:

    Worldstone: {
        SoulQuit: true,
    },

Sorceress.Name.js contains:

Scripts.Worldstone = true;
        Config.Worldstone.SoulQuit = true; // End script if Souls (Burning Souls) are found.
ARkaine2 commented 5 years ago

Wait, wait, wait. There are two different types of souls (their IDs are: 640 and 641) on L2 and in the throne. I'll describe results.

ARkaine2 commented 5 years ago

Seems that i miss something, but i can't find what excactly.

I found in Ball.js

    this.announce = function () {
        var count, string, souls, dolls,
            monster = getUnit(1);

        if (monster) {
            count = 0;

            do {
                if (Attack.checkMonster(monster) && monster.y < 5094) {
                    if (getDistance(me, monster) <= 40) {
                        count += 1;
                    }

                    if (!souls && monster.classid === 641) {
                        souls = true;
                    }

                    if (!souls && monster.classid === 640) {
                        souls = true;
                    }

                    if (!dolls && monster.classid === 691) {
                        dolls = true;
                    }
                }
            } while (monster.getNext());
        }
    }

So i placed this part of code into Worldstone JS and now it is:

function Worldstone() {
    Town.doChores();
    Pather.useWaypoint(129);
    Precast.doPrecast(true);
    Attack.clearLevel(Config.ClearType);

        this.announce = function () {
        var count, string, souls,
            monster = getUnit(1);

        if (monster) {
            count = 0;

            do {
                if (Attack.checkMonster(monster) && monster.y < 5094) {
                    if (getDistance(me, monster) <= 40) {
                        count += 1;
                    }

                    if (!souls && monster.classid === 641) {
                        souls = true;
                    }

                    if (!souls && monster.classid === 640) {
                        souls = true;
                    }
                }
            } while (monster.getNext());
        }
    }

    if (Config.Baal.SoulQuit && getUnit(1, 640)) {
        return true;
    }

    if (Config.Baal.SoulQuit && getUnit(1, 641)) {
        return true;
    }

    if (Pather.moveToExit(128, true)) {
        Attack.clearLevel(Config.ClearType);
    }

    if (Pather.moveToExit([129, 130], true)) {
        Attack.clearLevel(Config.ClearType);
    }

    return true;

}

But still no reaction on souls.

DarkHorseDre commented 5 years ago

mate don't paste full code here, just pastebin and link - you also don't need to link to default code, its already on github - see the tab at top of this page: https://github.com/kolton/d2bot-with-kolbot

as for why its not working - you created Config.Worldstone.SoulQuit in char config and config js

your code is testing for Config.Baal.SoulQuit

in addition to this, the code you have copied in from baal.js doesn't do much except identify souls and set a variable - you don't actually use it - you duplicate the identification and return true for the routine (which is where I expect the ultimate issue is but cannot confirm now).

work through it methodically

ARkaine2 commented 5 years ago

as for why its not working - you created Config.Worldstone.SoulQuit in char config and config js your code is testing for Config.Baal.SoulQuit

But why? Where should i create Config.Worldstone.SoulQuit and specify it to work? I created Config.Worldstone.SoulQuit everywhere where i saw it and then specified it in char config.

Anyway i tried to edit Ball.js (and added both IDs of souls to it) and then tried to specify Config.Baal.SoulQuit in char config

    Scripts.Worldstone = true;
        Config.Baal.SoulQuit = true; // End script if Souls (Burning Souls) are found
    Scripts.Baal = true;

but still no result.

DarkHorseDre commented 5 years ago

what do you mean why? worldstone.soulquit is not the same as baal.soulquit.

ARkaine2 commented 5 years ago

in addition to this, the code you have copied in from baal.js doesn't do much except identify souls and set a variable - you don't actually use it - you duplicate the identification and return true for the routine (which is where I expect the ultimate issue is but cannot confirm now).

I see that too, but I don't know how to make bot stop the run with that condition. ¯\ (ツ)

what do you mean why? worldstone.soulquit is not the same as baal.soulquit.

I specified in Char config to use worldstone.soulquit, not baal.soulquit. Seems that something is missing.

Thank you for your trying to help.