-
Posted by pladombrowski on Thu, 12 Sep 2013 20:54:20
Hi, im trying to create a single clickable frame with the bg target. I already make some working comunication with ace3 lib :
Select Target and send it to raid:
BgCallTarget = LibStub("AceAddon-3.0"):NewAddon("BgCallTarget", "AceComm-3.0")
BgCallTargetConsole = LibStub("AceConsole-3.0")
function BgCallTargetConsole:CallTarget(input)
local x, y = GetPlayerMapPosition("player")
BgCallTarget:SendCommMessage("callTarget", "" ..UnitName("target"), "RAID")
BgCallTargetConsole:Print("BGCallTarget - Target sent! ")
end
BgCallTargetConsole:RegisterChatCommand("callTarget", "CallTarget")
Listen for new targets:
BgGetTarget = LibStub("AceAddon-3.0"):NewAddon("BgGetTarget", "AceComm-3.0")
function BgGetTarget:OnCommReceived(prefix, message, distribution, sender)
BgCallTargetConsole:Print("New target: " ..message)
end
BgGetTarget:RegisterComm("callTarget")
But i have no clue on how to create the clickable frame with the new target. I've tried a lot of samples but no one done it. I know, its a noob question but im new to wow programing.
-
Posted by jnwhiteh on Thu, 12 Sep 2013 21:03:05
You cannot do it if you are in combat, so if that's your goal...
-
Posted by pladombrowski on Fri, 13 Sep 2013 14:57:36
I can't send the msg's while in combat?
-
Posted by jnwhiteh on Fri, 13 Sep 2013 15:11:48
You can send the messages, you cannot create a frame that will allow you to click on it.
-
Posted by pladombrowski on Fri, 13 Sep 2013 15:35:15
Hummm... I may have to change the context. It would be possible to create the frames of all players on the opposing team as BattleGroundTargets and through mgs leave the target button highlighted?
-
Posted by jnwhiteh on Fri, 13 Sep 2013 15:37:16
Yes, you can always change display (with the exception of size and visibility) based on the current situation, you just can't have 'contextual' buttons, basically.
-
Posted by pladombrowski on Fri, 13 Sep 2013 16:16:43
Thx a lot! I'll try to use bgt addon as base to my addon.
-
Posted by stolenlegacy on Fri, 13 Sep 2013 23:35:49
Essentially, you want to loop through all players on the opposing team using the scoreboard API (most importantly
GetBattlefieldScore
) and create a frame with a /targetexact macrotext attribute for every opponent. Then have code that handles targets joining/leaving the BG and repositions frames accordingly, and make sure you make any target changes in combat merely queue a repositioning onPLAYER_REGEN_ENABLED
. -
Posted by pladombrowski on Wed, 18 Sep 2013 20:36:12
Exactly, that's what Battleground targets already do. I want to use it as base, and trough addonMessages i want to tell other playes who they should attack highlighting the the target name on their screen.