If a Unit is Hostile menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Bapetoven's Avatar Private
    Reputation
    1
    Join Date
    Sep 2010
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    If a Unit is Hostile

    Is there a way to find out of a unit is hostile or not?

    Thanks,
    Bapes.

    If a Unit is Hostile
  2. #2
    ddebug's Avatar Contributor
    Reputation
    114
    Join Date
    Sep 2010
    Posts
    117
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Bapetoven View Post
    Is there a way to find out of a unit is hostile or not?

    Thanks,
    Bapes.
    You can use this: API UnitIsEnemy - WoWWiki - Your guide to the World of Warcraft

  3. #3
    Bapetoven's Avatar Private
    Reputation
    1
    Join Date
    Sep 2010
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a way without lua?

  4. #4
    ddebug's Avatar Contributor
    Reputation
    114
    Join Date
    Sep 2010
    Posts
    117
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Compare unit x's "UNIT_FIELD_FACTIONTEMPLATE" with unit y's "UNIT_FIELD_FACTIONTEMPLATE".

    If they match, they are friendly. If they are 14 (which I believe is friendly to all), they are also friendly. There are probably some other flags to check to make sure they are friendly/not attackable (like neutral), but I don't know what they are off the top of my head.

    To check hostile, it is everything that friendly is not.

    But, the lua function is better to use, imo. It will save you all the troubles of storing friendly and hostile faction id's of the player. Plus, depending on reputation, you may be friendly with a faction like Timbermaw Hold or not.

    tl;dr Use the lua function.
    Last edited by ddebug; 10-19-2010 at 06:02 PM.

  5. #5
    Neverhaven's Avatar Member
    Reputation
    12
    Join Date
    Sep 2009
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ofcourse there is, reverse the lua function, and find the internal function calls.

  6. #6
    Neffarian's Avatar Member
    Reputation
    -5
    Join Date
    Sep 2006
    Posts
    53
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do like

    int orcs = UNIT_FIELD_FACTIONTEMPLATE.GetInt();
    then like

    if(orcs || trolls || hellhound = 14)


    or
    for combat loop
    combat()
    {
    if(orc)
    {
    engage true;

    }
    }

  7. #7
    ddebug's Avatar Contributor
    Reputation
    114
    Join Date
    Sep 2010
    Posts
    117
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Neffarian View Post
    do like

    int orcs = UNIT_FIELD_FACTIONTEMPLATE.GetInt();
    then like

    if(orcs || trolls || hellhound = 14)


    or
    for combat loop
    combat()
    {
    if(orc)
    {
    engage true;

    }
    }
    Your code makes no sense.

  8. #8
    Neffarian's Avatar Member
    Reputation
    -5
    Join Date
    Sep 2006
    Posts
    53
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i was telling you how to go about it, not copy and paste lol

  9. #9
    ddebug's Avatar Contributor
    Reputation
    114
    Join Date
    Sep 2010
    Posts
    117
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Neffarian View Post
    i was telling you how to go about it, not copy and paste lol
    It STILL makes no sense.

    Each race of the Horde will have the same faction id. Each race of the Alliance will have the same faction id. So, I don't know why you include "orcs, trolls". And, also, what in the world is a hellhound faction? There is no such thing. Most NPC units fall under the same hostile faction (whether they are Deadly Chickens or Flying Boars or Hellhounds) [that is one reason why most don't go around attacking each other in game].

  10. #10
    andy012345's Avatar Active Member
    Reputation
    59
    Join Date
    Oct 2007
    Posts
    124
    Thanks G/R
    0/7
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Theres a bunch of masks for hostility and friendliness in the faction templates. Then you have to take into account reputation effects on it, then you have to check the PLAYER_FLAGS of yourself against the flags of the faction template (for anti pvp guards).

    Yeh.. use the lua

  11. #11
    caytchen's Avatar Contributor
    Reputation
    138
    Join Date
    Apr 2007
    Posts
    162
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did any of you ever bother to look at the UnitIsEnemy API in question? Its nothing more than a wrapper around CGUnit_C__UnitReaction, which you can safely call from your own code. No need to go through Lua for this one.

  12. #12
    mazer's Avatar Member Authenticator enabled
    Reputation
    11
    Join Date
    Sep 2007
    Posts
    69
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    check this: http://www.mmowned.com/forums/world-...treaction.html
    or this: GetUnitReaction « Shynd’s WoW Modification Journal

    may have to be updated for 4.0.1 but i guess it'll work fine.
    tried it myself, but no luck yet. (don't have enough time to look deeper into it)

  13. #13
    mazer's Avatar Member Authenticator enabled
    Reputation
    11
    Join Date
    Sep 2007
    Posts
    69
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    modifyied shynd's code, but getting strange values. sometimes players appear as friendly, sometimes as hostile. (or even returns of 0 / -1).
    if someone figures this out for 4.0.1 (or some other way to check if the target is hostile - out of process) and could give me / us some hints, i would be very thankful

    if i find a way by my own, i will post it here.

  14. #14
    rafalsk's Avatar Active Member
    Reputation
    17
    Join Date
    Jul 2009
    Posts
    194
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when you look at the Shynd's code all you need to do is copy&paste. Then what you need to do is to update 3 offsets from what I remember. Keep in mind that now you need to calculate offset from WoW.exe module base.
    Here's how to find these offsets using OllyDbg (still can't get used myself to IDA, though I like it's visualisation and pseudocode;])
    PUSH EBP
    MOV EBP,ESP
    MOV EAX,ANY
    MOV ECX,ANY <=factionIndex
    CMP EAX,ECX
    PUSH EBX
    PUSH ESI
    MOV ESI,ANY <=factionPointer
    PUSH EDI
    MOV EDI,ANY <=totalFactions
    JL ANY
    CMP EAX,EDI
    JG ANY
    SUB EAX,ECX
    MOV EBX,ANY
    JMP ANY
    XOR EBX ,EBX
    MOV EAX,ANY
    MOV EDX,ANY
    MOV EAX,ANY
    CMP EAX,ECX
    JL ANY
    CMP EAX,EDI*/
    use the search function in OllyDbg to find this function, it hasn't changed for long, the offsets are described which is which in here. How to calculate the offset to use in the 4.0.1. Read the offset it says, substract the current offset of main module, you are done.bye;]

    and then..wrap the result of calculation in a nice enum
    public enum eGCUnitReaction
    {
    Hostile =1,
    Neutral = 3,
    Friendly =4,
    Unknown=0
    }
    lOL:P
    Last edited by rafalsk; 10-21-2010 at 10:59 AM.

  15. #15
    Neffarian's Avatar Member
    Reputation
    -5
    Join Date
    Sep 2006
    Posts
    53
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Each race of the Horde will have the same faction id. Each race of the Alliance will have the same faction id. So, I don't know why you include "orcs, trolls". And, also, what in the world is a hellhound faction? There is no such thing. Most NPC units fall under the same hostile faction (whether they are Deadly Chickens or Flying Boars or Hellhounds) [that is one reason why most don't go around attacking each other in game].
    holy **** dude, go copy game deception and make pay cheats more k thanks

    its an example of what to do, not a tutorial.. if you cant figure out what im saying, go ragequit your wrists with a boxcutter...

Page 1 of 2 12 LastLast

Similar Threads

  1. Firefox Lovers Unite
    By Hammyster in forum Community Chat
    Replies: 5
    Last Post: 07-03-2007, 12:17 PM
  2. england claims united states!
    By CCX5 in forum Community Chat
    Replies: 15
    Last Post: 05-18-2007, 04:23 PM
  3. fellow hackers unite!!!
    By Archelf in forum World of Warcraft General
    Replies: 2
    Last Post: 02-23-2007, 07:47 AM
  4. Need a mod that hides Standard blizz Unit Frames
    By Sikonosos in forum World of Warcraft General
    Replies: 1
    Last Post: 01-26-2007, 07:27 PM
All times are GMT -5. The time now is 06:51 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search