WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Start Duel Event (https://www.wowinterface.com/forums/showthread.php?t=58497)

gnulk 12-29-20 03:37 AM

Start Duel Event
 
Looking for a way to know when i accept a duel request, or my opponent's does. Also my opponent's name.


Best i've found is DUEL_REQUESTED event but is not really what i am lookin for.

Any ideas?

gnulk 12-29-20 07:35 AM

Solved
 
So i figured it out, here is the snippet using 3 events.



Lua Code:
  1. -- A player has requested to duel me
  2. function Duelist:DUEL_REQUESTED(event, playerName)
  3.     opponentName = playerName
  4.     duelingOn = true
  5.  end
  6.  
  7.  --I requested a duel to my target
  8.  function Duelist:CHAT_MSG_SYSTEM(event, text)
  9.     if string.find(text, _G.ERR_DUEL_REQUESTED ) then
  10.         if (UnitExists("target")) then
  11.             duelingOn = true
  12.             opponentName = UnitName("target")
  13.         end
  14.     end
  15.  end
  16.  
  17.   -- The duel finished or was canceled
  18.   function Duelist:DUEL_FINISHED(event)
  19.     opponentName = ""
  20.     duelingOn = false
  21.   end


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

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