• 🏆 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!

Debuff Stacking - Help Needed

Status
Not open for further replies.
Level 2
Joined
Nov 4, 2004
Messages
23
Im trying to create a spell based off of sunder from WoW (no it isnt for a cheesy WoW rpg map dont worry :p) or similarily Bristlebacks Viscous Nasal Goo from DotA.

For anyone who isnt familiar with either of these pretty much it would be like Faerie Fire as in it reduces the enemies armor, but its able to stack as in each time you cast it on the enemy it decreases their armor by even more. i.e. level 1 faerie fire reduces armor by 1, when you cast it a second time within the debuff expiration timer the enemies armor is reduced by 2, cast it again and its reduced by 3 etc etc...

Also I'd ideally like to set some kind of limit, i.e. you can only stack it 5 times.

I havent used WE for about a year so I may be missing a very easy way to do this, but the best route I could come up with is something along the lines of creating a dummy unit to cast different rank faerie fires on the enemy. However I couldnt figure how to find the level of the current debuff on the enemy, so I wouldnt know how far along the stack is, hoping theres a function in JASS... I guess its possible to use many variables or timers per unit and keep track of how many have been faerie fires ave been stacked, but that seems very long and complicated, but if there isnt an easier way wouldnt mind some help setting that up..

Thanks.
 
Level 2
Joined
Nov 4, 2004
Messages
23
Okay, I solved my own problem, as there was no responses here....

For anyone who has the same problem:
This makes a spell that stacks 4 times per level.
1) Create a spell with 16 levels, doing whatever you want your stacking spell to do.
2) Make a dummy unit.
3) Make 16 different debuffs for your 16 levels spell.
4) Make a dummy spell for your hero, i.e. a spell that casts but does nothing, in this case ive made a level 4 hero spell.
5) Somewhere in your map, likely your init trigger, define a buff array from 1-16 with the buffs. i.e. buff[1] = SpellBuff (lvl1), buff[2] = SpellBuff(lvl2).. etc..
6) Then you just need a trigger that finds when the hero casts the dummy spell, it then creates the dummy unit and casts the real spell. For mine I added checks so that a hero casting level 1 Sunder wont replace a level 2 Sunder put on by another hero. It also limits you can stack to 4, if you try to Sunder and theres already 4 stacked it just re-applys the fourth stack.

Heres mine:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ability being cast) Equal to Sunder
Then - Actions
Set TempInt = (Level of (Ability being cast) for (Casting unit))

//*** Starts a loop to test for each level of debuff
For each (Integer A) from 1 to 16, do (Actions)
Loop - Actions

//*** This is the first check, it checks for a higher level of Sunder than the one being cast.
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer A) Greater than (4 x TempInt)
((Target unit of ability being cast) has buff Sunder[(Integer A)]) Equal to True
Then - Actions
Skip remaining actions
Else - Actions

//*** 2nd check, checks that there isnt 4 stacked, and also that the enemy already has a debuff of this level.
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer A) Less than or equal to (4 x TempInt)
((Integer A) mod 4) Not equal to 0
((Target unit of ability being cast) has buff Sunder[(Integer A)]) Equal to True
Then - Actions
Unit - Create 1 Albatross dummy for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Unit - Add Faerie Fire (Neutral Hostile) to (Last created unit)
Unit - Set level of Faerie Fire (Neutral Hostile) for (Last created unit) to ((Integer A) + 1)
Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire (Target unit of ability being cast)
Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
Skip remaining actions
Else - Actions

//*** Final check, check if theres already 4 stacked, then re-applys the fourth debuff for that level of hero ability.
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Integer A) mod 4) Equal to 0
((Integer A) / 4) Equal to TempInt
((Target unit of ability being cast) has buff Sunder[(Integer A)]) Equal to True
Then - Actions
Unit - Create 1 Albatross dummy for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Unit - Add Faerie Fire (Neutral Hostile) to (Last created unit)
Unit - Set level of Faerie Fire (Neutral Hostile) for (Last created unit) to (Integer A)
Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire (Target unit of ability being cast)
Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
Skip remaining actions
Else - Actions

//*** If all the checks come back negative, then it simply casts the spell normally.
Unit - Create 1 Albatross dummy for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Unit - Add Faerie Fire (Neutral Hostile) to (Last created unit)
Unit - Set level of Faerie Fire (Neutral Hostile) for (Last created unit) to ((4 x TempInt) - 3)
Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire (Target unit of ability being cast)
Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
Else - Actions
 
Status
Not open for further replies.
Top