Thread Tools Display Modes
04-28-08, 12:38 PM   #1
Nopskillz
A Kobold Labourer
Join Date: Apr 2008
Posts: 1
Totems - GUID in Lua scripts

Hello all,

Just curious if anyone off hand knows how to determine if a totem was cast by the player or not.

Right now I'm registering for the COMBAT_LOG_EVENT_UNFILTERED command to do some processing when a grounding totem is destroyed.

I'm able to easily use the "eventType" and "destName" variables passed in to determine if damage was dealt to a Grounding Totem. The only problem is if there are multiple Grounding Totems out there, (eg. I cast one, an enemy casts one, and another friendly Shaman casts one), I am unable to determine if the totem was mine or not.

I'm sure I'm supposed to use the destFlags variable, but I'm no pro at understanding how this variable is constructed.

Any advice/tips would be much appreciated.
  Reply With Quote
04-28-08, 01:32 PM   #2
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
i think you want COMBATLOG_OBJECT_AFFILIATION_MINE

edit: or to be more exact

Code:
if CombatLog_Object_IsA(destFlags, COMBATLOG_OBJECT_AFFILIATION_MINE) then
    --destination is either you, your totem, your pet, etc.
end

Last edited by Akryn : 04-28-08 at 01:36 PM.
  Reply With Quote
04-28-08, 02:39 PM   #3
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
That method might work to get the immediate owner of a totem, but I would recommend caching it instead right away when the totem is created. The reason for this is you may later wish to get the owner of an elemental, but elementals are treated as being owned by the spawning totem, not the owner of that totem.

So when a totem is planted, you should add it to a table like:
totems[srcGUID] = PlayerGUID (or PlayerName if you prefer)

Then when an elemental is spawned from a totem, you can simply do this:
elemental[destGUID] = totems[srcGUID]

Which should technically link that specific elemental to the owner of the totem that spawned it...
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Totems - GUID in Lua scripts

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off