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

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Concept Study for a stuck plugin

dark wolf

New Member
Joined
Mar 11, 2015
Messages
95
Since the request was there I did some fast try for a stuck plugin.
But before elaborating this more I would like some comments. Since I am not so sure that the current implemenation doesn't cause any trouble.
View attachment stuck.cs
 
I think you're definitely on to something here. Perhaps what I'd suggest is to make it time based, something like:

EDIT: Errr, that EllapsedMilliseconds check should be < instead of >

7xig8Ke.png
 
Agreed. Although when it comes to StopWatch vs Timer vs DateTime, I usually prefer to set DateTime.UtcNow (UtcNow, not Now) to a variable and then compare DateTime.UtcNow to the variable to see how much time has passed with each check (until you're ready to update the variable to the current time again). If I remember correctly (from the research I did on it before) it's supposedly the faster/more accurate method (faster than TimeOfDay as well). :cool:

Good concept though. I think the RebornCo CR tried "stuck" code as well but I forget how he implemented it.
 
Yeah, out of those the one I least like to use for this kind of small things is the Timer since you have to dispose it, just adds more code.
 
Yeah, out of those the one I least like to use for this kind of small things is the Timer since you have to dispose it, just adds more code.

I am not sure that this way the stuck will not be detected properly. Basically instead of using the average over time you take every X seconds a sample and compare it.
But I will try it out and see if it gets to some false positives or if the rate is fine.
Do you think Teleport is a good solution. I mean its easy to get the closest loaction and teleport. But this could end up in Loop
If you came from this spot and got stuck.
 
You're right, if the bot is moving in a small circle and just so happens to be in the spot it was 10 seconds ago it'll return a false positive. You're aggregation might be better, but I think you don't need to calculate the average, just check if the aggregated value is greater than 0 since in case you're stuck for the last 50 pulses, their aggregation will be 0 or close to it.

I think teleport is the best thing to do to try solve it, but only once. If it happens again then it's the route the problem and perhaps logging out is better. Either way teleporting to the city first might be a good idea.
 
You also might want to consider just sending a "space bar" press to the client to see if jumping would unstuck you. Or just stopping the movement manager and trying to strafe left or right or just walk backwards for X yards. You could even see if there was a way to get the coordinates for where the movement manager was trying to take you. That way you could stop the movement, add code to add a "black spot" to the spot you were just in, do the strafe thing to try and get around that blackspot, and then finally just try to start the movement manager going towards it's original destination. It would be a bit more code....but you could try.
 
So I worked a bit on it. also I would not yet release it. You can use it at your own risk.

View attachment stuck.cs

It currently a 4 Stage aporach. First stage I used the suggested methode from Neverdyne to save resources.
I take this as a first indicator to be stuck.
And switch to second stage where I use the average value calculation. Wiht this I can be sure that stage 0 wasn't a false positive.
If stage 1 also detects I am stuck. I move to stage 2 which does some "evasive" manouvers. Currently only Jump. I am sure we could come up with something better. or even make this part customizable wiht some commands and a file.
After this step I go back to monitor if we are still stuck. And if so last and final stage comes into place a hard teleport out.

I also added a general timer which resets the stage after 60 seconds. So that we do not stay in stage 3 forever...:-)
 
Back
Top