• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Stacked spell effects

Status
Not open for further replies.
Level 2
Joined
Apr 16, 2008
Messages
18
I am making a spell that works like this:

It can be turned on (like autocast), each time an enemy is hit with an attack, while the "autocast" is turned on, a dummy unit is created and will cast a spell on the enemy.

This spell is simple, it is a life-drain spell. It's basically a dummy spell, since I will do all the damage and life-giving in JASS/Triggers.

I need to count how many times it has been stacked on the unit.

The spell lasts 6 seconds, but it needs to be stackable in that time.

0 seconds - enemy unit hit first time... stacked once.
1.5 seconds - enemy unit hit second time... stacked twice.
6 seconds - first spell drops... stacked once.
7.5 seconds - second spell drops... no stacks

I had the thought of stripping the old buff from the unit and recasting a higher level spell for each stack... and recasting when it drops down too.

Bit complicated, any better ideas guys?

Thanks in advance!
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Hmmm..... for detecting how many times the unit has been hit I think "A Unit takes damage" would be the best answer (add the event via trigger, if you're not familiar with that procedure, just ask, I'll explain).

Your idea is pretty good, but that will not look like it's stacked. Removing the buff won't remove the actual spell effect, it'll just remove that buff thingy in the unit status. I think that leveling is out of the question, because if you want to do that, you will probably had to stop the dummy to cast a leveled up spell. That will be visible (because the spell will stop and start again, which doesn't look like a stack).

But there is maybe something you can do........ what if you create another dummy caster which starts the leveled up ability right when the first one stops? With a little testing you can figure out when it will stop.

Or (another idea), this will look more stacky and it will be far easier than any of the crappy suggestions I just gave you, how about creating a dummy, adding a 6 second expiration timer to it and ordering it to cast life drain? You do that each time the unit has been attacked, so there will be multiple layers of the life drain beam which will look powerful (each stack will look thicker).

If anything else comes to my mind, I'll tell you, but I think the last suggestion is ok (except if you don't like the effect).
 
Level 2
Joined
Apr 16, 2008
Messages
18
Firstly, thanks for the reply. I appreciate it.

Or (another idea), this will look more stacky and it will be far easier than any of the crappy suggestions I just gave you, how about creating a dummy, adding a 6 second expiration timer to it and ordering it to cast life drain? You do that each time the unit has been attacked, so there will be multiple layers of the life drain beam which will look powerful (each stack will look thicker).

The issue I am facing here, is that (I think!) if the target gets "life-drain" cast on it once, then the second time it is applied (stacked), it will meerly get replaced and they wont stack. Kind of like poisoning an enemy twice, afaik, they will only take the poison damage once, not stacked.

I'm trying to get around the "replacing" caused by recasting a spell on a unit before the original effect has ended.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Hmmm I'm not much into stacking......

I think the only way is leveling the ability of the dummy and ordering it to cast again, but keep track of the time so when the 6 second expires, decrease the level of the ability. I can't think of another way except if you can somehow find out which life drain ability will be applied (since only one works when there are multiple, if that's what you've told me).
 
Level 2
Joined
Apr 16, 2008
Messages
18
I might just use a basic dummy spell and store the value of stacks in an integer, dealing the damage/life at each second.

Anyone got a better idea?

+REP to Silvenon, btw. Thnx for the help.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Maybe you can do a triggered life drain? So the original life drain doesn't deal damage, but you do the damage with triggers. You can use that idea by storing the value of stacks in an integer and when that integer becomes 0 you can turn of the life drain (order the unit to stop).
 
Level 2
Joined
Apr 16, 2008
Messages
18
I was looking around to see if anyone else had made something similar to what I wanted, then I found Burning Spear on the Sacred Warrior in DoTA.

It's perfect: damage-over-time, stacks 5 times, lasts 6 seconds, visible effect (although no "buff")

Now, if only I actually knew HOW it was done!
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
just use a Damage Detection
When Unit takes damage
if it has burning spear buff (you can use frost-dark arrows to leave buff)
remove buff
create special effect
damage 5 times in a loop with waiting inside
remove the effect
 
Level 2
Joined
Apr 16, 2008
Messages
18
+REP

Definately agree!

One last issue is this:

The Ultimate skill of this hero deals damage based on the number of times the effect has been stacked on the target + removes the effect. (Basically, prematurely ends the damage-over-time effect, in enchange for instant damage.)

I figured that I could store the number of stacks for each unit in an integer and check the stack-count in the trigger (if stackcount is 0, then skip remaining actions... for instance)...

But how would I efficiently store an integer for each unit hit by the attack?
 
Level 2
Joined
Apr 16, 2008
Messages
18
A little light went BING! So I changed the bulb and then I had this idea!

This is just a little rough guide that I did in Notepad... let me explain it...

Code:
- Life Drain Trigger -

    Unit attacked

    Unit has buff "some_fake_buff"

    Remove buff
    <optional> Create dummy, cast fake spell on unit for buff info </optional>
    Add special effect
    Store special effect

    = loop 1 to 6 =
    Deal damage
        = loop 1 to 10 =
            wait 0.10 seconds
            if (this_unit == Unit_Hit_By_ExplodeHexes)
                ExplodeHexesBuffCounterDrain += 1
                Destroy special effect (prevents leaking)
                Skip all remaining actions
        = next loop =
    = next loop =

    Destroy special effect

There may be slight errors, but the basic idea is there.

"Explode Hexes" is the ulti that checks for the "hex" stack, nukes the buffs and deals ultimate damage from them, over time. So it needs to have some kind of 2-way communication with the life-drain trigger.

So, 2 globals are used. Unit_Hit_By_ExplodeHexes (unit) and ExplodeHexesBuffCounterDrain (int) which "counts" the number of Drain "hexes".

ExplodeHexes trigger will set Unit_Hit_By_ExplodeHexes to the target unit, then wait 0.10 seconds, all the Drain triggers will then end and increment ExplodeHexesBuffCounterDrain when they do.

ExplodeHexes will take this count and use it when dealing the damage.
 
Status
Not open for further replies.
Top