Quantcast
castbar help - WoWInterface
Thread Tools Display Modes
12-30-12, 03:12 AM   #1
Taet
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 15
castbar help

First of all, sorry for my English.

I need help as see my cast bar to raid target on that i cast spell (heal).

This my code show cast bar on casting player in raidframe,but i need show player (my) cast bar on raid target.
Code:
raid = function(self, ...)
	Shared(self, ...)
		
			createCastbar(self)
			self.Castbar:SetAllPoints(self.Health)
			
	self.Name:SetFont(cfg.NameFont, cfg.RaidFS, cfg.FontFormatRaid)
	self.Name:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 0, 14)
	self:Tag(self.Name, '[afkdnd][raidcolor][raidhpname]')

.....
  Reply With Quote
12-31-12, 09:52 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
I'm not really sure if I understand your question. Do you want the players castbar to be shown on the raid unit you are healing?

If so: You can't really spawn a player castbar on a raid frame, but you can move the player castbar to the raid frame on OnEnter/Onleave.

Something like:
Lua Code:
  1. OnEnter = function(self)
  2.    -- Move the player castbar to the raid frame we are hovering.
  3.    local castbar = YourPlayerFrame.Castbar
  4.  
  5.    castbar:ClearAllPoints()
  6.    castbar:SetAllPoints(self.Health)
  7. end
  8.  
  9. OnLeave = function(self)
  10.    -- Move the player castbar back to player.
  11.    local castbar = YourPlayerFrame.Castbar
  12.  
  13.    castbar:ClearAllPoints()
  14.    castbar:SetAllPoints(YourPlayerFrame.Health)
  15. end

Remember that you also need to :SetScript() these handlers.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
01-03-13, 09:08 PM   #3
Taet
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 15
Very thanks for your answer.

I have second problem, i begin cast on raid player 1 (onenter), my cast bar is on this player, but when i move mouse (onLeave) on other raid player my cast bar is moved and end animation on this player.

I need, when i begin any cast on raidplayer1, this cast bar ended here when i move mouse over other raidplayers.

Again apologize for my English, and your lost time.
  Reply With Quote
01-06-13, 06:18 PM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
That requires quite a lot more work:
Lua Code:
  1. ReturnCastbar = function()
  2.    -- Move the player castbar back to player.
  3.    local castbar = YourPlayerFrame.Castbar
  4.  
  5.    castbar:ClearAllPoints()
  6.    castbar:SetAllPoints(YourPlayerFrame.Health)
  7. end
  8.  
  9. OnEnter = function(self)
  10.    -- Move the player castbar to the raid frame we are hovering.
  11.    local castbar = YourPlayerFrame.Castbar
  12.  
  13.    castbar.activeFrame = self
  14.    castbar:ClearAllPoints()
  15.    castbar:SetAllPoints(self.Health)
  16. end
  17.  
  18. OnHide = function(self)
  19.    if(castbar.activeFrame == self) then
  20.       ReturnCastbar()
  21.       castbar.activeFrame = nil
  22.    end
  23. end
  24.  
  25. -- on the raid frames:
  26. -- Return the castbar if the unit disappears.
  27. self:HookScript("OnHide", OnHide)
  28.  
  29. -- on the player frame:
  30. -- Force it back when we stop casting.
  31. castbar.PostCastFailed = ReturnCastbar
  32. castbar.PostCastInterrupted = ReturnCastbar
  33. castbar.PostCastStop = ReturnCastbar
  34. castbar.PostChannelStop = ReturnCastbar

Might work.

Edit: No it won't, I'm completely missing the actual problem here being the initial anchoring, followed by re-anchoring when targeting a new unit. I'll throw some time at it tomorrow night or so.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
01-07-13, 11:05 AM   #5
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,697
Try this out

Lua Code:
  1. local queued, casting
  2.  
  3. local OnEnter = function(self)
  4.     if(not casting) then
  5.         local castbar = YourPlayerFrame.Castbar
  6.         castbar:ClearAllPoints()
  7.         castbar:SetAllPoints(self.Health)
  8.     else
  9.         queued = self
  10.     end
  11. end
  12.  
  13. local OnHide = function()
  14.     local castbar = YourPlayerFrame.Castbar
  15.     castbar:ClearAllPoints()
  16.     castbar:SetAllPoints(YourPlayerFrame.Health)
  17. end
  18.  
  19. local CastStarted = function()
  20.     casting = true
  21. end
  22.  
  23. local CastEnded = function()
  24.     if(queued) then
  25.         OnEnter(queued)
  26.         queued = nil
  27.         casting = nil
  28.     else
  29.         OnHide()
  30.     end
  31. end
  32.  
  33. -- on the raid frames:
  34. -- Return the castbar if the unit disappears.
  35. self:HookScript('OnHide', OnHide)
  36. self:HookScript('OnEnter', OnEnter)
  37.  
  38. -- on the player frame:
  39. castbar.PostCastFailed = CastEnded
  40. castbar.PostCastInterrupted = CastEnded
  41. castbar.PostCastStop = CastEnded
  42. castbar.PostChannelStop = CastEnded
  43. castbar.PostCastStart = CastStarted
  44. castbar.PostChannelStart = CastStarted
  Reply With Quote
01-09-13, 07:41 PM   #6
Taet
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 15
P3lim : first cast is on raid frame, but all other is on Player frame.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » castbar help

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off