Jump to content

[SOLVED] Move after Frost Nova - is it really that hard?


Recommended Posts

1 minute ago, Matenia said:

You actually need to set isTooClose to false again after the while loop and maybe give it a short Thread.Sleep(500) or so at the end of each iteration.
Does the bot interrupt movement and then starts strafing again? Or is the strafing itself just choppy?

 

I highly recommend getting Visual Studio and doing a basic C# tutorial (or even Java, they're essentially the same

I'll try to record it so you guys know what I'm talking about.

Link to comment
Share on other sites

7 minutes ago, Matenia said:

Looks to me like you need to call the movement function with maybe 50ms instead of 1250.

What does that parameter mean? I haven't been able to find any explanation to it so I assumed it defined how long should the movement be active for, in other words for how long the key should be pressed.

 

I tried this, which somewhat works but it moves backwards REALLY choppy, it really looks like it presses S every 50ms, however changing it to something like 5000 doesn't do much...

while (ObjectManager.Target.GetDistance <= 6)
			{
				isTooClose = true;
				wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 50); // wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1500);
				//Thread.Sleep(1250);
			}

 

Link to comment
Share on other sites

Yes, try 

wManager.Wow.Helpers.Move.Backward(Move.MoveAction.DownKey, );

so it will press the key for 1000 ms (down). The ms is the time it will press it. With PressKey it will go up and down in 50ms (or 1000, or whatever) hence the movement you're seeing.

Link to comment
Share on other sites

22 minutes ago, Matenia said:

Yes, try 


wManager.Wow.Helpers.Move.Backward(Move.MoveAction.DownKey, );

so it will press the key for 1000 ms (down). The ms is the time it will press it. With PressKey it will go up and down in 50ms (or 1000, or whatever) hence the movement you're seeing.

lol are you serious DownKey instead of PressKey, so obvious, yet still not so... :-D

 

Alright, so Move.Backward + DownKey works, but that would work even without all the MovementEvents_OnMovementPulse shennanigans.

When I try wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.DownKey, 1000); it STILL tries to face the target, running around in circles, practically indefinitely because I am well within the 6yr range we set up in the while loop.

I even tried ForceIgnoreAttack, still the same thing. The strange thing is that even though it leaves the 6yr radius it continues strafing. It's like it doesn't wait for the movement to stop to continue.

while (ObjectManager.Target.GetDistance <= 6)
{
	wManager.Wow.Helpers.Conditions.ForceIgnoreIsAttacked = true;
	isTooClose = true;
	wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.DownKey, 2500); // wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1500);
	wManager.Wow.Helpers.Conditions.ForceIgnoreIsAttacked = false;
	//Thread.Sleep(1250);
}

 

If the bot doesn't wait for the Move to resolve before continuing the script I tried putting in Sleep. Still the same thing, runs around in circles until the mob is dead.

while (ObjectManager.Target.GetDistance <= 6)
{
	wManager.Wow.Helpers.Conditions.ForceIgnoreIsAttacked = true;
	isTooClose = true;
	wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.DownKey, 2500); // wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1500);
	Thread.Sleep(2500);
	wManager.Wow.Helpers.Conditions.ForceIgnoreIsAttacked = false;
	//Thread.Sleep(1250);
}

 

Link to comment
Share on other sites

I don't understand the problem really. I use the following for my hunter fight class without any OnEvent methods:

if (!MyTarget.IsTargetingMe && Vector3.Distance(Me.Position, MyTarget.Position) < 8 && HunterSettings.CurrentSetting.ManageMovement)
    Move.Backward(Move.MoveAction.PressKey, 800);

And it works flawlessly.

Link to comment
Share on other sites

Here's an idea, does facing the target count as movement? Because if it doesn't it would make sense... we're trying to cancel bot movement but facing the target is still there?

This is probably not the case but I'm trying to think of everything because we don't seem to be able to find out what's wrong.

Link to comment
Share on other sites

6 minutes ago, Apexx said:

I don't understand the problem really. I use the following for my hunter fight class without any OnEvent methods:


if (!MyTarget.IsTargetingMe && Vector3.Distance(Me.Position, MyTarget.Position) < 8 && HunterSettings.CurrentSetting.ManageMovement)
    Move.Backward(Move.MoveAction.PressKey, 800);

And it works flawlessly.

Since I see Vector3, do you manage the movement yourself? Because I don't, I let the bot decide the movement.

Also try it with Move.StrafeLeft

Also what does the ManageMovement setting do?

 

EDIT:

Quote

Since I see Vector3, do you manage the movement yourself? Because I don't, I let the bot decide the movement.

With my poor understanding of CSharp and the bot itself I've seen some people claiming they handle the toon movement themselves using a separate code. I don't even know if that could be done but worth asking...

Link to comment
Share on other sites

It simply checks the distance between the player and player target. If the distance between is < 8 yards, it will back pedal.
ManageMovement is a boolean option in my fight class settings.

I have not tried strafing, it would just seem pointless to strafe when I can achieve greater distance just back pedaling and not have to worry about character rotation.

Link to comment
Share on other sites

4 minutes ago, Apexx said:

It simply checks the distance between the player and player target. If the distance between is < 8 yards, it will back pedal.
ManageMovement is a boolean option in my fight class settings.

I have not tried strafing, it would just seem pointless to strafe when I can achieve greater distance just back pedaling and not have to worry about character rotation.

I don't know about you but when I see someone backpaddling it seems suspicious not to mention it is significantly slower than strafing.

I would very much like to see if strafing worked for you. Would you try and let us know?

Link to comment
Share on other sites

I think back pedaling is somewhat a moot point. Even when I play my hunter using my actual fingers :tongue: I back pedal. The video behavior would be more suspicious imo.
I could maybe find some time at some point to modify the code and test. I just don't know when I will be able to at the current moment.

Link to comment
Share on other sites

You can try the following:

MovementManager.StopMove();
var target = ObjectManager.Target;
Fight.StopFight();
// do movement here
FIght.StartFight(target.Guid);

Edit: MovementManager.StopMove() should make the bot stop any movement it was trying to do already (for example, running close to a target). Your bot constantly facing the target happens because it started a "fight". If you temporarily stop the fight and then re-enable it, MAYBE that will help with your strafing.

Edited by Matenia
Link to comment
Share on other sites

I'm begining to give up, honestly...

So first issue, when I stop the fight and then start it again, the bot log says I started to fight the mob I was targetting before. BUT... it doesn't do anything, it just stares at the mob... But that's irrelevant since it doesn't solve the movement issue at all, still running in circles...

Second thing. There seems to be an inconsistency between presskey and downkey. Both of them make the bot run in circles, however when I do:

  • wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1000); - it does only a small movement, maybe trully 1second and then stops (still circling though)
  • wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.DownKey, 1000); - it does circles for a VERY long time, maybe 30 seconds... doesn't DownKey require an UpKey somewhere?
  • wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 1000); - does the chopping movement I showed in the vid
  • wManager.Wow.Helpers.Move.Backward(Move.MoveAction.DownKey, 1000); - actually moves back but there is still slight choppiness, it doesn't look like someone pressed a button and held it pressed, it looks like someone was mashing the key repeatedly in milisecond increments, look very bot like

I also tried removing the MovementEvents and it didn't have any effect on how the bot acted...

Link to comment
Share on other sites

Ignoring the Helpers.Move for a second, could you not do something like;

MovementManager.Go(PathFinder.FindPath("Vector3 of the place you want to go"), false);

Bear in mind, you'll need to do some math to find the vector3 that is like 20yards behind where your char is currently facing.

Link to comment
Share on other sites

2 minutes ago, Marsbar said:

Ignoring the Helpers.Move for a second, could you not do something like;


MovementManager.Go(PathFinder.FindPath("Vector3 of the place you want to go"), false);

Bear in mind, you'll need to do some math to find the vector3 that is like 20yards behind where your char is currently facing.

I wanted to avoid this as much as possible because I have NO IDEA how to do that but if you or someone is willing to help me with that I guess it would be a good solution if it worked.

Link to comment
Share on other sites

49 minutes ago, Apexx said:

I think back pedaling is somewhat a moot point. Even when I play my hunter using my actual fingers :tongue: I back pedal. The video behavior would be more suspicious imo.
I could maybe find some time at some point to modify the code and test. I just don't know when I will be able to at the current moment.

Would you be willing to post your code, Apexx? I would like to check the differences.

Link to comment
Share on other sites

So I did some testing.

I put together a complete vanilla Fightclass and a Custom profile.

 

Custom Profile: 

moves flawlessly both in and out of combat both backward and strafe (doesn't attack though, duh)

Spoiler

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel;
using System.Diagnostics;
using System.Threading;

using robotManager.Helpful;
using robotManager.Products;

using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class CustomProfile : Custom_Profile.ICustomProfile
{
    public void Pulse()
    {
		try
        {
            while (wManager.Wow.Helpers.Conditions.ProductIsStarted)
			{
				if (wManager.Wow.Helpers.Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
				{
					Buffer.Pulse();
				}
				Thread.Sleep(Usefuls.Latency + 1000);
			}
        }
        catch (Exception e)
        {
            Logging.WriteError("CustomProfile > Pulse(): " + e);
        }
    }

    public void Dispose()
    {
        try
        {
            Buffer.Dispose();
        }
        catch (Exception e)
        {
            Logging.WriteError("CustomProfile > Dispose(): " + e);
        }
    }
}

internal static class Buffer
{
	public static bool Pulse()
	{
		try
		{
			wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1000);
			return true;
		}
		catch (Exception e)
		{
			try
			{
				Dispose();
			}
			catch
			{
			}
			Logging.WriteError("Buffer > Pulse(): " + e);
			Products.ProductStop();
			return false;
		}
	}
	public static void Dispose()
    {
        Logging.Write("Stop Buffer.");
    }
}

 

 

Fightclass:

Is set it up to shoot frost bolts if distance > 6, if the distance is smaller it should go backwards. And despite it being vanilla and converted from XML, it does the same stutter as shown in the video. So now we know the issue is not with my code but rather it's something in wrobot handling combat, not just Grinder. I tried using Party mode and aggroing a mob and same thing. @Apexx what wow version do you use wrobot for? Not sure if the wrobot versions are different or not but I cannot see any other reason why the code would work for you and not for me.

Spoiler

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading;
using robotManager;
using robotManager.FiniteStateMachine;
using robotManager.Helpful;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using wManager.Wow.Bot.States;
using Timer = robotManager.Helpful.Timer;
using wManager.Wow.Enums;

public class Main : ICustomClass
{
    public float Range { get { return 5; } }

    private bool _usePet = false;
    private Engine _engine;
    public void Initialize()
    {
        FightconfignameSettings.Load();
        _engine = new Engine(false)
        {
            States = new List<State>
                        {
                             new SpellState("Frostbolt", 2, context => ObjectManager.Target.GetDistance > 6, false, true, false, false, true, true, true, true, 0, false, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Auto, "", "none", true, true, false),
                             new SpellState("wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 1000);", 1, context => ObjectManager.Target.GetDistance < 6, false, true, false, false, true, true, true, true, 0, false, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Auto, "", "none", true, true, true),

                        }
        };

        if (_usePet)
            _engine.States.Add(new PetManager { Priority = int.MaxValue });

        _engine.States.Sort();
        _engine.StartEngine(10, "_FightClass", true);
    }

    public void Dispose()
    {
        if (_engine != null)
        {
            _engine.StopEngine();
            _engine.States.Clear();
        }
    }

    public void ShowConfiguration()
    {
        FightconfignameSettings.Load();
        FightconfignameSettings.CurrentSetting.ToForm();
        FightconfignameSettings.CurrentSetting.Save();
    }

    class PetManager : State
    {
        public override string DisplayName
        {
            get { return "Pet Manager"; }
        }
        Timer _petTimer = new Timer(-1);
        bool _petFistTime = true;
        public override bool NeedToRun
        {
            get
            {
                if (!_petTimer.IsReady)
                    return false;

                if (ObjectManager.Me.IsDeadMe || ObjectManager.Me.IsMounted || !Conditions.InGameAndConnected)
                {
                    _petFistTime = false;
                    _petTimer = new Timer(1000 * 3);
                    return false;
                }
                if (!ObjectManager.Pet.IsValid || ObjectManager.Pet.IsDead) {
                    if (_petFistTime) { return true; }
                    else { _petFistTime = true; }
                }
                return false;
            }
        }

        private readonly Spell _revivePet = new Spell("Revive Pet");
        private readonly Spell _callPet = new Spell("Call Pet 1");

        public override void Run()
        {
            if (!ObjectManager.Pet.IsValid)
            {
                _callPet.Launch(true);
                Thread.Sleep(Usefuls.Latency + 1000);
            }
            if (!ObjectManager.Pet.IsValid || ObjectManager.Pet.IsDead)
                _revivePet.Launch(true);

            _petTimer = new Timer(1000 * 2);
        }
    }



}

/*
 * SETTINGS
*/

[Serializable]
public class FightconfignameSettings : Settings
{



    private FightconfignameSettings()
    {
        ConfigWinForm(new System.Drawing.Point(400, 400), "Fightconfigname " + Translate.Get("Settings"));
    }

    public static FightconfignameSettings CurrentSetting { get; set; }

    public bool Save()
    {
        try
        {
            return Save(AdviserFilePathAndName("CustomClass-Fightconfigname", ObjectManager.Me.Name + "." + Usefuls.RealmName));
        }
        catch (Exception e)
        {
            Logging.WriteError("FightconfignameSettings > Save(): " + e);
            return false;
        }
    }

    public static bool Load()
    {
        try
        {
            if (File.Exists(AdviserFilePathAndName("CustomClass-Fightconfigname", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
            {
                CurrentSetting =
                    Load<FightconfignameSettings>(AdviserFilePathAndName("CustomClass-Fightconfigname",
                                                                 ObjectManager.Me.Name + "." + Usefuls.RealmName));
                return true;
            }
            CurrentSetting = new FightconfignameSettings();
        }
        catch (Exception e)
        {
            Logging.WriteError("FightconfignameSettings > Load(): " + e);
        }
        return false;
    }
}

 

 

@Droidz / @iMod, guys would you be willing to take a look? I'm going crazy already.

Link to comment
Share on other sites

Short Video Demonstration

// Debuff 20549 = War Stomp | 19975 = Entangling Roots
while (ObjectManager.Target.IsValid &&
    (ObjectManager.Target.HaveBuff(20549) || ObjectManager.Target.HaveBuff(19975)) &&   
    Vector3.Distance(ObjectManager.Me.Position, ObjectManager.Target.Position) < 6)
{
    Move.StrafeLeft(Move.MoveAction.PressKey, 1500);
    MovementManager.Face(ObjectManager.Target);
}

 

Link to comment
Share on other sites

9 minutes ago, Apexx said:

Short Video Demonstration


// Debuff 20549 = War Stomp | 19975 = Entangling Roots
while (ObjectManager.Target.IsValid &&
    (ObjectManager.Target.HaveBuff(20549) || ObjectManager.Target.HaveBuff(19975)) &&   
    Vector3.Distance(ObjectManager.Me.Position, ObjectManager.Target.Position) < 6)
{
    Move.StrafeLeft(Move.MoveAction.PressKey, 1500);
    MovementManager.Face(ObjectManager.Target);
}

 

Thanks for that, I appreciate it! But as per my previous post, for some reason it doesn't work for me. Are you using WRobot for Vanilla?

EDIT: Also, do you use Pathfinder (General Settings --> Path-finding)? What are your Class / Fight Class settings?

Link to comment
Share on other sites

Sorry I don't play Vanilla. All Path Finding settings are default.

I don't have a ranged class to try it with, and I am not sure how Vanilla might defer using built in WRobot functions..

// Debuff 20549 = War Stomp | 19975 = Entangling Roots
while (ObjectManager.Target.IsValid &&
    (ObjectManager.Target.HaveBuff(20549) || ObjectManager.Target.HaveBuff(19975)) &&
    Vector3.Distance(ObjectManager.Me.Position, ObjectManager.Target.Position) < 6)
{
    // Start Movement
    Move.StrafeLeft(Move.MoveAction.PressKey, 2250);

    while (ObjectManager.Me.GetMove)
        Thread.Sleep(10);
  
    // Stop Movement and Face Target
    MovementManager.StopMove();
    MovementManager.Face(ObjectManager.Target);
    MovementManager.StopMove();

    // Launch spell(s) here...
}

With WRotation it works fine (Manage Character Movement disabled), Automaton, Grinder, Quester etc should work, but
with melee feral druid, it kept trying to run to the target for my range. The automated bot actions are a bit different as the
bot continues the character movement on its own.

public float Range { get { return 4.95f; } }

Maybe someone else can chime in on this. I am at a loss @Seminko. Sorry.

Link to comment
Share on other sites

6 minutes ago, Apexx said:

Sorry I don't play Vanilla.

So this must be the root of the problem. You're using non-vanilla Wrobot version, I use vanilla Wrobot, for you it's working, for me it's not. Thank you for trying man!

@Droidz we might possibly have a bug on our hands.

Link to comment
Share on other sites

8 minutes ago, sjb211 said:

Vanilla can also work properly, you can try attachments(trial version)
good luck

Well, iMage-Pro is a paid FightClass. I appreciate you wanting to help me but I would advise to delete the file immediately. Mr. @Jasabi surely spent couple of hours on this and wouldn't apprecite you spreading it around.

Thanks for participating in this, though!

Link to comment
Share on other sites

3 minutes ago, Seminko said:

Well, iMage-Pro is a paid FightClass. I appreciate you wanting to help me but I would advise to delete the file immediately. Mr. @Jasabi surely spent couple of hours on this and wouldn't apprecite you spreading it around.

Thanks for participating in this, though!

he's hammered

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...