WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Totems - GUID in Lua scripts (https://www.wowinterface.com/forums/showthread.php?t=16098)

Nopskillz 04-28-08 12:38 PM

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.

Akryn 04-28-08 01:32 PM

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


Beladona 04-28-08 02:39 PM

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...


All times are GMT -6. The time now is 10:45 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI