[Code] Movement in World of Warcraft menu

User Tag List

Results 1 to 13 of 13
  1. #1
    naa's Avatar Contributor
    Reputation
    100
    Join Date
    Oct 2006
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Code] Movement in World of Warcraft

    Blog hacked, all images gone, without it this thread does not make sense, sorry.
    Last edited by naa; 05-28-2009 at 02:15 PM.

    [Code] Movement in World of Warcraft
  2. #2
    SKU's Avatar Contributor
    Reputation
    306
    Join Date
    May 2007
    Posts
    565
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just flew over it, looks good. While the timer thing might be better at performance / laggy computers, comparing your current facing with the needed one 'at all times' would still be more accurate than timers, or am I terribly wrong here? Also, as I read it, you can only turn while not moving, is that right? Aka: reaching waypoint -> stand still -> turn -> walk to new waypoint? By always comparing your current facing with the needed one, you could be walking forward and turning at the same time while still finding the right facing to reach your new waypoint, thus looking more 'human'. As I said, I didn't look that much into it so you might have that checked, sorry if that's the case. I'm quite tired and my eyes are dying, but is that 1 * pi/2 at the bottom for 270°? Not that it was that important, just letting you know.

    Also, mind pming me the link of your blog?

  3. #3
    naa's Avatar Contributor
    Reputation
    100
    Join Date
    Oct 2006
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by SKU View Post
    Just flew over it, looks good. While the timer thing might be better at performance / laggy computers, comparing your current facing with the needed one 'at all times' would still be more accurate than timers, or am I terribly wrong here? Also, as I read it, you can only turn while not moving, is that right? Aka: reaching waypoint -> stand still -> turn -> walk to new waypoint? By always comparing your current facing with the needed one, you could be walking forward and turning at the same time while still finding the right facing to reach your new waypoint, thus looking more 'human'. As I said, I didn't look that much into it so you might have that checked, sorry if that's the case. I'm quite tired and my eyes are dying, but is that 1 * pi/2 at the bottom for 270°? Not that it was that important, just letting you know.

    Also, mind pming me the link of your blog?
    The code that I "attached" is only showing how to face, i got some other code to (not attached) that uses that face code together with movement code. With that code I can get the char to move like a normal player, I am simply running forward while calling the facing function if the mob has moved more that 5 yards from its position last time i did a face. That way i can get the player to "hit" the mob even if the mob moves around.
    I did not include the movement code as it needs some more work, stuck detector etc.
    This is not a perfect way to face/move but as I do not want to edit the memory (facing etc) of wow I found this to be the second best way to control my char.
    And you can easily face while moving
    PM'ed you a link to my blog, but it is really not very interesting atm as I haven't been posting anything besides this since December.

    Edit: Ups you are right, I made an error when drawing the circle, fixed it.
    Last edited by naa; 02-02-2009 at 10:12 AM.

  4. #4
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or you can use SetFacing, alot easier or even better up you could use clicktomove for all the movement it's really nice

    Code:
               PlayerInfo pInfo = new PlayerInfo(_process);
    
                if (Radians != true)
                { Angle = Angle * PI / 180; }
    
                uint pAngle = wow.AllocateMemory(0x4);
                wow.WriteFloat(pAngle, Angle);
    
                wow.Asm.Clear();
                wow.Asm.AddLine("mov EDX, [{0}]", 0x011CA310);   //Start UpdateCurMgr
                wow.Asm.AddLine("mov EDX, [EDX+{0}]", 0x000028A4);
                wow.Asm.AddLine("FS mov EAX, [0x2C]");
                wow.Asm.AddLine("mov EAX, [EAX]");
                wow.Asm.AddLine("add EAX, 8");
                wow.Asm.AddLine("mov [EAX], EDX"); // End UpdateCurMgr
    
                wow.Asm.AddLine("mov ecx, {0}", pInfo.GetLocalPlayer());
                wow.Asm.AddLine("push {0}", pAngle);
                wow.Asm.AddLine("call {0}", 0x006705E0);
                wow.Asm.AddLine("retn");
                wow.Asm.AddLine("add esp, 0x8");
                wow.Asm.InjectAndExecute(wow.AllocateMemory());

  5. #5
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the release but:

    Originally Posted by naa View Post
    I have done this with the help of an highly accurent timer class and a bit of math and i found out that it takes 2 sec to turn from facing 0 to facing 0 (one hole circle).
    Update your highly accurate timer ^^ it's 40ms off!

    static int FullTurnTimeStill = 1960; //Time to turn do a full turn (2PI) while standing still
    static int FullTurnTimeRunning = 2650; //Time to turn to do a full turn while running

    As someone said before, your algorithm doesn't work if you want to turn while running, but it's possible ^ gogo
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  6. #6
    naa's Avatar Contributor
    Reputation
    100
    Join Date
    Oct 2006
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh dammit, guess I need to update the code for my highly accurate timer then :P

    Guess i will need to come up with some new code to solve the problem with moving and still rotation.

    Anyway thanks for pointing out the errors i made.

  7. #7
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is what I do:
    Code:
    public static void AdjustYaw(PlayerObject LocalPlayer, double LocationX, double LocationY)
            {
                string turnDirectionHorizontal;
                double l, r;
                // get the angle we need to turn to horizontally
                double horizontalAngle = Math.Atan2(LocationY - LocalPlayer.YPosition, LocationX - LocalPlayer.XPosition);
                if (horizontalAngle < 0)
                    horizontalAngle = (Math.PI * 2) + horizontalAngle;
                // should we turn left or right?
                if (LocalPlayer.Rotation > horizontalAngle)
                {
                    // we do have to turn past north if we are turning left
                    l = (2 * Math.PI) - LocalPlayer.Rotation + horizontalAngle;
                    // we dont have to turn past north if we are turning right
                    r = LocalPlayer.Rotation - horizontalAngle;
                }
                else
                {
                    // we dont have to turn past north if we are turning left
                    l = horizontalAngle - LocalPlayer.Rotation;
                    // we do have to turn past north if we are turning right
                    r = LocalPlayer.Rotation + (2 * Math.PI) - horizontalAngle;
                }
                // choose whichever is fastest
                if (l < r)
                    turnDirectionHorizontal = "left";
                else
                    turnDirectionHorizontal = "right";
                // start adjusting
                if (turnDirectionHorizontal == "left")
                    KeyboardControl.KeyDown(TurnLeftKey);
                else
                    KeyboardControl.KeyDown(TurnRightKey);
                bool turnKeyDown = true;
                while (turnKeyDown == true)
                {
                    // refresh our variables (so if we are flying while turning etc we should still turn to the target)
                    horizontalAngle = Math.Atan2(LocationY - LocalPlayer.YPosition, LocationX - LocalPlayer.XPosition);
                    if (horizontalAngle < 0)
                        horizontalAngle = (Math.PI * 2) + horizontalAngle;
                    // horizontal check
                    if (DifferenceBetween(LocalPlayer.Rotation, horizontalAngle) < 0.0872664626) // 5 degrees
                    {
                        if (turnDirectionHorizontal == "left")
                            KeyboardControl.KeyUp(TurnLeftKey);
                        else
                            KeyboardControl.KeyUp(TurnRightKey);
                        turnKeyDown = false;
                    }
                }
            }
    Forgot to say, LocalPlayer.XPosition and LocalPlayer.YPosition etc. are actually read from memory when you access them, so they are always up to date.
    Last edited by jbrauman; 02-02-2009 at 08:05 PM.

  8. #8
    Sillyboy72's Avatar Member
    Reputation
    13
    Join Date
    Jan 2009
    Posts
    66
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nesox View Post

    Code:
                wow.Asm.AddLine("mov ecx, {0}", pInfo.GetLocalPlayer());
                wow.Asm.AddLine("push {0}", pAngle);
                wow.Asm.AddLine("call {0}", 0x006705E0);
                wow.Asm.AddLine("retn");
                wow.Asm.AddLine("add esp, 0x8");
                wow.Asm.InjectAndExecute(wow.AllocateMemory());
    Look, I am easily confused. dont mess with me!

    why do you adjust the stack after your retn statement!? I assume that add instruction never happens!?


    Edit: (cuz peeps get grumpy w/ 2 posts in a row on same thread )

    Hrm, I just tried adding this code to my CWowObject ... to basically no effect
    Code:
    	void SetFacing(float Angle)
    	{
    		__asm
    		{
    			mov ecx, this
    			push Angle
    			mov eax, 0x006705E0   ; CInputControl_SetFacing
    			call eax
    		}
    	}
    It's calling the function fine, but seems to be bailing out early. Is there magic "patching" that has to happen to convince this function to actually... do stuff?
    Last edited by Sillyboy72; 02-03-2009 at 02:09 AM.

  9. #9
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Sillyboy72 View Post
    Look, I am easily confused. dont mess with me!

    why do you adjust the stack after your retn statement!? I assume that add instruction never happens!?


    Edit: (cuz peeps get grumpy w/ 2 posts in a row on same thread )

    Hrm, I just tried adding this code to my CWowObject ... to basically no effect
    Code:
        void SetFacing(float Angle)
        {
            __asm
            {
                mov ecx, this
                push Angle
                mov eax, 0x006705E0   ; CInputControl_SetFacing
                call eax
            }
        }
    It's calling the function fine, but seems to be bailing out early. Is there magic "patching" that has to happen to convince this function to actually... do stuff?
    You dont move this into ecx you need to move the pointer to the local player into ecx, aka PlayerBase or w/e pepole call it

  10. #10
    Sillyboy72's Avatar Member
    Reputation
    13
    Join Date
    Jan 2009
    Posts
    66
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nesox View Post
    You dont move this into ecx you need to move the pointer to the local player into ecx, aka PlayerBase or w/e pepole call it
    Sorry, if that wasn't clear... that code is hanging off my CWowObject. "this" is the playerbase.

  11. #11
    RiseAndShine's Avatar Member
    Reputation
    18
    Join Date
    Jan 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're not alone Sillyboy ^^
    Tried that SetFacing Snippet as soon as I saw it, thinking it would be an awesome improvement for the movement - but somehow simply nothing happens. No crash.. just nothing.
    Are we missing something? I tried suspending WoW's Thread, but that doesn't seem to have an effect either.

  12. #12
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Same. I'm not sure I'm doing it right though, never done any injection O_O
    // get the angle we need to turn to horizontally
    float horizontalAngle = (float)Math.Atan2(LocationY - LocalPlayer.YPosition, LocationX - LocalPlayer.XPosition);
    if (horizontalAngle < 0)
    horizontalAngle = (
    float)((Math.PI * 2) + horizontalAngle);
    // inject that shit!
    wow.Asm.Clear();
    wow.Asm.AddLine(
    "mov EDX, [{0}]", 0x011CA310);
    wow.Asm.AddLine(
    "mov EDX, [EDX+{0}]", 0x000028A4);
    wow.Asm.AddLine(
    "FS mov EAX, [0x2C]");
    wow.Asm.AddLine(
    "mov EAX, [EAX]");
    wow.Asm.AddLine(
    "add EAX, 8");
    wow.Asm.AddLine(
    "mov [EAX], EDX");
    wow.Asm.AddLine(
    "mov ecx, {0}", LocalPlayer.BaseAddress);
    uint pAngle = wow.AllocateMemory(0x4);
    wow.WriteFloat(pAngle, horizontalAngle);
    wow.Asm.AddLine(
    "push {0}", pAngle);
    wow.Asm.AddLine(
    "call {0}", 0x006705E0);
    wow.Asm.AddLine(
    "retn");
    wow.Asm.AddLine(
    "add esp, 0x8");
    wow.Asm.InjectAndExecute(wow.AllocateMemory());

  13. #13
    naa's Avatar Contributor
    Reputation
    100
    Join Date
    Oct 2006
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code i used to set my facing with before i made the code above:
    Code:
            public void facing(float angle)
            {
                if ((angle >= 0f) && (angle <= 2*Math.PI)
                {
                    this.Memory.WriteFloat(getLocalPlayerObject() + 0x7dc, angle);
                }
            }
    
            public void facing(GUnit LocalPlayer, GUnit TargetObject)
            {
                this.facing(LocalPlayer.getPosition(), TargetObject.getPosition());
            }
    
            public void facing(GLocation localPlayerPosition, GLocation targetPosition)
            {
                float angle = (float) Math.Atan2((double) (targetPosition.Y - localPlayerPosition.Y), (double) (targetPosition.X - localPlayerPosition.X));
                
                //if the turning angle is negative
                if (angle < 0)
                    //add the maximum possible angle (PI x 2) to normalize the negative angle
                    angle += (float)(Math.PI * 2);
          
                this.facing(angle);
            }
    The localPlayerObject is the player object found by the GUID of the localPlayer.
    The code makes you instantly face the angle you set.

Similar Threads

  1. [Selling] ★World of Warcraft 30 days GameTime codes $7/each★[US only]
    By ZeroReflector in forum World of Warcraft Buy Sell Trade
    Replies: 0
    Last Post: 12-30-2011, 11:23 AM
  2. Replies: 5
    Last Post: 08-22-2011, 12:06 PM
  3. [Trading] World of Warcraft WORKING 60 day key for Minecraft gift BETA code.
    By XXMightXXc in forum General Trading Buy Sell Trade
    Replies: 0
    Last Post: 07-31-2011, 03:26 PM
  4. [Selling] World of Warcraft (USA) 60 Day Pre-Paid Time Code - 25.15$
    By Dirtyangel in forum World of Warcraft Buy Sell Trade
    Replies: 0
    Last Post: 12-06-2010, 06:41 AM
  5. [Selling] World of Warcraft (USA) 60 Day Pre-Paid Time Code - 22.95$
    By Dirtyangel in forum World of Warcraft Buy Sell Trade
    Replies: 9
    Last Post: 12-06-2010, 06:36 AM
All times are GMT -5. The time now is 01:11 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search