kolton / d2bot-with-kolbot

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

Chicken at bo, take2 #2764

Open Sirk74 opened 4 years ago

Sirk74 commented 4 years ago

Hi, my very first post and very new to everything, so hope I'm making this right :)

So, the chicken at bo thing is bugging me recently. For those who haven't experienced it, my chars often chicken just a bit after getting bo, as their life max is increased but their actual life is not yet. I tried to follow the advice here https://github.com/kolton/d2bot-with-kolbot/issues/1809 but with no results :(

Now the noob question: where did I have to add the script Scripts.BattleOrders = { LifeChicken: 20 }; ? I suppose in the character configuration under \libs\config but does it matter where? I tried both after Scripts.BattleOrders = true; and after Config.LifeChicken = 50; but neither worked.

Also, I'm wondering: why this happens to someone and not to someone else? To me it happens when I play on a slower machine so I suppose that matters.

Again, sorry for the maybe obvious question ^^

gtoilet commented 4 years ago

weird never had it happen to me but i have my npc heal to 80 and chore at start of BO.js and i works fine

Sirk74 commented 4 years ago

I am not sure I have understood you comment. The problem is that there is not time for anything: the skill bo raises you max life and then instantly heals you up to that life. My char chicken in that millisecond between the two steps.

As far as I got it, the only way to address this is changing the chicken settings only during the bo sequence, as suggested in the linked thread, but I have not been able to do it. :(

DarkHorseDre commented 4 years ago

my chars often chicken just a bit after getting bo, as their life max is increased but their actual life is not yet.

I've never seen this but if it is as you say, then it must be that your toon has less than full life AND they have low max life? (you havent referenced either which makes this hard to understand)

if both are true and the bot is chickening because your life % drops below chicken threshold, just make them heal in town/drink health pot before they go for bo.

Now the noob question: where did I have to add the script Scripts.BattleOrders = { LifeChicken: 20 }; ? I suppose in the character configuration under \libs\config but does it matter where? I tried both after Scripts.BattleOrders = true; and after Config.LifeChicken = 50; but neither worked.

both are supported (I didnt check syntax but I've seen it in the wiki).

are you saying that when you set config.lifechicken = 50; it doesnt update? Ensure youre not setting it more than once or elsewhere

To me it happens when I play on a slower machine so I suppose that matters.

if youre thinking your machine is slow, explain what you mean. it is doubtful your processor is slow as the game is 20 years old. ping is a big factor - but you need to test your ping in game to know - you haven't shared your average and peak pings so impossible to say.. but obviously you want to make your ping be the best it can when gaming so...

Sirk74 commented 4 years ago

So, thanks for the detailed answer.

I try to explain better. Game starts, I have 4 char there: one baba, one pally and two sorcs. They are full life and if they are not the go to healer (as my threshold to town healing is 90). When they are all ready (and at full life), the go to catacomb level 2, barb goes bo... .. and sometimes one of them chickens just in the instant they receive the bo.

Nothing else happens, not even time to cast energy shield for sorc, it's BO -> chicken. So, it must be the bo itself. The post I linked suggested that the sequence of the bo is "set a new max life", "heal to that new max life". In this case this would explain the behavior.

What I tried is to add Scripts.BattleOrders = { LifeChicken: 20 } just after Scripts.BattleOrders = true;, but they chicken anyway, this means (as far as I got it) that the script Config.LifeChicken = 50; that I have further on in the char script does not get changed to 20 during the bo (if it would, they wouldn't chicken as preivous life/bo life is around 40).

About the slower machine, yes I was talking about ping, sry, was not that clear. It's usually around 200-250, with some peaks here and ther over 300. Maybe I should address this instead of the script :P

The more I think about the more I think it's the ping. The communication steps between my computer and battlenet should be these:

1) local -> battlenet: battle order cast 2) battlenet -> local: boost max life 3) battlenet -> local: heal to (new) max life

And script goes chicken between steps 2 and 3.

Also, the fact that sometimes it happens and sometimes not can only be related to ping, as it changes from game to game.

DarkHorseDre commented 4 years ago

Scripts.BattleOrders = { LifeChicken: 20 } - this is a means of starting that one script with that param - I've never tried it but should work. you can check the value by adding a line to, say the mfhelper script/running script print(Config.LifeChicken);

I dont understand the issue as this usually works. lifechicken and maxlife have never failed for me.

I would try to get some proof of what you think is happening:

  1. what is the cause AND reason of the chicken?
  2. what is max life and life before and after BO?
  3. what else is listed on the console before during and after the chicken?

you can print all the values to find this out. you have log files too. \kolbot\d2bs\logs \kolbot\d2bs\kolbot\logs

me.hpmax me.hp

DarkHorseDre commented 4 years ago

ok I read 5noops post :)

its just supplying the script with parameters - do it as he listed it - put it in your char config where the scripts.battleorders is

Sirk74 commented 4 years ago

I put line Scripts.BattleOrders = { LifeChicken: 20 } inside script.battleorders, like this:

Scripts.BattleOrders = true;
Scripts.BattleOrders = { LifeChicken: 20 }
Config.BattleOrders.Mode = 0; // 0 = give BO, 1 = get BO
Config.BattleOrders.Wait = true; // Idle until the player that received BO leaves.
Config.BattleOrders.Getters = ["Blitzy", "DaBo"];

but is still chickens.

I also looked for logs as you said. In folder \kolbot\d2bs\logs I looked into the script of the profile that chickened.

At 17:01, the time of chicken, the only log was this one:

[09/13/20 17:00:28] D2BS 9632: ÿc2Party thread loaded. Mode: Accept
[09/13/20 17:00:28] D2BS 9632: ÿc3Start ToolsThread script
[09/13/20 17:01:14] D2BS 9632: Script default.dbj ended
[09/13/20 17:01:14] D2BS 9632: Script tools\party.js ended
[09/13/20 17:01:15] D2BS 9632: updating runs

In folder \kolbot\d2bs\kolbot\logs I looked inside ScriptErrorLog.txt but there was nothing at the times of chickens.

In that log, however, I noticed seveal other errors "Level not loaded" (but at different time stamps), that I suppose could also be related to ping, as I never had those error previously. As I said, I'm just guessing here, so any better judgement is welcome :D

DarkHorseDre commented 4 years ago

bro, thats nothing like what you read!

your char config is what determines what runs - so the entry Scripts.BattleOrders = true; tells it to run battle orders.

changing the line 5noop instructed replaces true with a chicken parameter Scripts.BattleOrders = { LifeChicken: 20 }; - he provided you the wiki page link to help you understand more. The dude he was helping did exactly what was written and it worked for him.

So you adding two entries in char config is beyond what you've read.

You still haven't mentioned your actual ping value either - when I add this all up you could be chasing shadows. can't help ya mate.

Sirk74 commented 4 years ago

:-| I swear I also read accurately the linked wiki but did not got at all that was to replace instead of add. Now that I went there and read it again I wonder how did I not got that as it is more than clear :-/

(I said I was a noob, but I didn't know how much)

Anyway, I'm going to change that, thanks for the patience man.

About the ping, in the previous post I mentioned it is usually between 200 and 250 with some rare spikes around 350-400, as read throught the /fps command. Is it some other better way to provide the answer? Or to have a better reading than the in-game command? (asking honestly ^^)

Sirk74 commented 4 years ago

Anyway, I implemented the correction, with the chicken parameter instead of true in the Scripts.BattleOrders, but they still chicken. I took a pic of the console, so to give an idea of the frequency and the ping when it happens.

Screenshot 2020-09-14 01 26 40

Oh, one more reason I'm pretty sure it's the bo that cause the chicken it's that the two life values reported on the chicken line for each char are exactly their life without bo and with bo ^^! Also, sometimes, as you can see, they do chicken together.

Anyway, since it's a chicken just at the start of the run, I addressed the issue by setting the MinGameTime in D2BotLead.dbj to 360 and by putting everyone on everyone quitlist. So, at least, I won't get realm downs for that and will just skip some run here and there. It's a patch solution, but, as for now, better than nothing :D

ARkaine2 commented 4 years ago

Sorry for my invasion in this theme, but I have this/similar problem.

I suppose that this is happening after setting "LifeChicken restart profile" (https://github.com/blizzhackers/documentation/blob/master/kolbot/MiscellaneousOptions.md#lifechicken-restart-profile).

And some themes (https://github.com/kolton/d2bot-with-kolbot/issues/2654, https://github.com/kolton/d2bot-with-kolbot/issues/1805) about it.

Btw, I have some additional info: Druid in moment from casting Oak, becaming max life higher and getting full life also chickens and even drink potions (even without "LifeChicken restart profile").

This happens during 2> (second and more) precast.

It's nice that you are trying to find solution of this problem, not to simply fix it.

Bot that doesn't rejoin game after chicken is real problem.

Sirk74 commented 4 years ago

Even with my patchy solution this issue is really bugging me, now happening once every third game or so.

You know, I also thought about making a cta and make two battleorders sequences so that none of them independently doubles the life and triggers lifechicken :D Maybe that could work! ;)

I am looking for alternative solutions because I know nothing about writing scripts so I have no clue about how to solve it at the root. I hoped that Scripts.BattleOrders = { LifeChicken: 20 } would work as for the other guy on the previous thread, but to me it does really nothing.

By the way, I don't think the issue is related to "LifeChicken restart profile, because the profile is not actually restarted with the chicken. It's just a classi save&exit.

Sirk74 commented 4 years ago

So, another update for those who have my same problem of chickening with bo.

I tried to equip one of the characters (not the baba!) with a cta and to set up two different bo scripts where in the first the cta cast bo and in the second the barbarian does. This way it works: none of the two battleorders raise the life enough to trigger my chicken at 50.

The problem now is that the char with the cta goes on casting his low level bo disrupting all the good work done :(

ARkaine2 commented 3 years ago

Recasting lower level BO is less problem -- you can optionaly and at yours own risk remove Precast.doPrecast(true); from different parts of script's code -- so bot will check only BO counter as specified in precast that is used with pather.

I have trouble with chicken on Oak Sage's life boost, that is higher than BO's and seems unfixible.

Sirk74 commented 3 years ago

Thanks. I ended up by addressing the cause and not the symptoms, meaning my connections had issues. Pings spikes, lag, freeze and disconnections were too frequent anyway :) So, new ethernet board: problem solved ^^

About Oak. Is the character under bo as well? Since with the already increased life from bo it shouldn't trigger the chicken threshold. Even with a cta I guess. I think the solution for you is in the maths. Let's see.

Let's use some numbers to make the example, and say you have a level 36 oak, that gives +205% life. If you have a chicken at 50%, you need a level 10 bo from cta (+107% life) not to chicken with oak. And you need to always go cta -> oak

100 + 107 > 205

Or just do the reverse, make the maths of your oak and cta levels, and set lifechicken just above that. Of course this means you also need a bo, or a cta :P

ARkaine2 commented 3 years ago

Gz about board, seems that I have same problem (about lag).

Btw, I think that it can be nice idea to add some delay to chicken.

Just add some condition like 10, 20 ms. But it's exteme.

mastersmoke commented 3 years ago

Hi, my very first post and very new to everything, so hope I'm making this right :)

So, the chicken at bo thing is bugging me recently. For those who haven't experienced it, my chars often chicken just a bit after getting bo, as their life max is increased but their actual life is not yet. I tried to follow the advice here #1809 but with no results :(

Now the noob question: where did I have to add the script Scripts.BattleOrders = { LifeChicken: 20 }; ? I suppose in the character configuration under \libs\config but does it matter where? I tried both after Scripts.BattleOrders = true; and after Config.LifeChicken = 50; but neither worked.

Also, I'm wondering: why this happens to someone and not to someone else? To me it happens when I play on a slower machine so I suppose that matters.

Again, sorry for the maybe obvious question ^^

Hey hey. I have had this problem myself and I am angry because you can probably do the fix the guy initially talked about but I'm too dumb to even understand it.

But I found and believe it has something to do with the fact that you hit the WP at the exact moment BO is sprung.. meaning that your not using the standard BO script.. which is why "others" are like dumbfounded with what your talking about lol. But but.. it's not an exact fix but a band aid but at least it works for me.

The trick is make sure your BO barb gets the the wp last. So I added a delay before he runs the "cats auto bo" and because he makes it there last.. no one is on the wp at that moment and viola! No more life chicken. Yes ping has something to do with it.. but this has happened to me on like 6 different connections.. so my GG internet never fixed this.

I run the "cata bo script" and the normal BO script so the bots will all start at the same time and show up to the same spots at somewhat same time.

Either way.. add delay. Get boer to be last to show up and it'll go away.. adds some time but when you run that many bots some time is good

Sirk74 commented 3 years ago

Wow! Great! Didn't think at all it could be connected to that. Did you just add a "fixed" delay? Because many times that would probably not be enough. Like all times when one of the characterd gets a ftj. Or, in order for it to work those times as well, it would need it to be to big and delay all other games.

Probably the best solution at this point would be have the barb head to wp when the last char enters catacomb level. Or, even better, had a delay between the last character joining catacomb and the start of warcries.

mastersmoke commented 3 years ago

Wow! Great! Didn't think at all it could be connected to that. Did you just add a "fixed" delay? Because many times that would probably not be enough. Like all times when one of the characterd gets a ftj. Or, in order for it to work those times as well, it would need it to be to big and delay all other games.

Probably the best solution at this point would be have the barb head to wp when the last char enters catacomb level. Or, even better, had a delay between the last character joining catacomb and the start of warcries.

I used a pather for the barb to go to river and bo and wait 4000ms before the BO script starts... I personally did it a jenky way because I don't fully duplicate the commands..

So I made a pather go to river and he precasts.. waits and uses BO. By the time he gets to wp and BOs usually everyone is there. I maybe get a miss and the same glitch occur around once every 6 hours now.

But I like your ideas. I just know that the glitch occurs when they to to Wp at BO. Not shout or battle command. So I just worked around it lol.

billski commented 3 years ago

Hey guys, I know this is really old, but I had this same issue, and seems to be fixed by adding a small delay before giving BO around line 65 of BattleOrders.js:

delay(2000); // Wait 2 seconds before start giving BO
if (this.giveBO(Config.BattleOrders.Getters)) {
  break MainLoop;
}

Edit: Another option is to add the delay in the Precast.js around line 209, just before BO is cast:

case 4: // Barbarian - TODO: BO duration
if (!me.getState(32) || !me.getState(51) || !me.getState(26) || force) {
var swap = me.weaponswitch;

Attack.weaponSwitch(this.getBetterSlot(149));
delay(1500); // Add a short delay before start giving BO, hopefully to avoid chicken
if (!me.getState(51) || force) {
    Skill.cast(155, 0); // Battle Command
}

if (!me.getState(32) || force) {
    Skill.cast(149, 0); // Battle Orders
}

if (!me.getState(26) || force) {
    Skill.cast(138, 0); // Shout
}

Attack.weaponSwitch(swap);
}

After playing with it, prefer the second method.

billski commented 3 years ago

Further to this thread, I wanted to try to address the chicken issue when entering a new area with Oak or BO. It appears that the code that checks the current HP/MP vs. the configured chicken HP/MP happens quicker than the game refreshing them upon entering a new area. I was getting this about every 8 runs on random characters when entering Throne room to kill Baal.

If you modify ToolsThread.js around line 570, you can add a 50 ms delay to your HP chicken and Mana Chicken. This gives it enough time to let the proper HP values "catch up". I've been testing this for a while and it seems to work.

delay(50); //Attempt to stop chicken from oak/BO when entering throne room

if (Config.LifeChicken > 0 && me.hp <= Math.floor(me.hpmax * Config.LifeChicken / 100)) {
    D2Bot.printToConsole("Life Chicken (" + me.hp + "/" + me.hpmax + ")" + this.getNearestMonster() + " in " + Pather.getAreaName(me.area) + ". Ping: " + me.ping, 9);
    D2Bot.updateChickens();
    this.exit();

    break;
}

if (Config.UseMP > 0 && me.mp < Math.floor(me.mpmax * Config.UseMP / 100)) {
    this.drinkPotion(1);
}

if (Config.UseRejuvMP > 0 && me.mp < Math.floor(me.mpmax * Config.UseRejuvMP / 100)) {
    this.drinkPotion(2);
}

delay(50); //Attempt to stop chicken from oak/BO when entering throne room

if (Config.ManaChicken > 0 && me.mp <= Math.floor(me.mpmax * Config.ManaChicken / 100)) {
    D2Bot.printToConsole("Mana Chicken: (" + me.mp + "/" + me.mpmax + ") in " + Pather.getAreaName(me.area), 9);
    D2Bot.updateChickens();
    this.exit();

    break;
}

This may also fix the BO at WP chicken issue, but I prefer to leave the delay in Precast.js to give my Druid time to precast Oak/Bear, and they will get BO at the WP as well.

I would only add this delay to chicken if your BO/Oak will cause your HP/MP to increase by a percentage larger than your Chicken value in your config file.

Edit: Can confirm 148 hell baal runs with no deaths or chickens.

Samael36 commented 3 years ago

Hey, thanks for the new solution. I have this issue as well at the River of Flames wp every 50 cbaal runs or so. I never see it happen, but I suspect a druid's oak sage to cause my sorc to chicken before she casts battle orders.

Life Chicken (1640/4656) in River Of Flame. Ping: 328 1640 is her total life without bo and she chickens at 40%, but 1640/4656 equals to ~35% HP.

I have no control over the other players configurations, so I will have to test your second solution (entering the throne) or either lower her chicken to 35%.