What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Community Experimentations to Form Work-Around Temporary Solutions

Benevolene

Member
Joined
May 11, 2013
Messages
282
Reaction score
5
So in order to get a fraction of our moneys' worth out of the bot, I figured I'd set up a thread to compile some known, tested and proven work-arounds to make the bot run smoother/better.

My own contribution is to set TPS to 1. That has slightly improved my bots' functionality. It has now done more than 1 rift without crashing.
 
I wrote about this in a previous version but i think still applies to the latest one, I am using DB 1.1.551.0, stock trinity. Noticed D3 crashes when trying to move somewhere when kiting, not sure why it can't get out of it but added some code to one of the routines to not let it go into an endless loop that crashes the game. The change I made was in the

Code:
\Demonbuddy\Plugins\Trinity\Components\Coroutines\MoveTo.cs

I added a counter to exit the while loop if it doesn't meet any of the three conditions, changed the code to this:

Code:
            var count = 0;
            while (ZetaDia.IsInGame && location.Distance2D(ZetaDia.Me.Position) >= range && !ZetaDia.Me.IsDead)
            {
                if (count >= 5) {
                    return false;
                }
                count = count + 1;

I am still not sure what, but its definitely gotta be related to the distance2d method. Guessing it gets stuck trying to kite in the same direction and the distance never reaches the threshold, while loop can't exit, coroutine never ends, game crashes. But again this is just speculation without access to proper debugging, which I don't want to get into.

In any case, I can play DB for hours. It still crashes sometimes when I change some Trinity config while running a GR, but that is probably related to something else.

More info, I am playing DB 1.1.551.0 stock trinity with my Wizard Tal Rashas Meteor (v1.34 Chinese, check the routines forum), running GR lvl 95 with 0 avg deaths. Trying to get better gear to push 100.
 
Yop, i don't see the post for the routines where it is ?
And where do you paste this code in the MoveTo.cs ?
Thanks
 
Last edited:
is it really that difficult to find out? there is only one line of code that snippet can go into, and the wizard routine is in the first page of the combat routines forum. maybe you shouldn't try, you probably will come back here to blame me for all that is wrong with the bot
 
Txony are you not suffering from the <1 FPS issues that plague most of us? In my experience the bot does not specifically crash when trying to avoid. It just crashes when doing anything at all. It's hard to tell though, considering that the game is running as a really really slow slideshow.
 
No issues for me, I let DB update on launch yesterday and copied the two files from the wizard routine to the trinity folder. Also I've disabled the log output, set the level to 'Off'. The bot runs at between 20 and 45ticks/s depending on how crowded the rift gets and D3 doesn't crash anymore after I made that change to the MoveTo.cs file while loop.
it however slows down over time so I end up restarting the bot here and there every few hours.
 
@Benevolene hey dude here's the code just replace the whole moveto.cs with this, also join discord if you haven't, some solutions have been shared to eliminate the fps issues. If you don't want to join discord then;
1st delete the contents of your settings folder. Start DB, configure trinity by setting Routine to Forced, TPS to default, no log filing, and in Diablo make your game settings to Window and shrink it to the smallest size possible. AND change your max Foreground FPS to around 40 apparently ticks per seconds count is determined by the maximum Frames in your game.

Code:
using System;
using Trinity.Framework;
using System.Threading.Tasks;
using Buddy.Coroutines;
using Trinity.DbProvider;
using Trinity.Framework.Reference;
using Zeta.Bot.Navigation;
using Zeta.Common;
using Zeta.Game;


namespace Trinity.Components.Coroutines
{
    public class MoveTo
    {
        private static int _startingWorldId;

        /// <summary>
        /// Moves to somewhere.
        /// </summary>
        /// <param name="location">where to move to</param>
        /// <param name="destinationName">name of location for debugging purposes</param>
        /// <param name="range">how close it should get</param>
        /// <param name="stopCondition"></param>
        public static async Task<bool> Execute(Vector3 location, string destinationName = "", float range = 10f, Func<bool> stopCondition = null)
        {
            if (string.IsNullOrEmpty(destinationName))
                destinationName = location.ToString();

            _startingWorldId = ZetaDia.Globals.WorldSnoId;

            if (Core.Player.IsInTown)
            {
                GameUI.CloseVendorWindow();
            }

            await Coroutine.Wait(TimeSpan.MaxValue, () => !(ZetaDia.Me.LoopingAnimationEndTime > 0));
           
            Navigator.PlayerMover.MoveTowards(location);
         var count = 0;
            while (ZetaDia.IsInGame && location.Distance2D(ZetaDia.Me.Position) >= range && !ZetaDia.Me.IsDead)
            {
        if (Navigator.StuckHandler.IsStuck)
                {
                    await Navigator.StuckHandler.DoUnstick();
                    Core.Logger.Verbose("MoveTo Finished. (Stuck)", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    break;
                }

                if (stopCondition != null && stopCondition())
                {
                    Core.Logger.Verbose("MoveTo Finished. (Stop Condition)", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    return false;
                }

                if (_startingWorldId != ZetaDia.Globals.WorldSnoId)
                {
                    Core.Logger.Verbose("MoveTo Finished. World Changed from {0} to {1}", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    return false;
                }

        if (count >= 5) {
                    return false;
                }
                 count = count + 1;

        Core.Logger.Verbose("Moving to " + destinationName);
                await Coroutine.Wait(1000, () => PlayerMover.MoveTo(location) == MoveResult.ReachedDestination);
            }

            var distance = location.Distance(ZetaDia.Me.Position);
            if (distance <= range)
                Navigator.PlayerMover.MoveStop();

            Core.Logger.Verbose("MoveTo Finished. Distance={0}", distance);
            return true;
        }
    }
}
 
@Benevolene hey dude here's the code just replace the whole moveto.cs with this, also join discord if you haven't, some solutions have been shared to eliminate the fps issues. If you don't want to join discord then;
1st delete the contents of your settings folder. Start DB, configure trinity by setting Routine to Forced, TPS to default, no log filing, and in Diablo make your game settings to Window and shrink it to the smallest size possible. AND change your max Foreground FPS to around 40 apparently ticks per seconds count is determined by the maximum Frames in your game.

Code:
using System;
using Trinity.Framework;
using System.Threading.Tasks;
using Buddy.Coroutines;
using Trinity.DbProvider;
using Trinity.Framework.Reference;
using Zeta.Bot.Navigation;
using Zeta.Common;
using Zeta.Game;


namespace Trinity.Components.Coroutines
{
    public class MoveTo
    {
        private static int _startingWorldId;

        /// <summary>
        /// Moves to somewhere.
        /// </summary>
        /// <param name="location">where to move to</param>
        /// <param name="destinationName">name of location for debugging purposes</param>
        /// <param name="range">how close it should get</param>
        /// <param name="stopCondition"></param>
        public static async Task<bool> Execute(Vector3 location, string destinationName = "", float range = 10f, Func<bool> stopCondition = null)
        {
            if (string.IsNullOrEmpty(destinationName))
                destinationName = location.ToString();

            _startingWorldId = ZetaDia.Globals.WorldSnoId;

            if (Core.Player.IsInTown)
            {
                GameUI.CloseVendorWindow();
            }

            await Coroutine.Wait(TimeSpan.MaxValue, () => !(ZetaDia.Me.LoopingAnimationEndTime > 0));
          
            Navigator.PlayerMover.MoveTowards(location);
         var count = 0;
            while (ZetaDia.IsInGame && location.Distance2D(ZetaDia.Me.Position) >= range && !ZetaDia.Me.IsDead)
            {
        if (Navigator.StuckHandler.IsStuck)
                {
                    await Navigator.StuckHandler.DoUnstick();
                    Core.Logger.Verbose("MoveTo Finished. (Stuck)", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    break;
                }

                if (stopCondition != null && stopCondition())
                {
                    Core.Logger.Verbose("MoveTo Finished. (Stop Condition)", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    return false;
                }

                if (_startingWorldId != ZetaDia.Globals.WorldSnoId)
                {
                    Core.Logger.Verbose("MoveTo Finished. World Changed from {0} to {1}", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    return false;
                }

        if (count >= 5) {
                    return false;
                }
                 count = count + 1;

        Core.Logger.Verbose("Moving to " + destinationName);
                await Coroutine.Wait(1000, () => PlayerMover.MoveTo(location) == MoveResult.ReachedDestination);
            }

            var distance = location.Distance(ZetaDia.Me.Position);
            if (distance <= range)
                Navigator.PlayerMover.MoveStop();

            Core.Logger.Verbose("MoveTo Finished. Distance={0}", distance);
            return true;
        }
    }
}
What's the Discord server? Can you link it?
 
Back
Top