Thread Tools Display Modes
11-17-21, 04:49 AM   #1
Clayent
A Murloc Raider
Join Date: Jul 2020
Posts: 7
Question Need help with code of WA

Hi. Please need help with correcting oа this weakaura - https://wago.io/jN4pinl25
I want to add there a feature that will remove dead players from it's list. There are next strings in code:
Code:
-- Maintain player list
if event == "GROUP_ROSTER_UPDATE" then
    
-- Remove
for _, state in pairs(s) do
    local unitName = state.name
    if not UnitInParty(unitName) then
        state.show = false
        state.changed = true
    end
end
What I tried? I added CLEU:UNIT_DIED in events in WA's settings and changed code to:
Code:
-- Maintain player list
if event == "GROUP_ROSTER_UPDATE"
or (subEvent == "UNIT_DIED") then
    
-- Remove
for _, state in pairs(s) do
    local unitName = state.name
    if not UnitInParty(unitName) then
        state.show = false
        state.changed = true
    end
    if UnitIsDead(unitName) then
        state.show = false
        state.changed = true
    end
end
This works but not as wanted. Then I removed more code, leaving only strings for dead players:
Code:
-- Maintain player list
if event == "GROUP_ROSTER_UPDATE"
or (subEvent == "UNIT_DIED") then
    
-- Remove
for _, state in pairs(s) do
    local unitName = state.name
    if UnitIsDead(unitName) then
        state.show = false
        --state.changed = true
    end
end
Again it works not as wanted. I've got a prompt that I need use a UNIT_HEALTH event, but here I stopped, because don't know what to to.

Can anyone please change a code of this weakaura to dead players not shown?
  Reply With Quote
11-19-21, 04:49 AM   #2
Clayent
A Murloc Raider
Join Date: Jul 2020
Posts: 7
Can anyone please help?
  Reply With Quote
11-25-21, 04:31 AM   #3
Clayent
A Murloc Raider
Join Date: Jul 2020
Posts: 7
Can anyone please help?
  Reply With Quote
11-25-21, 05:55 AM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
There's no need to bump posts. If someone can answer, they will. In GROUP_ROSTER_UPDATE, you want one or the other of these:
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need help with code of WA

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