Hello,
I am trying to create a button that functions for the functions of the Unit frames. I recreated unit frames in weakauras, but wanted some of the functionality to remain. I've been looking on the internet, and know the TargetUnit() function no longer is usable for self targeting. My issue is finding a workaround to that to help me targeting myself. I have the menu functions to work and everything works, but I just can't target myself. I've been working with the frame:SetAttribute functions to try and set a macro text to target the player, but can't quite get it figured out. Here is the code I have so far.
Code:
local PlayerMenu = CreateFrame("Button", "PlayerMenu", UIParent, "SecureActionButtonTemplate")
PlayerMenu:SetAlpha(0)
PlayerMenu:SetWidth(82)
PlayerMenu:SetHeight(25)
PlayerMenu:SetPoint("CENTER",nil, "CENTER", -357, -74)
PlayerMenu:SetNormalTexture("Interface\\CHATFRAME\\CHATFRAMEBACKGROUND")
PlayerMenu:RegisterForClicks("LeftButtonUp", "RightButtonUp")
PlayerMenu:SetScript("OnClick", function(self, button)
if button == "LeftButton" then
PlayerMenu:SetAttribute("unit", "player")
PlayerMenu:SetAttribute("type", "target")
elseif button == "RightButton" then
ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "PlayerMenu", 0, -15)
end
end)
Thanks in advance!