Who is attacking me? menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Viano's Avatar Active Member
    Reputation
    37
    Join Date
    May 2008
    Posts
    172
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Who is attacking me?

    Hi everyone,

    how do you detect whether a mob is attacking you? When I just read the mob's target, sometimes mobs are targeting me without attacking and sometimes players do target me without attacking either.

    Is there some flag like isInFightWithGuid?
    Viano

    Who is attacking me?
  2. #2
    Kandyman's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's probably a better way to do it, but what I do is monitoring my Health all the time. Then, in a Timer, I got a procedure that looks like this:

    Code:
    if myHealth < myMaxHealth then
    
        //I lost some health, is someone attacking me or a priest buffed me ?
        tempHealth = myHealth
    
        if myHealth < tempHealth then  //there's definitly something wrong
    
             attack()
    
        End if
    
    End if
    It's not the real code, but it's pretty self explanary and it's the way I do it. It's working, but you have to take some damage before to fight back, wich is obviously, not the best method...

  3. #3
    Viano's Avatar Active Member
    Reputation
    37
    Join Date
    May 2008
    Posts
    172
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Kandyman View Post
    There's probably a better way to do it, but what I do is monitoring my Health all the time. Then, in a Timer, I got a procedure that looks like this:

    Code:
    if myHealth < myMaxHealth then
    
        //I lost some health, is someone attacking me or a priest buffed me ?
        tempHealth = myHealth
    
        if myHealth < tempHealth then  //there's definitly something wrong
    
             attack()
    
        End if
    
    End if
    It's not the real code, but it's pretty self explanary and it's the way I do it. It's working, but you have to take some damage before to fight back, wich is obviously, not the best method...
    So if a debuff taking your health is on your toon after a fight you think you are beeing attacked?
    Viano

  4. #4
    Kandyman's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So if a debuff taking your health is on your toon after a fight you think you are beeing attacked?
    That would explain a lot of things ... lol

    You are right, I even didn't think about it.

  5. #5
    ostapus's Avatar Active Member
    Reputation
    60
    Join Date
    Nov 2008
    Posts
    180
    Thanks G/R
    3/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Viano View Post
    Hi everyone,

    how do you detect whether a mob is attacking you? When I just read the mob's target, sometimes mobs are targeting me without attacking and sometimes players do target me without attacking either.

    Is there some flag like isInFightWithGuid?
    here is lua code, the one i am using

    function _validEnemy(u)
    local rc
    rc = UnitExists(u) ;
    rc = rc and not UnitIsDeadOrGhost(u) ;
    rc = rc and UnitCanAttack("player", u) ;
    rc = rc and not UnitIsPlayer(u) ;
    rc = rc and (not UnitIsTapped(u) or (UnitIsTapped(u) and UnitIsTappedByPlayer(u)))
    rc = rc and ( UnitAffectingCombat(u) or ( not UnitAffectingCombat(u) and UnitName(u .. "target") == UnitName("player")))
    return rc
    end

  6. #6
    xzidez's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    136
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    One simple solution would be to check if you are in combat.
    if you are in combat scan nearby mobs. If any mob is targeting you ..

    you can be fairly sure he is attacking you. :P
    Last edited by xzidez; 09-24-2009 at 10:22 AM.

  7. #7
    Viano's Avatar Active Member
    Reputation
    37
    Join Date
    May 2008
    Posts
    172
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ostapus View Post
    here is lua code, the one i am using

    function _validEnemy(u)
    local rc
    rc = UnitExists(u) ;
    rc = rc and not UnitIsDeadOrGhost(u) ;
    rc = rc and UnitCanAttack("player", u) ;
    rc = rc and not UnitIsPlayer(u) ;
    rc = rc and (not UnitIsTapped(u) or (UnitIsTapped(u) and UnitIsTappedByPlayer(u)))
    rc = rc and ( UnitAffectingCombat(u) or ( not UnitAffectingCombat(u) and UnitName(u .. "target") == UnitName("player")))
    return rc
    end
    Ok, that would probably work but looks like an overkill. Thank you.
    What parameter is u? Is it the Guid?

    Originally Posted by xzidez View Post
    ...
    One simple solution would be to check if you are in combat.
    if you are in combat scan nearby mobs. If any mob is targeting you ..

    you can be fairly sure he is attacking you. :P
    That is not a solution because players and mobs are sometimes targeting me without fighting with me.
    Last edited by Viano; 09-24-2009 at 10:47 AM.
    Viano

  8. #8
    ostapus's Avatar Active Member
    Reputation
    60
    Join Date
    Nov 2008
    Posts
    180
    Thanks G/R
    3/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Viano View Post
    Ok, that would probably work but looks like an overkill. Thank you.
    What parameter is u? Is it the Guid?



    That is not a solution because players and mobs are sometimes targeting me without fighting with me.
    u - is standard wow unit, like "target", "focus" etc....

    in that case i am using "EnumVisibleObjects" with calllback like this one

    function enumCallback(hguid, lguid)
    _SetFocus(hguid, lguid)
    if ( _validEnemy("focus") ) then <we found enemy who is attacking us or we can attack>; SetTarget(hguid, lguid); end
    end

  9. #9
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ostapus View Post
    u - is standard wow unit, like "target", "focus" etc....

    in that case i am using "EnumVisibleObjects" with calllback like this one

    function enumCallback(hguid, lguid)
    _SetFocus(hguid, lguid)
    if ( _validEnemy("focus") ) then <we found enemy who is attacking us or we can attack>; SetTarget(hguid, lguid); end
    end
    I take it EnumVisibleObjects is a function you are calling via injection? Do you think this is available as a flag for those who only do memory reading?

  10. #10
    ostapus's Avatar Active Member
    Reputation
    60
    Join Date
    Nov 2008
    Posts
    180
    Thanks G/R
    3/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tanaris4 View Post
    I take it EnumVisibleObjects is a function you are calling via injection? Do you think this is available as a flag for those who only do memory reading?
    why not ? there are tons of examples on this forum how to iterate over object list out of proc and execute lua string

    pseudo code

    notfound = true ;
    object = ObjectList ;
    targetguid = 0 ;
    while (object && targetguid == 0)
    {
    guid = object.guid
    setfocus(guid)
    rc = lua_doString("IsEnemy(\"focus\")") ;
    if ( rc ) targetguid = guid ;
    object = getnextobject ;
    }
    if ( targetguid )
    here is our enemy

    something like that...

  11. #11
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do you use lua_doString out of process?

  12. #12
    Viano's Avatar Active Member
    Reputation
    37
    Join Date
    May 2008
    Posts
    172
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tanaris4 View Post
    How do you use lua_doString out of process?
    Asm. Lots of my noobish posts in this forum
    Viano

  13. #13
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Viano View Post
    Asm. Lots of my noobish posts in this forum
    Well, fasm_managed uses CreateRemoteThread to execute the ASM, so it's not completely out of process.
    Might be the only possible way to use the ASM though
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  14. #14
    Viano's Avatar Active Member
    Reputation
    37
    Join Date
    May 2008
    Posts
    172
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, the easiest way to achieve this is comparing whether a mob is in combat and has me as target.

    // IsAttackingMe ripped of from BabBot
    Convert.ToBoolean((ReadDescriptor<uint>(Constants.UnitFields.UNIT_FIELD_FLAGS) >> 0x13) & 1);
    Viano

  15. #15
    ostapus's Avatar Active Member
    Reputation
    60
    Join Date
    Nov 2008
    Posts
    180
    Thanks G/R
    3/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Viano View Post
    Ok, the easiest way to achieve this is comparing whether a mob is in combat and has me as target.
    if you solo - yes (there are some exception though, rare one). if you in group - mob may not attack you )

Page 1 of 2 12 LastLast

Similar Threads

  1. Get who unit is attacking...
    By jbrauman in forum WoW Memory Editing
    Replies: 19
    Last Post: 02-02-2009, 05:03 AM
  2. How can you make guards that attack people who are PvP-ing ?
    By Wheeze201 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 12-31-2007, 07:24 AM
  3. Unlimited Gun Attack Range
    By Matt in forum World of Warcraft Exploits
    Replies: 3
    Last Post: 05-11-2006, 04:09 AM
  4. Attack your own NPC's
    By oninuva in forum World of Warcraft Guides
    Replies: 0
    Last Post: 04-23-2006, 02:24 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 03:37 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