Quantcast
WoWInterface - View Single Post - WeakAura trigger when attempting to mount
View Single Post
01-17-21, 10:36 AM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 578
You're in the right direction. The way that maw mount counter works is that it loops through all of your mounts and saves each spell ID when it loads, then listens for UNIT_SPELLCAST_SENT and compares the spell ID in that event with the list of known spell IDs. I'll give you the bare basics.

Make a new icon weakaura, go to Actions tab, click Custom at the top (OnInit), and put this in the box:

Lua Code:
  1. aura_env.mountSpells = {}
  2.  
  3. for i, mountID in pairs(C_MountJournal.GetMountIDs()) do
  4.     -- 1304 is Mawsworn Soulhunter and 1442 is Corridor Creeper
  5.     -- they work in the Maw, so ignore them
  6.     if mountID ~= 1304 and mountID ~= 1442 then
  7.         local _, spellID = C_MountJournal.GetMountInfoByID(mountID)
  8.         aura_env.mountSpells[spellID] = true
  9.     end
  10. end

Then select Custom > Event in the Trigger tab and put this in the box:

Lua Code:
  1. function(_, unit, _, _, spellID)
  2.     return unit == "player" and aura_env.mountSpells[spellID]
  3. end

The event you'll be putting in the small box above that is UNIT_SPELLCAST_SENT and you should see a timed box right below the custom trigger function where you can play with the time it spends shown.

Finally, in the Load tab, scroll down to Zone ID and use 1543 which is the Maw.

Last edited by Kanegasi : 01-17-21 at 10:41 AM. Reason: oops
  Reply With Quote