+ Reply to Thread
Results 1 to 5 of 5

Thread: Help with unit buffs pls

  1. #1
    Rift Chaser Ferather's Avatar
    Join Date
    Jun 2011
    Posts
    341

    Default Help with unit buffs pls

    Cant get this to work

    Code:
    function Myaddon.Event.Add(params)
    	local Player = Inspect.Unit.Detail("player")
    	local Buffs = Inspect.Buff.List("player")
    	local Buff = Inspect.Buff.Detail("player", Buffs)
    	
    	if Buff.name == "Void" then
    		print("Working")
    		text = Player.name .. " Has "
    		MyAddon.UI.Warning:Debuff(text)
    	end
    end
    Does not do anything when I buff void :9

  2. #2
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    So it looks like you're missing a step there.

    Code:
    local Buff = Inspect.Buff.Detail("player", Buffs)
    Is actually giving you a table of buff details, all the buff details that are on the "player"

    So to accomplish what you are trying to do here do something like this:

    Code:
            local Player = Inspect.Unit.Detail("player")
            local Buffs = Inspect.Buff.List("player")
    	local BuffsDetails = Inspect.Buff.Detail("player", Buffs)
    	for k,v in pairs(BuffsDetails) do
                    local thisBuff = Inspect.Buff.Detail("player", k)
    	        if thisBuff.name == "Void" then
    		        print("Working")
    		        text = Player.name .. " Has "
    		        MyAddon.UI.Warning:Debuff(text)
    	        end
            end
    I'm still new to this as well, but I do believe that will work.

  3. #3

  4. #4
    Rift Chaser Ferather's Avatar
    Join Date
    Jun 2011
    Posts
    341

    Default hmm ok new problem

    cant get is to show my stacks :S using Pact as my example:

    Code:
    function MyAddon.Event.Add()
    	local Player = Inspect.Unit.Detail("player")
    	local Buffs = Inspect.Buff.List("player")
    	local BuffsDetails = Inspect.Buff.Detail("player", Buffs)
    
    	for k,v in pairs(BuffsDetails) do
    		local Buff = Inspect.Buff.Detail("player", k)
    		if Buff == "Pact" then
    			if Buff.stacks == nil then
    				Stacks = ""
    			else
    				Stacks = Buff.stacks
    			end
    			text = Player.name .. " Has " .. Buff.name .. Stacks
    			MyAddon.UI.Warning:Debuff(text)
    		end
    	end
    end

  5. #5
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    stacks isn't the right member

    use:

    Code:
    Buff.stack
    Last edited by Aluzja; 12-02-2011 at 11:04 AM.

+ Reply to Thread

Bookmarks

Posting Permissions

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