Quantcast Making my own BossFrames with XML - Need help with show states - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-28-18, 11:25 PM   #1
A Deviate Faerie Dragon
Join Date: May 2007
Posts: 14
Making my own BossFrames with XML - Need help with show states

Since it seems I cannot move the default Boss1TargetFrame without running in to issues in combat, I've just decided to recreate the boss frames in XML with BossTargetFrameTemplate. XML is uncharted territory for me, so be gentle.

I have essentially gotten the frames to look how I want them to look, and function how I want them to function with the exception of their show state.

I can get them to hide when there's no bosses around, but I cannot get them to mirror the "normal" bossframes, especially when more than 1 boss gets pulled.

Here is my current code:

Basic XML

<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
	<Script file="mBossframes.lua"/>
	<Button name="mBoss1TargetFrame" inherits="BossTargetFrameTemplate" id="1">
			<Anchor point="TOPRIGHT" x="-310" y="-510"/>
	<Button name="mBoss2TargetFrame" inherits="BossTargetFrameTemplate" id="2">
			<Anchor point="TOPLEFT" relativeTo="mBoss1TargetFrame" relativePoint="BOTTOMLEFT" x="0" y="-30"/>
	<Button name="mBoss3TargetFrame" inherits="BossTargetFrameTemplate" id="3">
			<Anchor point="TOPLEFT" relativeTo="mBoss2TargetFrame" relativePoint="BOTTOMLEFT" x="0" y="-30"/>
	<Button name="mBoss4TargetFrame" inherits="BossTargetFrameTemplate" id="4">
			<Anchor point="TOPLEFT" relativeTo="mBoss3TargetFrame" relativePoint="BOTTOMLEFT" x="0" y="-30"/>
	<Button name="mBoss5TargetFrame" inherits="BossTargetFrameTemplate" id="5">
			<Anchor point="TOPLEFT" relativeTo="mBoss4TargetFrame" relativePoint="BOTTOMLEFT" x="0" y="-30"/>
And Lua:

Lua Code:
  1. function IsBossFrameShown()
  2.     for i = 1, MAX_BOSS_FRAMES do
  3.     local b = _G["Boss"..i.."TargetFrame"]
  4.         if b and b:IsShown() then
  5.           return true
  6.         end
  7.     end
  8.     return false
  9. end
  11. function UpdateView()
  12.     for i = 1, MAX_BOSS_FRAMES do
  13.         local t = _G["mBoss"..i.."TargetFrame"]
  14.     if mBoss1TargetFrame:IsShown() and IsBossFrameShown() then
  15.         return
  16.     elseif not mBoss1TargetFrame:IsShown() and IsBossFrameShown() then
  17.         mBoss1TargetFrame:Show()
  18.     elseif (t) then
  19.             t:Hide()
  20.     end
  21.     end
  22. end
  24. for i = 1, MAX_BOSS_FRAMES do
  25.     local b = _G["Boss"..i.."TargetFrame"]
  26.     b:HookScript("OnShow",function() UpdateView() end)
  27.     b:HookScript("OnHide",function() UpdateView() end)
  28. end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Making my own BossFrames with XML - Need help with show states

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