View Single Post
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