[Solved] Counting buffs

Status
Not open for further replies.
Level 4
Joined
Aug 31, 2011
Messages
88
Hi guys,

Can I somehow count how many buffs has a unit?

I know that I can check if unit has a specific buff, but can I somehow count them?

Can I count them by checking which buff it has and then setting the variable count to 1 or is there some easier workaround?
 
Last edited:
Level 4
Joined
Aug 31, 2011
Messages
88
How about counting specific buffs?

For example count Cripple and Curse, but not Slow, as all of them are negative buffs.
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
The game cannot distinguish Cripple and Curse from Slow, because as you said, they are all negative.
Because of that, you will have to manully tell the game which buff needs to be counted, so you will count them manually.

If you wanted to count only Cripple and Curse, you would use:
set count = 0
if unit has buff cripple then
set count = count + 1
if unit has buff curse then
set count = count + 1

If you want to count all buffs except slow, you would use:
set count = 0
if unit has buff slow then
set count = count - 1

set count = count + CountAllBuffs


If the list is longer, it makes sense to use a loop and an array.
 
Status
Not open for further replies.
Top