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

Quick question about unit death..

Status
Not open for further replies.
Level 8
Joined
Dec 9, 2005
Messages
523
If I wanted to activate a function after a target unit dies, where do I trigger it? Like in the Black Arrow ability, where a skull is created when a unit dies after being fired with one.

How do I for instance: deal a damage to a unit, and if it dies, a tree in created. Or a man. Or maybe I get a specific item (not droppe, but directly)

Okay, so it's not a quick question after all. But hey.... :D
 
Level 3
Joined
Mar 2, 2006
Messages
40
Well if your actions happen if a unit us by a normal attack, there's no way to detect the dammage. The only solution is by orb effects (which is actually how Vexorian's attack detect engine works). This may not be 100% correct, but it'll do:
1.Make a new custom buff based on Slowed. Don't bother changing anything except the name and remove Art-Target model.
2.Make a new custom ability based on Item Attack Frost Bonus. Change Data - Damage Bonus to 0, Data - Enabled Attack Index to 0, Stats - Buffs to the buff you just created. Remove the Art - Missile Art, Art - Target and Art - Special models.
IMPORTANT - Change Duration - Hero and Duration - Normal to 0.1
3.Give this ability to your unit.
4.The trigger :
Code:
GrowTree
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) has buff (The buff from step 1)) Equal to True
    Actions
        Destructible - Create a Ashenvale Tree Wall at (Position of (Dying unit)) facing (Random angle) with scale 1.00 and variation 0
Of course you can change the actions to whatever you want.

The things are diffrent if the damage is done by the trigger, because it won't leave a buff. In this case, things are a lot easier. Just put that right after the damage action :
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        ((the unit that you just dammaged) is Dead) Equal to True
    Then - Actions
        Destructible - Create a Ashenvale Tree Wall at (Position of (Dying unit)) facing (Random angle) with scale 1.00 and variation 0
    Else - Actions
 
Status
Not open for further replies.
Top