kolton / d2bot-with-kolbot

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

Initial BO or recasting BO Command #1050

Open Spink2019 opened 5 years ago

Spink2019 commented 5 years ago

My characters are sometimes not casting BO or recasting BO command according to console. Most of the time my characters chicken out of game the console is reporting their life and its without BO. This has also caused several deaths...annoying.

Here is an example. With CTA BO my Pally normally has 3.2K Life.

18:09:05 (PallyMF) Life Chicken (0/1938) to Unholy Corpse in Worldstone Keep Level 1. Ping: 93 18:25:37 (PallyMF) You died in last game 18:25:37 (PallyMF) Experience decreased by 24474455

Help?

DarkHorseDre commented 5 years ago

Have you modified Any files?

Please post a link to your config via pastebin

I was told off for having low chicken in hc yesterday and contested it, but you dying with 2k base life without bo suggests your chicken % is too low..

assuming your config and precast scripts are unmodified and fine, try and observe the bot and see what happens before a bot. looks like if you set it to only run ball you'll quickly see a failure.

look to see if it actually tries to precast, switches weapons, casts, then recasts before death etc. i imagine it shouldnt need to recast for baal. that said, why was it in WSK 1?

Spink2019 commented 5 years ago

I have made no major modifications. In the Baal and Diablo file I removed some of the chars talking.

30-35% Chicken depending on my char. Base life for Sorc is little over 1K and Pally is around 1.6K(I think). Their in a 5 player game so monsters hit harder.

I have not been able to watch it run without BO.

WSK 1 - one of my follower Pally's runs WSK 1 & 3 clear all.

JohnGoblikon commented 5 years ago

Happened to my lvl 97 pally the other day as well. ~17mil xp loss. Sometimes they don't switch wep after bo and they are running around with cta as main and don't bo again. I run with a Druid so normally Pally is ~7k hp. Was a bit surprised to see a death at ~2.3k hp. Druid started muling mid run even though it's set to mule at the end of a run. Perfect storm....

DarkHorseDre commented 5 years ago

you didnt post config.

did you modify precast.js?

so the follower pally who died is the one in question?

you need to observe to see whats actually happening. it only takes a few minutes to watch and confirm. many things can occur during a run - extra trips to town, diverts for shrines, mana burns, desyncs, lag spilkes.. right now all we have is that your toons die when not bo'd in wsk1 - cant tell you much based on that brah

Spink2019 commented 5 years ago

No precast.js edits

My chars only do this occasionally so I cant view and "catch it". 3000+ runs

It may just happen...

DarkHorseDre commented 5 years ago

Observation is the only way.. I have a separate issue on here which shows my HC toons dying without BO. the BO barb I have died too. he should precast at the start of a run and recast before BO expires so there seems to be an issue somewhere..

DarkHorseDre commented 5 years ago

Just looking at precast.js, I see two references to BO duration: `this.precastCTA(!me.getState(32) || force || (getTickCount() - this.BOTick >= this.BODuration - 15000));

`this.BODuration = (20 + me.getSkill(149, 1) 10 + (me.getSkill(138, 0) + me.getSkill(155, 0)) 5) * 1000;

The second line looks as if the BO duration is calculated as all skill points (hard and soft) of BO + 20 + hard points in BC and shout 5 1000 (1 second).

I need someone (@5noop ? :) ) to confirm if this looks correct for:# CTA chars and barbs with CTA and barbs with CTA and other skillers (war cry items, war cry charms, amus etc) barbs with no CTA but other skillers

if the precast duration are correct, then something else is up..

Spink2019 commented 5 years ago

Once is must have been the initial BO because he died in WSK 1 which is his first starting location. Other times its been later in the run...Runs last 15-18 mins.

I haven't chickened with BO life in the last 3 days...

DarkHorseDre commented 5 years ago

ok, when i get a chance this week I think I'll get precast.js to logtoconsole every-time it BO's, the state and life before casting and after so I can check that the BO's are happening and that the state is being detected and the bo is actually occurring. it will flood the screen so will limit it in some way.

Hopefully I will be able to get a reading in sequence like

18:09:05 (PallyMF) - state: 0, life 1000 18:09:05 (PallyMF) - BO'ing 18:09:05 (PallyMF) - BO code executed fully [placed at end of Barb BO cast & CTA cast] 18:09:05 (PallyMF) - state: 26,32,51, life 3000

DarkHorseDre commented 5 years ago

My ban is over - wahoo!

ok so I've placed comments before and after casts to check the bo levels throughout the runs.

example:

D2Bot.printToConsole("**** Casting BC and BO - precastcta ***", 9); D2Bot.printToConsole("**** State before, BO: " + me.getState(32) + ", BC: " + me.getState(51) + ",Shout: " + me.getState(26) + ", MaxLife: " + me.getStat(7) + "***", 9); Skill.cast(155, 0); // Battle Command Skill.cast(149, 0); // Battle Orders D2Bot.printToConsole("**** BO executed ***", 9); D2Bot.printToConsole("**** State after, BO: " + me.getState(32) + ", BC: " + me.getState(51) + ", ``Shout: " + me.getState(26) + ", MaxLife: " + me.getStat(7) + "***", 9);

For classic hc only barb bo's so I have wrapped the console prints around a class check to ensure the console is only updated when barb bo's (otherwise you get hela spam from other toons precasts): if (me.classid === 4) { D2Bot.printToConsole("* BO executed ", 9); }

Now to wait and see if anything weird shows up..

DarkHorseDre commented 5 years ago

I think I've found at least one of the occurences:

Barb executes precast code but precast fails.

Check: image

I am not sure why it failed, but looking at the timestamps, it executed as fast as usual, within 1 second. Hard to see if a lag spike caused it, but could be.. I can add that check too, but with 1 second, its unlikely.

An obvious way around would be to assertion check the state and if it is not as expected, recast. That assumes the fail to precast would always succeed on the 2nd attempt (else you would fail and move on, or infinite loop - better to solve the problem at source IMHO).

I am concerned as this could lead to unnecessary deaths..

@noah- what do you think? Bug?

image

DarkHorseDre commented 5 years ago

.. after an immediate retry, no joy (until he tries again, different area/script I assume):

image

will try delay and also print area id

DarkHorseDre commented 5 years ago

ok so i added a 4 second delay before retry casting and added areaid and ping - all normal, still failures. Also, sometimes none of the warcries are cast, but usually BO is not cast on first and second try. Shout and bc also fail to cast but at lower rates.

No idea as to why this is happening yet..

Examples of successful retries, and variations (failed BO and successful BC and shout are most common): image

ryancrunchi commented 5 years ago

I remember of having problems with boing, even when playing manually, casting warcries sometimes do not apply it, even if the visual animation did actually play. That’s why when I bo manually I cast it 2 or 3 times. This may be fixed by precasting in a loop like 5 times if the getState return false.

DarkHorseDre commented 5 years ago

yeah i wrote the same somewhere here - i have it in a while loop, interestingly if recasted like 50 times (4 seconds apart) as its checking all 3 states (BC failed repeatedly).. but I don't think the client side did it more than once. will have to observe it..

ryancrunchi commented 5 years ago

I have also noticed, with hammer, he sometimes bo with CTA+spirit, and keep CTA+spirit to cast holy shield, which is lower lvl than with hoto+zaka. I found that Precast.getBetterSlot calculates 0 for sumCurr variable, and 3 for sumSwap, then stores the result in this.bestSlot and keep it all game long... The + skills calculation is made only once for all the game, but it is sometimes wrong. My thought is that the memory is not refreshed when swaping weapons and me.getItem does not return the newly swaped weapons. 1 - swap to CTA 2 - bo 3 - swap to hoto 4 - calculate + skills fail, me.getItem did not have time to refresh new swap 5 - reswap to CTA 6 - cast holy shield 7 - swap to hoto

Potential fix would be to add ping delay between step 3 and 4.

DarkHorseDre commented 5 years ago

Yeah theres another recent post about this on here (by you?) - keep this on topic. You're right tho, defo an issue switching although I'm not sure its down to ping/speed of switching.. I'd give it a test and post results to a new post, linking to the old one. (Would be good to have the bot print to console the slot and items in slot before and after/during each cast to see what it cast with and what it left itself with, but your observation is prolly correct).

post 1064 is one such example, although I wouldn't bother linking as the dude posted the whole gdam script in the thread 👎

ryancrunchi commented 5 years ago

Alright, did not see others topics. Too much opened issues for just saying "it does not work, please help" :D. Real issues are lost or sometimes duplicated.

DarkHorseDre commented 5 years ago

hahaha yes thats why I thought I would actually do some testing to help those wit da skillz to fix it!

You can search by open topics by keyword - Linking the other topics with useful info to the one you are building helps the admins close them all down once the issue is tagged/fixed. (I would just bump an existing thread but this damned thing doesnt move bumped topics to the top :( )

DarkHorseDre commented 5 years ago

Evidence of Bot not detecting state properly and not recasting:

image

as: while (!me.getState(51) || !me.getState(32) || !me.getState(26)) { delay(4000); Skill.cast(155, 0); // Battle Command Skill.cast(149, 0); // Battle Orders Skill.cast(138, 0); // Shout D2Bot.printToConsole("**** DHD - state after RETRY, BO: " + me.getState(32) + ", BC: " + me.getState(51) + ", Shout: " + me.getState(26) + ", MaxLife: " + me.getStat(7) + ", Areaid: " + me.area + " ping:" + me.ping + " ***", 9); } assuming my code is correct ^^

first cast goes from bc, no bo, shout to bc, bo, shout

2nd goes from bc, no bo, shout: to: bc, no bo, shout then retry no change to: bc, no bo, shout

DarkHorseDre commented 5 years ago

.. i also have evidence of 6 minutes of re-casting where bc, bo and shout fail each time, every 4 seconds with ping < 70..

recasting on a loop is not a solution (could end in death or infinite casting)

DarkHorseDre commented 5 years ago

ok ignore errors in area 103 :)

ryancrunchi commented 5 years ago

really weird... maybe a bug in the dll

DarkHorseDre commented 5 years ago

So I manually updated to the latest trunk 2 nights ago and yesterday I noticed far fewer failures.. the retries still occurred (meaning the initial cast failed) but far fewer occurrences.. I've removed the while loop and a single retry is usually (not always) enough.

DarkHorseDre commented 5 years ago

last update:

failed BO's are quite infrequent now, and checking states then recasting usually works.

I also have leader pause for a few seconds after opening tp and issuing command, and follower now force precast before every fight, so whole party usually gets BO at the start next to the tp.

This has vastly reduced the number of life chickens/deaths, and allowed me to set chicken to a sensible level.

ryancrunchi commented 5 years ago

Can you try in your test code to make delays between commands like :

while (!me.getState(51) || !me.getState(32) || !me.getState(26)) {
    Skill.cast(155, 0); // Battle Command
    delay(me.ping);
    Skill.cast(149, 0); // Battle Orders
    delay(me.ping);
    Skill.cast(138, 0); // Shout
    delay(me.ping);
    D2Bot.printToConsole("**** DHD - state after RETRY, BO: " + me.getState(32) + ", BC: " + me.getState(51) + ", Shout: " + me.getState(26) + ", MaxLife: " + me.getStat(7) + ", Areaid: " + me.area + " ping:" + me.ping + " ***", 9);
    delay(me.ping);
} 

This may give time to d2bs to refresh states with packets, maybe

DarkHorseDre commented 5 years ago

Bro, take a look at the testing I did - ping is not an issue. Ping is nearly always below 70, always below 100. Don't forget that I tested 1) immediate recast, 2) while loop recast, 3) single recast - all have same rate of success.

Here's a recent log (same as the others) demonstrating the point: 04:11:08 () **** DHD - state before, BO: **false**, BC: false, Shout: false, MaxLife: 1390, Areaid: 108 ping:62 *** 04:11:10 () **** DHD - state after, BO: **false**, BC: true, Shout: true, MaxLife: 1390, Areaid: 108 ping:31 *** 04:11:16 () **** DHD - state after RETRY, BO: true, BC: true, Shout: true, MaxLife: 2793, Areaid: 108 ping:47 ***

Interestingly, I'm noticing this anomaly for the first time since forcing BO (had bc/bo/shout, re-cast and somehow reports getstate as false for bc - that's not possible! Like I said - many issues leading to deaths that we haven't seen answers for: 13:51:28 () **** DHD - state before, BO: _true_, BC: _true_, Shout: _true_, MaxLife: 2838, Areaid: 108 ping:62 *** 13:51:30 () **** DHD - state after, BO: true, BC: **false**, Shout: true, MaxLife: 2838, Areaid: 108 ping:47 *** 13:51:36 () **** DHD - state after RETRY, BO: true, BC: _true_, Shout: true, MaxLife: 2838, Areaid: 108 ping:78 ***

crackedsash commented 5 years ago

probably will not work but might be worth a shot.. include a bit of walkDistance in the precast? so if first bo fails it will walk a bit and then rebo?

DarkHorseDre commented 5 years ago

from what I've seen positioning is not an issue could be tho..