-
Posted by Guga on Wed, 12 Aug 2009 22:57:02
Hey, I need help with this: Im doing addon that alert me when someone casting skill x on me, but when i tried this in duels, arg7 was always nil (destName), so i cant "filter" skills that targetting only me
Question is: Why is arg7 nil? How to fix it or if theres any other way how to get destName
-
Posted by jnwhiteh on Thu, 13 Aug 2009 02:11:13
That information is not always available. In fact, you cannot get the destination of a spell being cast by a unit using
COMBAT_LOG_EVENT_UNFILTERED
. You can get the information about a character that has a valid unit id using UnitCastingInfo. -
Posted by Guga on Thu, 13 Aug 2009 12:26:45
UnitCastingInfo doesnt return name of target of that spell/skill :S Atleast i dont see it in description. Any other ideas?
-
Posted by jnwhiteh on Thu, 13 Aug 2009 16:51:52
UnitCastingInfo doesnt return name of target of that spell/skill :S Atleast i dont see it in description. Any other ideas?
UnitCastingInfo returns the spell information.. if you don't get the target information then it's not available. Specifically when an enemy tries to cast a spell on one of your friendly units.. you don't really have that information intentionally. You can guess, but that's the best you can do.
-
Posted by fyrye on Wed, 09 Sep 2009 09:34:18
Hey, I need help with this: Im doing addon that alert me when someone casting skill x on me, but when i tried this in duels, arg7 was always nil (destName), so i cant "filter" skills that targetting only me
Question is: Why is arg7 nil? How to fix it or if theres any other way how to get destName
destName is not always returned. Though if the event occurs in the combat log, you should be able to filter the destFlags to determine if the destination is you. EG:
local COMBATLOG_FILTER_MINE = COMBATLOG_FILTER_MINE local COMBATLOG_FILTER_HOSTILE_UNITS = COMBATLOG_FILTER_HOSTILE_UNITS function COMBAT_LOG_EVENT_UNFILTERED(arg1, timestamp, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, spellID, spellName, spellSchool) local fromEnemy, toMe if sourceFlags and not CombatLog_Object_IsA(sourceFlags, COMBATLOG_OBJECT_NONE) then fromEnemy = CombatLog_Object_IsA(destFlags, COMBATLOG_FILTER_HOSTILE_UNITS) end if destFlags and not CombatLog_Object_IsA(destFlags, COMBATLOG_OBJECT_NONE) then toMe = CombatLog_Object_IsA(destFlags, COMBATLOG_FILTER_MINE) end if event == "SPELL_CAST_START" and fromEnemy and toMe and strlower(spellName) == "fireball" then print("ALERT: " .. spellName .. " being cast on you!!") end
Also take note, using destGUI and sourceGUID will provide basically the same results of sourceName and destName as if the source or destination is an enemy player, the information is not readily available to you. Like doing UnitClass("unit") if my characters name is "fyrye" /script print(UnitClass("fyrye")), will work for your name and return your class/localized class but if you use another name it will return nil nil But initially, Bliz wants you to have a target/focus of some form to return specific information about a unit. EG: raid5targettarget if the 5th member of your raid's target is casting that spell on you