Getting Attackers menu

Shout-Out

User Tag List

Results 1 to 13 of 13
  1. #1
    kingdeking's Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    50
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting Attackers

    Hi

    can someone give me a hint how to get all the players that are attacking me when I am in combat? I think there might be something in the objects descriptors, maybe a field like current target?

    Getting Attackers
  2. #2
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
            public IEnumerable<IWoWUnit> Attackers
            {
                get
                {
                    if (!_objectManager.Me.IsInCombat) return new IWoWUnit[0];
                    return _objectManager.Objects.OfType<IWoWUnit>()
                        .Where(u => !u.IsMe
                                    && !u.IsDead
                                    && _objectManager.Me.GetUnitReaction(u) < WoWUnitReaction.Friendly
                                    && WantsToHarm(u)
                                    && _objectManager.Me.IsInLineOfSight(u));
                }
            }
    
            private bool WantsToHarm(IWoWUnit u)
            {
                return (u.TargetGuid == _objectManager.Me.Guid
                    || u.GetThreatSituation(_objectManager.Me).ThreatStatus > WoWThreatStatus.NoThreatRelation);
            }
    References to GetThreatSituation are scattered all over the forum, as well as GetUnitReaction.
    Note that this is not exhaustive, iirc if you aggro another unit by pulling your current target through a mob group, that new unit will not have threat with you until it hits you the first time.

  3. #3
    kingdeking's Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    50
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    for the snippet. Im doing it like you do now. Though I realized that:

    - Enumerate WoWObjects
    -Check TargetGuid = PlayerGUID

    is way easier? LOL

    btw, for interested readers:

    Code:
    // returns 1, 2, 3 = hamrful
    // 4, 5, 6, 7 = no harm
    typedef __int32 (__thiscall* GetUnitReaction_t)(__int32* TargetObj, __int32* DestObj);
    
    // returns ThreatLevel, 0 = no threat, 1 = main threat?
    // usage: ObjectGUID = PlayerGUID, pWoWObject to get threat to.
    typedef __int32 (__thiscall* GetThreat_t)(__int32* pWoWObject, __int64* ObjectGUID, __int32* unknown1, __int32 zero1, __int32 zero2, __int32 zero3);
    Last edited by kingdeking; 08-09-2012 at 10:54 AM.

  4. #4
    kingdeking's Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    50
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    one more question: How can I set my current target? I tried writing the GUID to the PlayerObjects current TargetGUID field, but nothing really happens.

    edit: Okay dumb question, i forgot that i have UseAction Lol
    Last edited by kingdeking; 08-09-2012 at 01:49 PM.

  5. #5
    Seifer's Avatar Site Donator
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    270
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kingdeking View Post
    Hey,

    one more question: How can I set my current target? I tried writing the GUID to the PlayerObjects current TargetGUID field, but nothing really happens.

    edit: Okay dumb question, i forgot that i have UseAction Lol
    If I recall correctly you should look up CGGameUI::Target, then again, it's been ages since I've done anything with this game.

  6. #6
    reliasn's Avatar Legendary Authenticator enabled
    Reputation
    774
    Join Date
    Jan 2009
    Posts
    136
    Thanks G/R
    24/215
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kingdeking View Post
    Hey,

    one more question: How can I set my current target? I tried writing the GUID to the PlayerObjects current TargetGUID field, but nothing really happens.

    edit: Okay dumb question, i forgot that i have UseAction Lol
    To target something, I use the Target Last Target GUID. I just write the Unit GUID there and send the Target Last Target Key. Without sending a key, it won't target anything... More or less like this:
    Code:
    WriteProcessMemory(Handle, reinterpret_cast<void*>(reinterpret_cast<unsigned int>(module.modBaseAddr) + LastTargetGUID), &target, sizeof(target), NULL);
    sendKey(hwnd, lasttarkey);
    But I'm pretty sure there are easier ways out there

    I'm currently seeking to improve Combat in my bot... Not the AI itself but to detect which mobs are attacking you and which should be looted after combat is done. Right now, for example, while farming fishing pools, if the bot enters in combat, it won't do anything until a certain "timer" or a number of fishing attempts is reached... after that, the bot loops and theeen detects there's something in his "CurrentTargetGUID", therefore, indicating something is attacking him.

    I wonder if just scanning the memory for units targetting me should be enough to solve this "issue". But I don't know how I'm going to do to stop the "main job/task", to then kill a certain mob and return back to where it was and finish what he was doing...

  7. #7
    Seifer's Avatar Site Donator
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    270
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by reliasn View Post
    I'm currently seeking to improve Combat in my bot... Not the AI itself but to detect which mobs are attacking you and which should be looted after combat is done. Right now, for example, while farming fishing pools, if the bot enters in combat, it won't do anything until a certain "timer" or a number of fishing attempts is reached... after that, the bot loops and theeen detects there's something in his "CurrentTargetGUID", therefore, indicating something is attacking him.

    I wonder if just scanning the memory for units targetting me should be enough to solve this "issue". But I don't know how I'm going to do to stop the "main job/task", to then kill a certain mob and return back to where it was and finish what he was doing...
    That sounds completely ass-backwards, do you even have a proper logic system in place?

    You should always prioritize combat over fishing the pool; the fishing pool will remain there, but chances are, you won't. I would suggest looking up behaviour trees or even (finite) state machines and implementing either before you attempt to even update your combat; you're going to need proper logic before then.

    Oh and regarding the targeting; I'd prefer a function call over a plain memory write - just let the game handle it for you.
    Last edited by Seifer; 08-10-2012 at 04:05 PM.

  8. #8
    kingdeking's Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    50
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Btw, do you know a function to rotate the character? I am trying to face a mob and using ClickToMove to rotate the player is crappy.. oO


    edit: ow thank god, click to move doesnt have a min range on attacking mobs^^
    Last edited by kingdeking; 08-10-2012 at 04:30 PM.

  9. #9
    Seifer's Avatar Site Donator
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    270
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kingdeking View Post
    Btw, do you know a function to rotate the character? I am trying to face a mob and using ClickToMove to rotate the player is crappy.. oO


    edit: ow thank god, click to move doesnt have a min range on attacking mobs^^
    If you pass 0x2 as the CTM action, you can rotate without moving.

    Also, for your earlier question, if you look at the xrefs for CGGameUI::Target, you'll find:
    Code:
    .text:008D7B8C 50                                push    eax
    .text:008D7B8D 51                                push    ecx
    .text:008D7B8E E8 AD E6 FF FF                    call    CGGameUI__Target
    Which tells us that CGGameUI::Target takes the GUID of the target we're after as its sole argument, should be easy to figure how to apply that to your project.
    Last edited by Seifer; 08-10-2012 at 05:06 PM.

  10. #10
    reliasn's Avatar Legendary Authenticator enabled
    Reputation
    774
    Join Date
    Jan 2009
    Posts
    136
    Thanks G/R
    24/215
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Seifer View Post
    If you pass 0x2 as the CTM action, you can rotate without moving.
    Are you serious? I remember trying that and I'm not exactly sure what happened, but I think it just changed the camera's view or something... I gotta test it out again. I'm really looking for a better way to implement rotation because mine is just a huge function that does tons of calculation with atan2() and spams the rotatekey until my character's rot is close to the one I want...

    Regarding prioritizing combat... I do it in my code by checking every time if there's something in the CurrentTargetGUID. If there's, then go ahead and kill whatever is attacking you. If there isn't, then proceed to fishing the fishing pool. And here is the problem, because while fishing, the bot can enter in combat, for example, if a mob passes near. If that happens, the bot will try to fish for a couple attempts and then if he can't, he will just leave that loop and come back to the "start" where it would check if there's something in the CurrentTargetGUID. What I want would be a way to pause my fishing, kill whatever and then get back to fishing exactly where it stopped. For that, the only way I think of would be putting a detectCombat() function running in a thread and then once it detects, the bot would kill the mob and the fishing function would run again... but from the start, since I basically "killed" its thread.

    Finally, I'm not that experienced with calling functions via memory... which is why I'm just dealing with reading and writing I guess I will search around for ways to do like you are saying because it seems that it will ease my work a lot.

  11. #11
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Currently I have
    Code:
    public enum ClickToMoveType
        {
            FaceGuid = 0x1, // works
            FaceNorth = 0x2, // runs forward and faces angle too... doesn't care for guid and destination
    
    
            /// <summary>
            /// Will throw a UI error. Have not figured out how to avoid it!
            /// </summary>
            Stop_ThrowsException = 0x3,
            Move = 0x4,
            NpcInteract = 0x5,
            Loot = 0x6, // Does not auto-loot regardless of CVar, does not work when already in loot range
            ObjInteract = 0x7,
            FaceAngle = 0x8, // and run or sth, with facing angle as approximation
            Skin = 0x9,
            AttackPosition = 0xA, // not autorangedcombatspell, see OnClickAutomoveAndAttack
            AttackGuid = 0xB, // autorangedcombatspell
            RunAndFaceUnit = 0xC,
            None = 0xD,
        }
    Which were based on tests I did a while back (~half a year). I use 0x1 for facing a unit. 0x2 I supposed was for facing a certain position, but it always faced north upon testing.

  12. #12
    kingdeking's Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    50
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man, I think you solved my issue of calculating the facing. I will test this out

  13. #13
    Seifer's Avatar Site Donator
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    270
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by reliasn View Post
    Regarding prioritizing combat... I do it in my code by checking every time if there's something in the CurrentTargetGUID. If there's, then go ahead and kill whatever is attacking you. If there isn't, then proceed to fishing the fishing pool. And here is the problem, because while fishing, the bot can enter in combat, for example, if a mob passes near. If that happens, the bot will try to fish for a couple attempts and then if he can't, he will just leave that loop and come back to the "start" where it would check if there's something in the CurrentTargetGUID. What I want would be a way to pause my fishing, kill whatever and then get back to fishing exactly where it stopped. For that, the only way I think of would be putting a detectCombat() function running in a thread and then once it detects, the bot would kill the mob and the fishing function would run again... but from the start, since I basically "killed" its thread.

    Finally, I'm not that experienced with calling functions via memory... which is why I'm just dealing with reading and writing I guess I will search around for ways to do like you are saying because it seems that it will ease my work a lot.
    Use Apoc's FSM post to get started: http://www.ownedcore.com/forums/gene...your-bots.html ([Bot Developers]A simple, but effective FSM for your bots.)

    Using an FSM would already be a great improvement over just using a bunch of if/else/whatever statements really, and should make your work a lot easier. On a side note, check the unit flags; it contains a flag for InCombat.

Similar Threads

  1. Walk without getting attacked by mobs EPIC
    By jarza in forum World of Warcraft Exploits
    Replies: 47
    Last Post: 12-25-2008, 05:09 PM
  2. Get attacked by Unseens at Raven Hill
    By grecklin in forum World of Warcraft Exploits
    Replies: 21
    Last Post: 07-16-2008, 05:43 PM
  3. [priest] get attacked by your own factions npcs!
    By dylan in forum World of Warcraft Exploits
    Replies: 5
    Last Post: 12-30-2007, 09:14 PM
  4. Ganking in major city's without getting attacked!
    By T1B in forum World of Warcraft Exploits
    Replies: 5
    Last Post: 09-01-2007, 08:27 PM
  5. Warriors get a huge attack power boost
    By Matt in forum World of Warcraft Exploits
    Replies: 0
    Last Post: 04-02-2006, 10:02 PM
All times are GMT -5. The time now is 07:00 AM. 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