#Trigger that COUNTS injured party members
23 messages · Page 1 of 1 (latest)
yes, but it requires a bit of custom code
can you point me to an example that i can see?
no, I can't think of an example
You could use a Watched Trigger on a health trigger using the Group unit tag
t1 = custom - TSU - events = TRIGGER:2
t2 = unit - health - smart group - % < 100
t1 custom trigger:
function(allstates, event, triggerNum, triggerStates)
if triggerNum == 2 then
local count = 0
for _, state in pairs(triggerStates) do
if state.show then
count = count + 1
end
end
allstates[""] = allstates[""] or {show = true}
allstates[""].count = count
allstates[""].changed = true
return true
end
end
Thanks!
I"m having a hard time using the count
You can access it as %count in text replacement. If you set .value instead then that's the default progress variable for static clones, which would work with %p for example, and also for controlling something like bar progress
ok, i got the text to work
since it overrides count, i could just use count in a conditional like normal then?
If i'm being unhelpful, What i'm trying to do is be able to hide (or 0% alpha) an icon based on how many party/raid members that have taken damage
Don't use conditions for visibility
You can just set .show in the custom trigger
E.g. allstates[""].show = count > X
If you want to use a value that you set in a TSU, in a condition, you have to register it in the "Custom Variables" code box ```lua
{
count = "number",
}
ok. yea i don't need to set the custom variable
so i add
allstates[""].show = count > X
to the bottom with all of the other allstates lines?
and obviously set X to whatever i need it to be?
You can, if you do that then, allstates[""] = allstates[""] or {show = true} can also just become allstates[""] = allstates[""] or {}
and what number i need between {} ?
Nothing, you can just remove the show = true from making the initial state since you're going to set it later
i think i understand, let me try it