HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Adding Splash Damage to an Ability

10-11-2007, 04:12 PM#1
Viper5030
I'm using these 2 triggers to give an ablilty called "Flame Torrent" splash damage upon impact. It's based on Shadow Strike with a the Pheonix missile art. The splash damage is proportional to the level of the spell. It's my first time doing something like this, so I wanted to know if that's the best way to do it:

Trigger:
Flame Torrent Target
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Flame Torrent
Collapse Actions
Set FlameTarget[(Player number of (Triggering player))]=(Target unit of ability being cast)
Trigger- Turn on Flame Torrent Splash <gen>
Add to Flame Torrent Splash <gen> the event (Unit - (Target unit of ability being cast) Takes Damage)

Trigger:
Flame Torrent Splash
Events
Collapse Conditions
(Damage source) Equal to Hero[(Player number of (Owner of (Damage source)))]
Collapse Actions
Trigger - Turn off (This trigger)
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Real(Level of Flame Torrent for (Damage source)))) x 5.00))
Unit - Cause (Damage source) to damage circular area after 0.30 seconds of radius 300.00 at (Position of (Triggering unit)), dealing ((Real((Level of (Flame Toreent for (Damage source)))) x 5.00) damage of attack type Spells and damage type Fire

Note: Hero is obviously a unit variable I have defined somewhere else.

So, the only thing left to do now is prevent the caster from first attacking, then casting the spell before the attack projectile hits, therefore causing the splash damage to trigger upon impact of the attack and not the spell. It's hard to pull off, but I know the bug exists. So I'm going to have to add a third trigger preventing that. But before I go through all that trouble, I was wondering if there's a better way to pull this whole thing off.

Oh and I should empty out the unit variable FlameTarget to avoid leaks, shouldn't I?
10-11-2007, 04:34 PM#2
TaintedReality
In order to make sure it doesn't fire from attack damage, you should use a dummy spell which just spawns a dummy unit who casts the actual spell. That way, in your On Damage trigger, you can just check if the damaging unit is the unitid of your dummy unit - if so, then it's spell damage, because the dummy unit doesn't attack. Trying to actually determine whether damage is attack damage or spell damage is a pain in the ass.

Quote:
Oh and I should empty out the unit variable FlameTarget to avoid leaks, shouldn't I?

No, globals don't leak. And besides, from what you've shown us you don't even use the variable FlameTarget after setting it.
10-11-2007, 04:48 PM#3
Viper5030
Quote:
Originally Posted by TaintedReality
No, globals don't leak. And besides, from what you've shown us you don't even use the variable FlameTarget after setting it.

Lol, oops, that's embarrasing. Yeah, I guess I was going to use it and then decided not to.

That's a good idea to get another unit to actually cast it. Guess I'll have to work on it. My only concern is that I want to make sure that the spell animation goes directly from the caster's hands like the normal spell does. I usually use leeches to do casting, so I guess I'll have to lower their elevation and give a slight offset toward the target when they're created.
10-11-2007, 04:53 PM#4
TaintedReality
It should look fine. As long as your dummy has 0 backswing/casting point/whatever (so it casts instantly), and the dummy has locust (so he can stand basically in the exact same spot as the hero). The hero will already be playing the casting animation from the dummy spell, so in the end it should look exactly the same.

What do you mean by leeches?
10-11-2007, 04:56 PM#5
Viper5030
Quote:
Originally Posted by TaintedReality
What do you mean by leeches?

I meant locusts. For some reason I sometimes call them leeches. Yet another embarrassing moment...
10-11-2007, 05:51 PM#6
TaintedReality
Oh =P