[Trigger] Explode effect upon death

Level 7
Joined
Feb 22, 2009
Messages
260
I want to make my hero explode when they die and deal damage to enemies.

Got the damage thing but I couldn't get the effect going.

I need a generic life event because generic unit dies does not account for reincarnation.

Basically, I need an event for this event.

  • Mannoroth death
    • Events
    • Conditions
    • Actions
      • Set Mannoroth = (Triggering unit)
      • Set CasterPos = (Position of Mannoroth)
      • Special Effect - Create a special effect at CasterPos using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
      • Special Effect - Set Scale of (Last created special effect) to 1.50
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_CasterPos)
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
Did you try a generic unit die with this condition?

  • (Ability Cooldown Remaining of (Triggering unit) for ability Reincarnation (Mannoroth)..) Greater than or equal to 0.00
Might need a bit of tinkering with the value but it seems straightforward enough
 
Level 7
Joined
Feb 22, 2009
Messages
260
Did you try a generic unit die with this condition?

  • (Ability Cooldown Remaining of (Triggering unit) for ability Reincarnation (Mannoroth)..) Greater than or equal to 0.00
Might need a bit of tinkering with the value but it seems straightforward enough

So what event should I use this for? Like unit dies?


This helpful resource has an event for reincarnation which you can use along with the normal death event to run the explosion: GUI Unit Event (now with a state-of-the-art Lua version)
Do I need to install the entire thing just for something that only happens once in a while?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Unit Dies does not work, units that die with Reincarnation available will not fire this Event.

You need to use what Pyro suggested OR just mimic what that system does.

The trick is simple: Give your hero a hidden Defend ability. A unit "leaving the map" with this ability will fire an "undefend" order:
  • Events
    • Unit - A unit Issues an order with no target
  • Conditions
    • (Issued order) Equal to (Order(undefend))
    • (Level of Reincarnation (Mannoroth) for (Triggering unit) Greater than 0
  • Actions
    • Set Mannoroth = (Triggering unit)
    • Set CasterPos = (Position of Mannoroth)
    • Special Effect - Create a special effect at CasterPos using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
    • Special Effect - Set Scale of (Last created special effect) to 1.50
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_CasterPos)
Now, this is the part that I forget, but you can add more Conditions to that trigger to confirm that it died and started reincarnating. You MAY be able to use the cooldown check that Chaosium suggested, but that's assuming that the cooldown starts prior to the issued order:
  • (Ability Cooldown Remaining of (Triggering unit) for ability Reincarnation (Mannoroth)..) Greater than 0.00
Note that you'll need to be on version 1.31+ to use this, and it appears as though you're not.

Of course in your situation it may be as simple as using the above trigger.
 
Last edited:
Level 7
Joined
Feb 22, 2009
Messages
260
Unit Dies does not work, units that die with Reincarnation available will not fire this Event.

You need to use what Pyro suggested OR just mimic what that system does.

The trick is simple: Give your hero a hidden Defend ability. A unit "leaving the map" with this ability will fire an "undefend" order:
  • Events
    • Unit - A unit Issues an order with no target
  • Conditions
    • (Issued order) Equal to (Order(undefend))
    • (Level of Reincarnation (Mannoroth) for (Triggering unit) Greater than 0
  • Actions
    • Set Mannoroth = (Triggering unit)
    • Set CasterPos = (Position of Mannoroth)
    • Special Effect - Create a special effect at CasterPos using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
    • Special Effect - Set Scale of (Last created special effect) to 1.50
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_CasterPos)
Now, this is the part that I forget, but you can add more Conditions to that trigger to confirm that it died and started reincarnating. You MAY be able to use the cooldown check that Chaosium suggested, but that's assuming that the cooldown starts prior to the issued order:
  • (Ability Cooldown Remaining of (Triggering unit) for ability Reincarnation (Mannoroth)..) Greater than 0.00
Note that you'll need to be on version 1.31+ to use this, and it appears as though you're not.

Of course in your situation it may be as simple as using the above trigger.



Ok, so I will have to add defend as an innate ability for Mannoroth then when a player finished training him, I set an action to activate Defend and then hide this ability. Then how do I reactivate defend again every time he is revived? Also, I didn't know that when your unit dies with a toggling ability on, they will issue a turning-off order when they die. Is there other abilities that trigger this reaction?

For the current issue, I found a work-around. I gave Mannoroth the Spawn Hydra ability. Luckily, this ability triggers every time a unit's life reaches 0 just like the AOE explosion ability of Goblin Mines. I put the spawn ability on the hero and set the ability to spawn an explosive dummy with a duration of 0.5 second. I used the generic death event to detect when the dummy expired to add special effect. Seem fine so far.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Ok, so I will have to add defend as an innate ability for Mannoroth then when a player finished training him, I set an action to activate Defend and then hide this ability. Then how do I reactivate defend again every time he is revived?
He doesn't need to activate the Defend ability. The ability will be completely hidden/unusable and the user will never know it's there.

Also, I didn't know that when your unit dies with a toggling ability on, they will issue a turning-off order when they die. Is there other abilities that trigger this reaction?
I don't know of any other abilities that do this.

So you simply do this to add the ability to Mannoroth (permanently):
  • Events
    • Unit - A unit Learns a skill
  • Conditions
    • (Learned hero skill) Equal to Reincarnation (Mannoroth)
    • (Level of Reincarnation (Mannoroth) for (Triggering unit)) Equal to 1
  • Actions
    • Set Mannoroth = (Triggering unit)
    • Set MyAbility = Defend (Hidden)
    • Unit - Add MyAbility to Mannoroth
    • Custom script: call UnitMakeAbilityPermanent( udg_Mannoroth, true, udg_MyAbility )
Set the abilities Art - Button positions to X: 0, Y: -11 to hide it. This is done in the Object Editor.

Then use my previous trigger to detect when he dies:
  • Events
    • Unit - A unit Issues an order with no target
  • Conditions
    • (Issued order) Equal to (Order(undefend))
    • (Level of Reincarnation (Mannoroth) for (Triggering unit)) Greater than 0
  • Actions
    • Set Mannoroth = (Triggering unit)
    • Set CasterPos = (Position of Mannoroth)
    • Special Effect - Create a special effect at CasterPos using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
    • Special Effect - Set Scale of (Last created special effect) to 1.50
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_CasterPos)

For the current issue, I found a work-around. I gave Mannoroth the Spawn Hydra ability. Luckily, this ability triggers every time a unit's life reaches 0 just like the AOE explosion ability of Goblin Mines. I put the spawn ability on the hero and set the ability to spawn an explosive dummy with a duration of 0.5 second. I used the generic death event to detect when the dummy expired to add special effect. Seem fine so far.
How you handle the AoE damage can be done in a million ways but you should do whatever you're comfortable with. I would personally trigger the damage myself and make Mannoroth deal it so he gets kill credit. It'd be fairly simple to add that to the above "issued order" trigger.
 
Last edited:
Top