• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Remove Poison (Stacking) and Poison (Non-Stacking)

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
I am trying to make an effect that cures you of poison (basic enemies have the envenomed weapons ability so it's very common to have several stacks on you). However, when I try to remove the buffs, it seems to not work when you have more than one stack.

Does anyone know of a way to guarantee the removal of all the poison?

I tried removing all negative buffs and it worked, but that has a ton of other problems and doesn't work the way I want it to for this case.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Removing the buff once doesn't get rid of one stack? You could try using call SetUnitAbilityLevel(GetTriggerUnit(),<Your buff ID here>,0) before/in addition to removing the buff. Alternatively create a second poison based on envenomed spears (but deals 0 damage/stack) and have a dummy unit with 0 damage attack them; it might overwrite the buff and stop the damage.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I'm not sure if it just gets rid of one stack or if it's just doing nothing (perhaps the buff ID is hidden for when it stacks or something). I'll have it output the level of the buffs and see if I can find anything. I'll report back in a bit.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Okay well that's weird. Outputting the levels of the abilities, the Non-Stacking one is always at 0. The Stacking one goes up to 1 when you have any number of stacks. It is removed properly when it is just one stack, but if it is more than one stack, it just fails to remove it.

I'm going to try something wonky. I'll see if removing it more than once (EX: until the buff goes away) will work.
 
Level 13
Joined
May 10, 2009
Messages
868
well, I just noticed that behavior... It looks like the buff stacks depending on the number of units that have such ability and have attacked you. So, if only one unit attacks you (it doesn't matter how many times), you just need to remove the buff (ability) once, but if there are more units doing that, you need to repeat the remove ability function. This is the easiest way to remove all stacks from one unit that I could think of:
JASS:
loop
    call UnitRemoveAbility(Unit, 'Bpsd')
    exitwhen GetUnitAbilityLevel(Unit, 'Bpsd') == 0
endloop

'Bpsd' is the "stacking poison" buff
 
Level 12
Joined
May 22, 2015
Messages
1,051
well, I just noticed that behavior... It looks like the buff stacks depending on the number of units that have such ability and have attacked you. So, if only one unit attacks you (it doesn't matter how many times), you just need to remove the buff (ability) once, but if there are more units doing that, you need to repeat the remove ability function. This is the easiest way to remove all stacks from one unit that I could think of:
JASS:
loop
    call UnitRemoveAbility(Unit, 'Bpsd')
    exitwhen GetUnitAbilityLevel(Unit, 'Bpsd') == 0
endloop

'Bpsd' is the "stacking poison" buff
Thanks!! I just completed my testing and was in the middle of writing it up lol. +rep for checking this out and confirming it though! Here's what I had:

Okay I figured it out. Seems like it actually just adds the ability multiple times or something. It is probably hard-coded for this one buff or something. It has to remove the buff one time for each stack.

To be clear, one stack is added for each different unit with the poison ability who has hit the target. It had to remove the buff 1 time for each of the enemies with the ability in my testing.

Looks like that's it! I just need to remove this buff until it is gone for good.
 
Status
Not open for further replies.
Top