Jump to content

  • Curse Sites
Help

Party Trinkets


  • Please log in to reply
8 replies to this topic

#1 Upvote

Upvote
  • Members
  • Orcclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 6
  • Talents: Fury 0/1/2/0/1/1
  • 2v2: 1544
  • 3v3: 2034
  • 5v5: 2105
  • RBG: 1937

Posted 07 November 2013 - 08:05 PM

I have seen this requested many times with no answer.. Someone was nice enough to help me figure it out so I will pass it along. Here are the scripts for tracking party member trinkets. First code will be for Blizzard Raid style unit frames and the second one will be for normal party frames.

Raid Style
local trinkets = {}
local events = CreateFrame("Frame")
function events:ADDON_LOADED()
	 if IsAddOnLoaded("Blizzard_RaidUI") and #trinkets == 0 then
			 local partyFrame, trinket
			 for i = 1, MAX_PARTY_MEMBERS do
					 partyFrame = "CompactPartyFrameMember"..i
					 trinket = CreateFrame("Cooldown", partyFrame.."Trinket")
					 trinket:SetPoint("TOPRIGHT", partyFrame, 30, -6)
					 trinket:SetSize(24, 24)
					 trinket.icon = trinket:CreateTexture(nil, "BACKGROUND")
					 trinket.icon:SetAllPoints()
					 trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_02")
					 trinket:Hide()
					 trinkets["party"..i] = trinket
			 end
	 end
end
function events:UNIT_SPELLCAST_SUCCEEDED(unitID, spell, rank, lineID, spellID)
	 if not trinkets[unitID] then
			 return
	 end
	 if spellID == 59752 or spellID == 42292 then
			 CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 120, 1)
	 elseif spellID == 7744 then
			 CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 45, 1)
	 end
end
function events:PLAYER_ENTERING_WORLD()
	 self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
	 for _, trinket in pairs(trinkets) do
			 trinket:SetCooldown(0, 0)
			 trinket:Hide()
	 end
end
events:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
events:RegisterEvent("PLAYER_ENTERING_WORLD")
events:RegisterEvent("ADDON_LOADED")

Normal Party style
local trinkets = {}
local events = CreateFrame("Frame")
local partyFrame, trinket
for i = 1, MAX_PARTY_MEMBERS do
partyFrame = "PartyMemberFrame"..i
trinket = CreateFrame("Cooldown", partyFrame.."Trinket")
trinket:SetPoint("TOPRIGHT", partyFrame, 30, -6)
trinket:SetSize(24, 24)
trinket.icon = trinket:CreateTexture(nil, "BACKGROUND")
trinket.icon:SetAllPoints()
trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_02")
trinket:Hide()
trinkets["party"..i] = trinket
end
function events:UNIT_SPELLCAST_SUCCEEDED(unitID, spell, rank, lineID, spellID)
if not trinkets[unitID] then
return
end
if spellID == 59752 or spellID == 42292 then
CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 120, 1)
elseif spellID == 7744 then
CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 45, 1)
end
end
function events:PLAYER_ENTERING_WORLD()
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
for _, trinket in pairs(trinkets) do
trinket:SetCooldown(0, 0)
trinket:Hide()
end
end
events:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
events:RegisterEvent("PLAYER_ENTERING_WORLD")


#2 jaimex

jaimex
  • Premium Junkies
  • Dwarfclass_name
  • EU-Outland
  • Misery
  • Posts: 2017
  • Talents: Elemental 0/2/0/1/0/0/.
  • 2v2: 1743
  • 3v3: 3121
  • 5v5: 864

Posted 07 November 2013 - 09:48 PM

im a noob, how do i put these in macros? xD or?

#3 Upvote

Upvote
  • Members
  • Orcclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 6
  • Talents: Fury 0/1/2/0/1/1
  • 2v2: 1544
  • 3v3: 2034
  • 5v5: 2105
  • RBG: 1937

Posted 07 November 2013 - 09:53 PM

In the pinned Default Script's there is an explanation on how to create an addon. It's actually very simple. The code above goes in the LUA file. I was intimidated as well but it's very very simple.

#4 jaimex

jaimex
  • Premium Junkies
  • Dwarfclass_name
  • EU-Outland
  • Misery
  • Posts: 2017
  • Talents: Elemental 0/2/0/1/0/0/.
  • 2v2: 1743
  • 3v3: 3121
  • 5v5: 864

Posted 07 November 2013 - 10:16 PM

thanks xoxo

#5 killswitchx

killswitchx
  • Members
  • Humanclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 20
  • Talents: Shadow

Posted 08 November 2013 - 11:25 AM

doesn't seem to work, Any idea? --- , can i test outside of arena? could you post a screenshot. this addon sounds awesome

#6 Upvote

Upvote
  • Members
  • Orcclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 6
  • Talents: Fury 0/1/2/0/1/1
  • 2v2: 1544
  • 3v3: 2034
  • 5v5: 2105
  • RBG: 1937

Posted 09 November 2013 - 01:15 AM

I followed the instructions for building an addon that is in the default ui scripts sticky. Here is a link to the addon I built. All that is in it is the Raid style unit frames code, and the target/focus unit frame dual wield icons showing when someone is in combat.

http://www.mediafire...e/YourAddon.zip

Here is a Screen shot of what the trinket script looks like and what the sword icons look like.

http://imgur.com/bZBNECL

#7 killswitchx

killswitchx
  • Members
  • Humanclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 20
  • Talents: Shadow

Posted 09 November 2013 - 07:56 AM

Thank you:D

#8 speed350z

speed350z
  • Members
  • Posts: 12

Posted 09 November 2013 - 10:15 PM

thannk you

#9 Cptfan

Cptfan
  • Members
  • Posts: 1

Posted 23 July 2014 - 04:53 AM

Hey. it dosen't work for me. can you fix it somehow?

I use the raid style



Date: 2014-07-23 06:40:12
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\YourAddon\YourAddon.lua line 41:
   CompactPartyFrameMember1Trinket:SetPoint(): Couldn't find region named 'CompactPartyFrameMember1'
Debug:
   [C]: SetPoint()
   YourAddon\YourAddon.lua:41:
      YourAddon\YourAddon.lua:35
   (tail call): ?
   [C]: LoadAddOn()
   ..\FrameXML\UIParent.lua:306: UIParentLoadAddOn()
   ..\FrameXML\UIParent.lua:352: RaidFrame_LoadUI()
   ..\FrameXML\RaidFrame.lua:61:
      ..\FrameXML\RaidFrame.lua:52
Locals:
(*temporary) = CompactPartyFrameMember1Trinket {
0 = <userdata>
}
(*temporary) = "TOPRIGHT"
(*temporary) = "CompactPartyFrameMember1"
(*temporary) = 30
(*temporary) = -6




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

<