1. #1

    Addon to mark specific mob

    Hi,

    I'm looking for some help on writing an addon that will put a raid target marker on a mob with a specific GUID if it is targeted by a raid member at any point. I'd like it so that if one mark is used it will use the next one on the next mob etc etc.

    Do you think this would be easy enough to do? I would appreciate any help with it!

    Thanks!

    www.scrubbusters.com - 12/14HC - Recruiting exceptional players!

  2. #2
    Are these all mobs with the same name? If so they would all be given the same UnitId.

    The identifier is related to how the player is accessing the unit, not the other way around.

    There's some info here: http://wowprogramming.com/docs/api_types#unitID

    Gershuun @ Borean Tundra US - Interface & Macros Moderator

  3. #3
    Yeah so I would need to check raid1target through to raid25target on a frequent basis...I'm guessing that would be quite laggy wouldn't it

    ---------- Post added 2013-03-02 at 12:38 PM ----------

    Is there a way to tell when a raid member sets a mark on a mob? (I used to see a message in chat - "Player sets star on x" for example but don't anymore?)

    Or alternatively a way to see which marks have already been used?

    ---------- Post added 2013-03-02 at 03:07 PM ----------

    Got a working addon now, ty anyway! You can close/delete this thread if needed.

    www.scrubbusters.com - 12/14HC - Recruiting exceptional players!

  4. #4
    The setting for that is in the chat settings, I believe. As for the GUID thing, here's a proof of concept that should work reasonably well:

    Code:
    local updateInterval = 1
    local guids = {
        ["0xF530007EAC083004"] = true
    }
    local IsInRaid, GetNumGroupMembers, UnitGUID, UnitExists, SetRaidTarget =
           IsInRaid, GetNumGroupMembers, UnitGUID, UnitExists, SetRaidTarget
    local currentIndex = 1
    local updateFrame = CreateFrame("Frame")
    updateFrame:Hide()
    updateFrame:SetScript("OnEvent",function(self)
        if IsInRaid() then
            if not self:IsShown() then
                self.elapsed = updateInterval
                self:Show()
        else
            self:Hide()
        end
    end)
    updateFrame:RegsiterEvent("GROUP_ROSTER_UPDATE")
    updateFrame.elapsed = 0
    updateFrame:SetScript("OnUpdate",function(self,elapsed)
        self.elapsed = self.elapsed+elapsed
        if self.elapsed >= updateInterval then
            while self.elapsed >= updateInterval do
                self.elapsed = self.elapsed-updateInterval
            end
            for i=1,GetNumGroupMembers() do
                local tarID = ("raid%dtarget"):format(i)
                if UnitExists(tarID) then
                    local tarGUID = UnitGUID(tarID)
                    if guids[tarGUID] then
                        guids[tarGUID] = false
                        SetRaidTarget(tarID,currentIndex)
                        currentIndex = (currentIndex%8)+1
                    end
                end
            end
        end
    end)
    Should set the next raid target that hasn't been used by the addon yet (wrapping around after 8 (skull)) when the GUID is first encountered.
    I'm not quite sure what you'd want to do with specific GUIDs though, as these are unique every time a mob is spawned. If you want NPC IDs, these can be extracted from the GUID (see this for details).
    Last edited by Treeston; 2013-03-02 at 04:01 PM.
    UI & AddOns expert | Interface & Macros moderator - My work

  5. #5
    Thanks Treeston!

    That's a lot better than my implementation

    What do you think the effects of this might be on my frame rate?

    www.scrubbusters.com - 12/14HC - Recruiting exceptional players!

  6. #6
    It's up to 25 UnitGUID calls a second. It might lose you one or two FPS on lower-end machines, but should not have any noticable effect. If it does, consider increasing the update interval.
    UI & AddOns expert | Interface & Macros moderator - My work

  7. #7
    Just curious at what type of practical use this would have as it sounds interesting.

    Like marking Lei Shi adds?
    Last edited by lawomous; 2013-03-02 at 05:44 PM.

    Gershuun @ Borean Tundra US - Interface & Macros Moderator

  8. #8
    Thanks for the addon

    -PC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •