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

[Plugin] Unstucker - restarts if your character gets stuck

Does not properly restart client.

I've had the bot idle for hours, not moving, and Unstucker still would not attempt to restart the game.
 
Ye, still having some issues while running with the plugin..

Get's stuck a lot while i run with plugin active, just standing around in the middle of the map, also after restarting to a new game, it just stands at the entrance doing nothing.
 
Ye, still having some issues while running with the plugin..

Get's stuck a lot while i run with plugin active, just standing around in the middle of the map, also after restarting to a new game, it just stands at the entrance doing nothing.

Same issue here, i think i found what might be the problem, when the plugin restarts the run, it looks like it's not starting reading the checkpoints from the beginning but instead it reads them from where he stopped before.

Ex.:
Bot gets stuck @checkpoint 4, the plugin kicks in, leaves the game and create a new one, when you'r in the new game instead of reading the checkpoints from checkpoint 1, he "resumes" the reading from where he was before (checkpoint 4) which is far from the start and gives that annoying pathing generation error.


Restarting the bot (stop/start) manually fixes the pathing issue.
 
Last edited:
Same issue here, i think i found what might be the problem, when the plugin restarts the run, it looks like it's not starting reading the checkpoints from the beginning but instead it reads them from where he stopped before.

Ex.:
Bot gets stuck @checkpoint 4, the plugin kicks in, leaves the game and create a new one, when you'r in the new game instead of reading the checkpoints from checkpoint 1, he "resumes" the reading from where he was before (checkpoint 4) which is far from the start and gives that annoying pathing generation error.


Restarting the bot (stop/start) manually fixes the pathing issue.

Ye, but restarting the bot manually kinda kills the idea of unstucker :P

But it's cool if you found the problem, then maybe Eax or someone else can take a look at it and see if there's anything they can do about it, or if it's something that has to be fixed elsewhere.
 
Yep same problem here, when u stop the bot it says: QuestOrderManager.OnBotStop(). Resetting caches.
And before generating a path: Replaced hook [ProfileOrderBehavior_Hook] 345f333a-ae53-463a-a5a0-73f27b051587

So... This plugin needs to reset that or it gets navs issues, how? dont know xD
 
Last edited:
unstucker not work fine. my bot stand 2h on one point and do not reset the bot or something :(

p.s. i have it activate but nothing do
 
Uh yeah I have no idea what's going on. If your character is standing still, Unstucker should do _something_. Was there any log messages generated by Unstucker?

I'd have to guess that the DB devs changed things up, causing Unstucker to completely break.
 
unstucker himself is working. it unstucks. but the bot then is turned to pause, so he does nothing. and unstucker unstucks again, and again, again and so on ;) so u have to stop and start again the bot. can u change that unstucker dont turn the bot to pause?
 
Yea sadly as it stands now unstucker is not working properly. It will unstuck you if you get stuck, but once it starts new game the profile your on will not continue to run. Atleast this applies to unstucker with the core profile I am running by farix.
 
Quickfix until eax finds a solution - instead of warping back to town / leaving the game, it'll walk randomly when stuck - that causes the pathfinding algorithm to recalculate so the char can continue.

Code:
using System;
using System.Collections.Generic;
using System.Threading;
using System.Windows;
using Zeta;
using Zeta.Common;
using Zeta.CommonBot;
using Zeta.Common.Plugins;
using Zeta.Internals;
using Zeta.Internals.Actors;
using Zeta.Internals.Service;

namespace Eax.Plugins
{
    public class Unstucker : IPlugin
    {
        private bool IsRestarting
        {
            get;
            set;
        }
        private bool IsChecking
        {
            get;
            set;
        }
        private DateTime LastCheckTime
        {
            get;
            set;
        }
        private DateTime LastLogTime
        {
            get;
            set;
        }
        private List<Vector3> LoggedPositions
        {
            get;
            set;
        }

        public string Author
        {
            get
            {
                return "eax";
            }
        }
        public string Description
        {
            get
            {
                return "It's a me! Walkario!";
            }
        }
        public string Name
        {
            get
            {
                return "Unstucker v" + Version.ToString();
            }
        }
        public Version Version
        {
            get
            {
                return new Version(1, 8);
            }
        }
        public Window DisplayWindow
        {
            get
            {
                return null;
            }
        }

        private void Log(string message)
        {
            Logging.Write(string.Format("[{0}] {1}", Name, message));
        }

        private static float GetMaxDistanceTraveled(List<Vector3> positions)
        {
            float max = 0F;
            for (int i = 0; i < positions.Count - 1; ++i)
                for (int j = 1; j < positions.Count; ++j)
                    max = Math.Max(max, Math.Abs(positions[i].Distance(positions[j])));
            return max;
        }

        public void OnInitialize()
        {
            IsRestarting = false;
            IsChecking = false;
            LastCheckTime = DateTime.Now;
            LastLogTime = DateTime.Now;
            LoggedPositions = new List<Vector3>();
        }

        public void OnPulse()
        {
            // if we're not in game and not in the process of restarting, do nothing
            if (!ZetaDia.IsInGame || !ZetaDia.Me.IsValid || IsRestarting) {
                LastCheckTime = DateTime.Now;
                LastLogTime = DateTime.Now;
                LoggedPositions.Clear();
                return;
            }

            // if it's been 3 seconds since we've logged a position, then we log a new position
            if (DateTime.Now.Subtract(LastLogTime).TotalSeconds > 3) {
                LastLogTime = DateTime.Now;
                LoggedPositions.Add(ZetaDia.Actors.Me.Position);
            }

            // if it's been 40 seconds since we've last evaluated the logged positions, evaluate the logged positions
            if (!IsChecking && (LoggedPositions.Count > 5) && (DateTime.Now.Subtract(LastCheckTime).TotalSeconds > 5)) {
                // we want to prevent this section from being executed twice
                IsChecking = true;

                var rnd = new Random();
                var algorithm = rnd.Next(0, 10);
                // if our person has not traveled 10 yards or whatever in the last 40 seconds, we're stuck
                if (GetMaxDistanceTraveled(LoggedPositions) < 10f) {
                    var v = ZetaDia.Me.Position;
                    var oldPosition = v;
                    do {
                        v.X = (DateTime.Now.Millisecond % 2 == 0) ? v.X + rnd.Next(500, 6500) : v.X - rnd.Next(500, 6500);
                        v.Y = (DateTime.Now.Millisecond % 2 == 0) ? v.Y + rnd.Next(500, 6500) : v.Y - rnd.Next(500, 6500);
                        v.Z = (DateTime.Now.Millisecond % 2 == 0) ? v.Z + rnd.Next(500, 6500) : v.Z - rnd.Next(500, 6500);

                        Log("Moving Char randomly to: " + v.ToString());
                        ZetaDia.Me.UsePower(SNOPower.Walk, v, ZetaDia.Me.WorldDynamicId, 2, -1);
                        Thread.Sleep(rnd.Next(2000, 3000)); // HI DB Devs!
                    } while (ZetaDia.Me.Position == oldPosition);
                    IsRestarting = false;
                }

                IsChecking = false;
                LastCheckTime = DateTime.Now;
                LastLogTime = DateTime.Now;
                LoggedPositions.Clear();
            }
        }

        public void OnShutdown()
        {
        }

        public void OnEnabled()
        {
            Log("Enabled.");
        }

        public void OnDisabled()
        {
            Log("Disabled.");
        }

        public bool Equals(IPlugin other)
        {
            return (other.Name == Name) && (other.Version == Version);
        }
    }
}
 
Updated to v1.8. Instead of trying to leave the game and resume it, Unstucker will try to move your character which should unstuck it. Thanks to Nuls for this change.
 
new version doesnt free my character at all after restarting and watching for several attempts.
 
new version doesnt free my character at all after restarting and watching for several attempts.

Did the old versions work? Seems like with every change works great with some people but completely fails with other people....
Might as well wait for DB to fix the getting stuck issue.
 
working great for me , just got unstuck from a chest :) THANKS!!! will give some news if i get problems :)
 
Try setting your kill radius to 65, your loot radius to 60 if it doesn't work.
 
i like leave game better ... 1.8 doesnt really help o.O

mind if u post previous (1.7) again?
 
Last edited:
i like leave game better ... 1.8 doesnt really help o.O

mind if u post previous (1.7) again?


Ditto! My character's stuck in town doing...nothing!

1.7 again please!!!!


If it's a choice between randomly moving around or restarting, it looks like restarting's preferable.


EDIT: I think it'd be best to incorporate both approaches. Try unstucking about 3-4 times and put a trigger in place so that if the run's already done or the 3-4 times doesn't do anything, the bot leaves the game and restarts.
 
Last edited:
can't wait to try this... pretty sure my bot is stuck right now while i'm at school lol
 
Back
Top