Thread Tools Display Modes
08-10-09, 02:52 PM   #1
Onstriker
A Defias Bandit
Join Date: Aug 2009
Posts: 3
Lua code help.

I just got this addon to mark the targets with Shadowbeacon on the yogg saron fight, however Id like to test this addon before going in there, I tried changed the getspellinfo to something like Greater blessing of kings(the id of course) and go in a raid with a friend of mine and mouse over him but it did not mark the target.

I'm pretty new to lua so id appreciate some help.


local buffName = GetSpellInfo(64465) --64465
local iconIndex = 0
local firstIcon = 1
local iconNumber = 5

local function UpdateUnit(unit)
if UnitExists(unit) then

local hasBuff = UnitAura(unit, buffName)
local icon = GetRaidTargetIndex(unit) or 0
local hasIcon = (icon >= firstIcon) and (icon < firstIcon + iconNumber)

if hasBuff and not hasIcon then
SetRaidTarget(unit, firstIcon + iconIndex)
iconIndex = (iconIndex + 1) % iconNumber
elseif hasIcon and not hasBuff then
SetRaidTarget(unit, 0)
end

end
end

function ShadowBeacon_OnLoad()
if GetNumRaidMembers() ~= 0 then
this:RegisterEvent("PLAYER_TARGET_CHANGED");
this:RegisterEvent("UPDATE_MOUSEOVER_UNIT");
end
end

function ShadowBeacon_OnEvent(event)
if event == "PLAYER_TARGET_CHANGED" then
UpdateUnit('target')
elseif event == "UPDATE_MOUSEOVER_UNIT" then
UpdateUnit('mouseover')
end
end
  Reply With Quote
08-10-09, 03:15 PM   #2
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Code:
function ShadowBeacon_OnLoad()
if GetNumRaidMembers() ~= 0 then
this:RegisterEvent("PLAYER_TARGET_CHANGED");
this:RegisterEvent("UPDATE_MOUSEOVER_UNIT");
end
end
If you're not in a raid before the addon is loaded, the events will never be registered.
  Reply With Quote
08-10-09, 03:18 PM   #3
Onstriker
A Defias Bandit
Join Date: Aug 2009
Posts: 3
So i have to login already in a raid or /reloadui after I joined a raid?
  Reply With Quote
08-10-09, 03:22 PM   #4
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Yep, reload would work.
  Reply With Quote
08-10-09, 03:31 PM   #5
Onstriker
A Defias Bandit
Join Date: Aug 2009
Posts: 3
worked, thank you very much.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua code help.


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