I'm a n00b and I can't find the answer to this anywhere. I'd like to know if it is possible to get the unitid in the COMBAT_LOG_EVENT_UNFILTERED event. Basically I'd like to be able to use the UnitIs* functions against the source. So I was thinking one could convert either sourceGUID or sourceName to a unitid but I'm beginning to think this is not possible. Any ideas?
If the unit you're trying to check is a member of your party/raid, you can just use the name as a parameter for the Unit* functions. If its not, you'll have to scan all possible units and compare GUIDs and/or names.
If the unit you're trying to check is a member of your party/raid, you can just use the name as a parameter for the Unit* functions. If its not, you'll have to scan all possible units and compare GUIDs and/or names.
I'm not really concerned with friendly units. So what do I compare them against?
What I'm trying to find out are things like UnitIsEnemy and UnitIsPVP when the unit is not a member of a party/raid, pet, npc or myself. I know you can tell from the GUID whether or not it is a player, npc or pet, but I'm not sure how to find out how to tell if it is an enemy or flagged PVP. I see Blizzard provides functions for this, but they require a unitid and I'm just not sure how to get it from the COMBAT_LOG_EVENT_UNFILTERED event or if it is possible.
You can check if a player is an enemy using the Flags, for example the unit would be an enemy (hostile) player if following flags are set:
COMBATLOG_OBJECT_AFFILIATION_OUTSIDER
COMBATLOG_OBJECT_REACTION_HOSTILE
COMBATLOG_OBJECT_CONTROL_PLAYER
COMBATLOG_OBJECT_TYPE_PLAYER
Sadly there is no reliable way to get a real unit id from an CombatLog event.
If it helps, you could look at the code for MrBigglesworthDeath, found on Curse, and see how I got the unitID (with help from Cladhaire and OrionShock).
If it helps, you could look at the code for MrBigglesworthDeath, found on Curse, and see how I got the unitID (with help from Cladhaire and OrionShock).
Thank you. I did take a look and it looks like your code assumes you already know the guid of the user your looking for, in your case Mr. Bigglesworth. In my case, I wouldn't know that because these would be live players within the game. I think I'm probably going to have to do something along the lines of Nevcairiel's suggestion. But thank you for your help. I guess Blizzard just doesn't want you to know to much about enemy players.
I'm not sure that you even need to use GUIDs if all you're concerned about are players. GUIDs were implemented to help deal with multiple mobs of the same name. Player names are already unique per server so you should be able to use the SourceName argument of the C_L_E_U to get a player name. That said, it's important to remeber that any function that takes a UnitID will only accept a player name if they're in your party/raid. Otherwise you'll be stuck using the basic UnitIDs described here: http://www.wowwiki.com/UnitId
Just out of curiousity, what is the end result that you're trying to accomplish?
Just out of curiousity, what is the end result that you're trying to accomplish?
Thanks for your reply. Well I'd like to write an addon. What I'd like to do has already been done before, but the point is I'd like to do one myself just for the sake of doing it and calling it my own. What I'd like to do is create monitor that will write to the chat log and play a sound when an enemy player that is flagged PVP is in my vicinity. So I started researching how to accomplish this and found these API's (http://www.wowwiki.com/World_of_Warcraft_API#Unit_Functions) It looked like it would be easy to monitor the combat log, then pass player names to UnitIsEnemy and UnitIsPVP and be done with it. But as you say, you can only pass player names to these API's when they are in your party/raid so I guess I'm gonna have to check the flags as suggested by Nevcairiel to get the information I want. It's a shame because it looked like it could be done so easily.
I'm sure someone will correct me, but wouldn't checking CLEU for anything pvp related require the opposing player to actually do something that would show up in the combat log? If the player is just moving by you, then no entry in CLEU, and then what?
Now, if he casts, uses an item, or whatever, then maybe.
I'm sure someone will correct me, but wouldn't checking CLEU for anything pvp related require the opposing player to actually do something that would show up in the combat log? If the player is just moving by you, then no entry in CLEU, and then what?
Now, if he casts, uses an item, or whatever, then maybe.
Yes, that is my understanding. You could potentially have a PVP flagged enemy unit walk right past you completely undetected. However, I didn't find an event that fired when a unit was in a players vicinity. Ideally there would be a UNIT_IN_VICINITY that passed a unitid and coordinates of the unit, but since this doesn't exist (at least I haven't found it) then I think this is the next best thing. If you know of a better way, I'm all ears, err, eyes :)
In addition though I am going to monitor the mouse over event as well which should increase the chance of finding these players.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm not really concerned with friendly units. So what do I compare them against?
What I'm trying to find out are things like UnitIsEnemy and UnitIsPVP when the unit is not a member of a party/raid, pet, npc or myself. I know you can tell from the GUID whether or not it is a player, npc or pet, but I'm not sure how to find out how to tell if it is an enemy or flagged PVP. I see Blizzard provides functions for this, but they require a unitid and I'm just not sure how to get it from the COMBAT_LOG_EVENT_UNFILTERED event or if it is possible.
COMBATLOG_OBJECT_AFFILIATION_OUTSIDER
COMBATLOG_OBJECT_REACTION_HOSTILE
COMBATLOG_OBJECT_CONTROL_PLAYER
COMBATLOG_OBJECT_TYPE_PLAYER
Sadly there is no reliable way to get a real unit id from an CombatLog event.
Thank you. I did take a look and it looks like your code assumes you already know the guid of the user your looking for, in your case Mr. Bigglesworth. In my case, I wouldn't know that because these would be live players within the game. I think I'm probably going to have to do something along the lines of Nevcairiel's suggestion. But thank you for your help. I guess Blizzard just doesn't want you to know to much about enemy players.
Just out of curiousity, what is the end result that you're trying to accomplish?
Thanks for your reply. Well I'd like to write an addon. What I'd like to do has already been done before, but the point is I'd like to do one myself just for the sake of doing it and calling it my own. What I'd like to do is create monitor that will write to the chat log and play a sound when an enemy player that is flagged PVP is in my vicinity. So I started researching how to accomplish this and found these API's (http://www.wowwiki.com/World_of_Warcraft_API#Unit_Functions) It looked like it would be easy to monitor the combat log, then pass player names to UnitIsEnemy and UnitIsPVP and be done with it. But as you say, you can only pass player names to these API's when they are in your party/raid so I guess I'm gonna have to check the flags as suggested by Nevcairiel to get the information I want. It's a shame because it looked like it could be done so easily.
Now, if he casts, uses an item, or whatever, then maybe.
Yes, that is my understanding. You could potentially have a PVP flagged enemy unit walk right past you completely undetected. However, I didn't find an event that fired when a unit was in a players vicinity. Ideally there would be a UNIT_IN_VICINITY that passed a unitid and coordinates of the unit, but since this doesn't exist (at least I haven't found it) then I think this is the next best thing. If you know of a better way, I'm all ears, err, eyes :)
In addition though I am going to monitor the mouse over event as well which should increase the chance of finding these players.