• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Solved] Damage source (as unit variable) still deals damage after removal with trigger damage set to null

deepstrasz

Map Reviewer
Level 83
Joined
Jun 4, 2009
Messages
22,297
Probably known (and I'm stupid) but haven't found a thread about it and might help someone.

I have an enemy hidden/dummy unit which very speedily casts a Carrion Swarm based ability. It's part of a trigger where one of the player units takes damage and the damage source is this dummy caster. The idea is that if the player unit stays in a certain region while being damaged by the hidden caster it takes no damage. But once this dummy is removed some of the fast custom Carrion Swarm reaches the target after the dummy is removed and the trigger doesn't set the damage to 0 because I reckon the condition doesn't find the damage source unit variable anymore.
Rather niche, I know but I solved it by adding Cargo Hold (Orc Burrow)/Abun to disable attack and whatnot for the dummy and removed it only after it ceased any kind of attack.
I guess I could've used pause unit too. Ordering to stop didn't help as the dummy also has a regular attack and high acquisition range (could work by tweaking this). Another solution perhaps could be damage type detection but that's too broad, not specific to a certain unit.
 
Probably known (and I'm stupid) but haven't found a thread about it and might help someone.

I have an enemy hidden/dummy unit which very speedily casts a Carrion Swarm based ability. It's part of a trigger where one of the player units takes damage and the damage source is this dummy caster. The idea is that if the player unit stays in a certain region while being damaged by the hidden caster it takes no damage. But once this dummy is removed some of the fast custom Carrion Swarm reaches the target after the dummy is removed and the trigger doesn't set the damage to 0 because I reckon the condition doesn't find the damage source unit variable anymore.
Rather niche, I know but I solved it by adding Cargo Hold (Orc Burrow)/Abun to disable attack and whatnot for the dummy and removed it only after it ceased any kind of attack.
I guess I could've used pause unit too. Ordering to stop didn't help as the dummy also has a regular attack and high acquisition range (could work by tweaking this). Another solution perhaps could be damage type detection but that's too broad, not specific to a certain unit.
That was a ghost handle, you could put a timer on the dummy unit

call UnitApplyTimedLife(dummy, 'BWEW', 2.0)

Is it necessary for the dummy unit to have attacks enabled?
 
That was a ghost handle, you could put a timer on the dummy unit

call UnitApplyTimedLife(dummy, 'BWEW', 2.0)

Is it necessary for the dummy unit to have attacks enabled?
I guess the problem with that could be needing to make the timer exact so that it runs out when the visible enemy's other trigger comes in and the Carrion Swarm stuff has to stop.

It's not necessary for the dummy to also be able to attack but I didn't want another one since I'm also using its attack in another trigger for the same visible enemy unit.
 
I guess the problem with that could be needing to make the timer exact so that it runs out when the visible enemy's other trigger comes in and the Carrion Swarm stuff has to stop.

It's not necessary for the dummy to also be able to attack but I didn't want another one since I'm also using its attack in another trigger for the same visible enemy unit.
I would still advise to have dedicated dummy for each separate action( especially if the action involves attack types) instead of a Swiss army knife dummy. You can increase the timer so that the wave has enough timet finish and register the damage source, it doesn’t have to be precise, just long enough.

Dummies are incredibly lightweight on the engine anyway. Having a dedicated ⁠Unit Type⁠ for spellcasting and another for standard attacks won't hurt map performance or file size at all, but it saves a massive amount of trigger debugging.
 
Dummies are incredibly lightweight on the engine anyway. Having a dedicated ⁠Unit Type⁠ for spellcasting and another for standard attacks won't hurt map performance or file size at all, but it saves a massive amount of trigger debugging.
Good to know. More conditions for easier detection of the damage source: damage type, unit type....
One nasty way to not look at the spells damage type table over and over (frost, fire, whatever; Storm Bolt's, Chain Lightning's, so on) would be, instead of totally triggering the spell with Channel, to use some some bolean/integer variables for (example) various boss phases (on the same dummy with multiple spells) and you could just detect the damage source rather than damage type since you'd know in this phase the dummy casts Storm Bolt based spell, in another a Chain Lightning based one etc. But might get more annoying than having multiple ones instead. Actually, you could use the same object editor unit and simply add different spells to it and make multiple copies of it as different unit variables for each purpose.
 
Good to know. More conditions for easier detection of the damage source: damage type, unit type....
One nasty way to not look at the spells damage type table over and over (frost, fire, whatever; Storm Bolt's, Chain Lightning's, so on) would be, instead of totally triggering the spell with Channel, to use some some bolean/integer variables for (example) various boss phases (on the same dummy with multiple spells) and you could just detect the damage source rather than damage type since you'd know in this phase the dummy casts Storm Bolt based spell, in another a Chain Lightning based one etc. But might get more annoying than having multiple ones instead. Actually, you could use the same object editor unit and simply add different spells to it and make multiple copies of it as different unit variables for each purpose.
The phase variable idea works in theory, but keep an eye out for the classic race condition trap...


If Boss Phase 1 launches a slow-moving Carrion Swarm, and the boss transitions to Phase 2 while that projectile is still mid-air, your variable updates instantly. When the Phase 1 projectile finally hits the player a second later, your damage trigger checks the variable, sees 'Phase 2', and processes the wrong effects.
==================================
This is exactly why giving each specific spell its own dedicated dummy is the ultimate foolproof method. If your trigger checks:

If Unit-Type of (Damage Source) Equal to (Dummy - Phase 1 Swarm)

It will evaluate 100% correctly every single time, regardless of how much time has passed, if the dummy has already expired, or what phase the boss is currently in.
 
Back
Top