Thread Tools Display Modes
04-21-19, 06:33 PM   #1
bender1453
A Fallenroot Satyr
Join Date: Mar 2019
Posts: 21
Almost done with my UI... I keep having problems but manage to fix them one by one. I'd like to know the answers for these questions though:

1- Can I use KGPanels to completely hide another Unit frame (Pitbull) depending on enemy and player specialization? The idea here is to make different textures for mana and power bar. I can make it show 2 different textures for mana and power bar but when it's a spec with both of them (Ele shaman for example) it shows both of them at the same time and I don't want that. Oh and, pure mana based specs also show the bars twice.

2- I'm trying to make the unit frame show 2 different textures for enemy faction players, depending on their faction. Let's say I have texture H and B, made for the Horde and the Alliance, respectively. I'm on my Alliance character and I'm targeting a Horde player, I want it to show texture H and vice versa for my Horde character. I've tried many scripts regarding this issue but they don't work.

3- Can I use it (or any other addon) to anchor 2 separate frames from different addons so when one of them is moved the other one also follows? This one isn't that important but it helps.


Many thanks in advance.

Last edited by bender1453 : 04-25-19 at 04:19 AM.
  Reply With Quote
04-25-19, 04:18 AM   #2
bender1453
A Fallenroot Satyr
Join Date: Mar 2019
Posts: 21
No one? I can live without the others but at least maybe someone can help me with the 2nd question? I really need to find a way to put a texture for enemy Horde/Alliance players.

Maybe an onLoad script?

local _, faction= UnitFaction("player");
if faction == "horde" then
self:Show()
else
self:Hide()
end

Then another onEvent script for PVP targets. FFA players might provide an issue. I wrote this with what's left in my mind so there must be some errors.
  Reply With Quote
04-25-19, 08:46 AM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
You say "enemy faction players" but don't say if they are changing targets or just fixed or ...

I don't know KG, but something like:

For the frames OnLoad (self or whatever KG uses):
Code:
self:RegisterEvent("PLAYER_TARGET_CHANGED")
For it's OnEvent handler:

Lua Code:
  1. if event == "PLAYER_TARGET_CHANGED" then
  2.     local FactionTextures = {
  3.         Alliance = "Interface\\AddOns\\[TextureLocation]\\AllianceTexture",
  4.         Horde = "Interface\\AddOns\\[TextureLocation]\\HordeTexture",
  5.         Neutral = "Interface\\AddOns\\[TextureLocation]\\NeutralTexture",
  6.     }
  7.     local NoTarget = "Interface\\AddOns\\[TextureLocation]\\NoFactionTexture"
  8.     self:SetTexture(FactionTextures[UnitFactionGroup("target")] or NoTarget)
  9. end

If the textures are for something like arena frames you might use the ARENA_OPPONENT_UPDATE event.

Normally I wouldn't create the table in the event handler each time, it's there as an example. If it can be better placed using KG great, otherwise you can just directly assign the textures based on the faction rather than using the table lookup.

Question 1, You could but you probably wouldn't because it would require all the code of a standalone addon anyway if Pitbul doesn't have the option to change power bar textures based on spec. (I don't know Pitbul either).

Question 3, You should be able to anchor a "panel" in KG to any other frame that is "available" and have them move together. You would need to know the name (/fstack) of the frame (or it's parent/key if it has one and no name). If it has neither, it gets more complicated depending on the frame.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 04-25-19 at 09:52 AM.
  Reply With Quote
04-25-19, 10:45 AM   #4
bender1453
A Fallenroot Satyr
Join Date: Mar 2019
Posts: 21
Much appreciated mate.

What I meant to say was, I have 2 custom made Horde and Alliance symbols. Just like in default UI mine will also display an icon for enemy Horde/Alliance players, I want these icons as these custom textures. If possible I'd like to show an icon for FFA players as well.

About my anchoring question. I was talking about making KGPanels to hide another Addon's frame, so in this case when the anchored texture disappears, I want that frame to disappear as well. So in other words I'm trying to set a condition for target's specialization. Depending on this situation the frame will be hidden. This sounds very complicated though, I'm not sure if this is possible at all.

I'll will try the scripts when I get back to my PC. Thanks again.
  Reply With Quote
04-25-19, 11:21 AM   #5
bender1453
A Fallenroot Satyr
Join Date: Mar 2019
Posts: 21
Okay I tried them.




Message: [string "Horde PVP_OnEvent"]:8: attempt to call method 'SetTexture' (a nil value)
Time: Thu Apr 25 20:12:19 2019
Count: 1
Stack: [string "Horde PVP_OnEvent"]:8: attempt to call method 'SetTexture' (a nil value)
[string "Horde PVP_OnEvent"]:8: in function <[string "Horde PVP_OnEvent"]:1>
[C]: in function `CameraOrSelectOrMoveStop'
[string "CAMERAORSELECTORMOVE"]:4: in function <[string "CAMERAORSELECTORMOVE"]:1>

Locals: self = kgPanel4 {
0 = <userdata>
_backdrop_options = <table> {
}
_GetBackdropColor = <function> defined =[C]:-1
SetBackdropGradientAlpha = <function> defined @Interface\AddOns\kgPanels\Libs\LibBackdrop-1.0\LibBackdrop-1.0.lua:535
_SetBackdrop = <function> defined =[C]:-1
GetBackdropBorderSection = <function> defined @Interface\AddOns\kgPanels\Libs\LibBackdrop-1.0\LibBackdrop-1.0.lua:155
GetBackdropColor = <function> defined =[C]:-1
_backdrop = <unnamed> {
}
_GetBackdropBorderColor = <function> defined =[C]:-1
SetBackdropBorderColor = <function> defined =[C]:-1
bg = <unnamed> {
}
missing_anchor_at_load = false
missing_parent_at_load = false
scripts_loaded = false
SetBackdropBorderGradientAlpha = <function> defined @Interface\AddOns\kgPanels\Libs\LibBackdrop-1.0\LibBackdrop-1.0.lua:568
GetBackdropBackground = <function> defined @Interface\AddOns\kgPanels\Libs\LibBackdrop-1.0\LibBackdrop-1.0.lua:147
text = <unnamed> {
}
_SetBackdropColor = <function> defined =[C]:-1
BorderTextureFunction = <function> defined @Interface\AddOns\kgPanels\Libs\LibBackdrop-1.0\LibBackdrop-1.0.lua:136
SetBackdrop = <function> defined =[C]:-1
GetBackdropBorderColor = <function> defined =[C]:-1
_GetBackdrop = <function> defined =[C]:-1
GetBackdrop = <function> defined =[C]:-1
SetBackdropBorderGradient = <function> defined @Interface\AddOns\kgPanels\Libs\LibBackdrop-1.0\LibBackdrop-1.0.lua:542
_SetBackdropBorderColor = <function> defined =[C]:-1
SetBackdropColor = <function> defined =[C]:-1
SetBackdropGradient = <function> defined @Interface\AddOns\kgPanels\Libs\LibBackdrop-1.0\LibBackdrop-1.0.lua:528
}
event = "PLAYER_TARGET_CHANGED"
arg1 = nil
arg2 = nil
arg3 = nil
arg4 = nil
arg5 = nil
arg6 = nil
arg7 = nil
arg8 = nil
arg9 = nil
arg10 = nil
kgPanels = <table> {
SetDefaultModuleLibraries = <function> defined @Interface\AddOns\Masque\Libs\AceAddon-3.0\AceAddon-3.0.lua:367
FetchFont = <function> defined @Interface\AddOns\kgPanels\kgPanels.lua:385
SetupScript = <function> defined @Interface\AddOns\kgPanels\kgPanels.lua:1018
Enable = <function> defined @Interface\AddOns\Masque\Libs\AceAddon-3.0\AceAddon-3.0.lua:294
RegisterChatCommand = <function> defined @Interface\AddOns\Bartender4\libs\AceConsole-3.0\AceConsole-3.0.lua:85
EnableModule = <function> defined @Interface\AddOns\Masque\Libs\AceAddon-3.0\AceAddon-3.0.lua:332
modules = <table> {
}
GetModule = <function> defined @Interface\AddOns\Masque\Libs\AceAddon-3.0\AceAddon-3.0.lua:210
IterateEmbeds = <function> defined @Interface\AddOns\Masque\Libs\AceAddon-3.0\AceAddon-3.0.lua:442
ResetFont = <function> defined @Interface\AddOns\kgPanels\kgPanels.lua:1000
defaultModuleLibraries = <table> {
}
eframe = kgPanels_Dep_Frame {
}
UnregisterChatCommand = <function> defined @Interface\AddOns\Bartender4\libs\AceConsole-3.0\AceConsole-3.0.lua:111
Printf = <function> defined @Interface\AddOns\Bartender4\libs\AceConsole-3.0\AceConsole-3.0.lua:69
angles = <table> {
}
GetName = <function> defined @Interface\AddOns\Masque\Libs\AceAddon-3.0\AceAddon-3.0.lua:279
AddMissingMedia = <function> defined @Interface\AddOns\kgPanels\kgPanels.lua:470
ReParent = <function> defined @Interface\AddOns\kgPanels\kgPanels.lua:725
name = "kgPanels"
FetchArt = <function> defined @Interface\AddOns\kgPanels\kgPanels.lua:382
IsEnabled = <function> defined @Interface\AddOns\Masque\Libs\AceAddon-3.0\AceAddon-3.0.lua:451
orderedModules = <table> {
}
CommandLine = <function> defined @Interface\AddOns\kgPanels\kgPanels.lua:619
DisableModule = <function> defined @In

I get this error. Every target showed my Horde texture for some reason, and I do mean every target. Even the NPCs or pets. I should have been more specific with this. my apologies. I'd like to explain what I want step by step:

-I want the game to display a custom Horde symbol whenever I target a Horde Player if I'm playing as Alliance.
-I want the game to display a custom Alliance symbol whenever I target an Alliance Player if I'm playing as Horde.
-Lastly I'd also like to show a custom texture for an FFA character.
  Reply With Quote
04-25-19, 12:20 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
I don't know KG so my code was intended as "adjust for use" rather than intended as literal.

The call to "SetTexture" should be replaced by whatever KGPanels uses to dynamically update a panels texture (maybe KG function or some method of determining which element of the panel is the texture widget).

You don't say what (if any) texture you want to display if you are targeting a member of the same faction.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 04-25-19 at 12:23 PM.
  Reply With Quote
04-25-19, 12:41 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The conditions could look something like:
Lua Code:
  1. if event == "PLAYER_TARGET_CHANGED" then
  2.     local FactionTextures = {
  3.         Alliance = "Interface\\AddOns\\[TextureLocation]\\AllianceTexture",
  4.         Horde = "Interface\\AddOns\\[TextureLocation]\\HordeTexture",
  5.         FFA = "Interface\\AddOns\\[TextureLocation]\\NeutralTexture",
  6.     }
  7.     local player = UnitIsPVPFreeForAll("player")
  8.     local target = UnitIsPVPFreeForAll("target")
  9.     if player and target then -- both are FFA, maybe this is all you need.
  10.         -- Set the texture to FactionTextures.FFA
  11.         -- show the frame
  12.         return
  13.     end
  14.     player = UnitFactionGroup("player")
  15.     target = UnitFactionGroup("target")
  16.     if player ~= target and target ~= "Neutral" then
  17.         -- set the texture to FactionTextures[target]
  18.         -- show the frame
  19.     else -- target is same faction or neutral
  20.         -- hide the frame
  21.     end
  22. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
04-25-19, 12:49 PM   #8
bender1453
A Fallenroot Satyr
Join Date: Mar 2019
Posts: 21
Originally Posted by Fizzlemizz View Post
I don't know KG so my code was intended as "adjust for use" rather than intended as literal.

The call to "SetTexture" should be replaced by whatever KGPanels uses to dynamically update a panels texture (maybe KG function or some method of determining which element of the panel is the texture widget).

You don't say what (if any) texture you want to display if you are targeting a member of the same faction.
I am sorry, you are right. I don't want it display any texture if I'm targeting my faction's members.

Last edited by bender1453 : 04-25-19 at 05:50 PM.
  Reply With Quote
04-25-19, 05:54 PM   #9
bender1453
A Fallenroot Satyr
Join Date: Mar 2019
Posts: 21
Actually I do have a working script but it's only for attackable PVP players. I'm thinking about adding an OnLoad script that checks player faction to show the mentioned texture. The only problem is it FFA players. So, if we can eliminate FFA from the conditions it looks like it could work.

if UnitExists("target") == nil then
self:Hide()
return
end
if (UnitIsEnemy("player","target") and UnitIsPlayer("target")) then
self:Show()
else
self:Hide()
end

I'm a super newbie when it comes to this work but I remember seeing "not" operator when there was a condition that needed to be removed.

So for example I was using a Death Knight only frame and it had this condition:

local _, class = UnitClass("player");
if class == "DEATHKNIGHT" then
self:Show()
else
self:Hide()
end

If I can change the values so that it can check for my faction instead of my class, everything should work. Am I wrong here? Am I making any mistakes? Hope I'm not.

Last edited by bender1453 : 04-25-19 at 06:01 PM.
  Reply With Quote
05-18-19, 01:54 PM   #10
bender1453
A Fallenroot Satyr
Join Date: Mar 2019
Posts: 21
I found a workaround for my faction texture problem. Since I'm using STUF Unit Frames I just replaced the default Blizzard textures and activated faction textures in the AddOn. It worked, heh.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » 3 KGPanels related questions, couldn't make them fit in the title

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