• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Last created unit is dead.

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2015
Messages
91
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RoomChance Equal to 2
    • Then - Actions
      • Unit - Create 1 Dagger Spirit for Player 2 (Blue) at (Random point in Region 164 <gen>) facing Default building facing degrees
      • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Unit - Create 1 Dagger Spirit for Player 2 (Blue) at (Random point in Region 164 <gen>) facing Default building facing degrees
      • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Unit - Create 1 Dagger Spirit for Player 2 (Blue) at (Random point in Region 164 <gen>) facing Default building facing degrees
      • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Unit - Create 1 Dagger Spirit for Player 2 (Blue) at (Random point in Region 164 <gen>) facing Default building facing degrees
      • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Wait until (((Last created unit) is dead) Equal to True), checking every 1.00 seconds
      • Item - Create Purple Key at (Center of Region 164 <gen>)
      • Special Effect - Create a special effect at (Center of Region 164 <gen>) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
    • Else - Actions
      • Do nothing
The problem is,
  • Wait until (((Last created unit) is dead) Equal to True), checking every 1.00 seconds
I want to know how i can get it to detect when that last created unit is dead, and when it is, drop a key. Thanks! :goblin_good_job:
 
Level 12
Joined
May 22, 2015
Messages
1,051
You'll want to create a variable set to the (last created unit) as there are probably a ton of units created by the time that one dies.

You could also make a second trigger (and this is better, overall) and add to that trigger the event - last created unit dies.

This is definitely a better way to do it.

"Wait until" is also a potentially huge lag producer when you play online (it will appear that everyone has terrible latency - except maybe the host if you play on LAN - it really sucks the fun out of playing if that happens).
 
Level 4
Joined
Nov 17, 2015
Messages
91
You'll want to create a variable set to the (last created unit) as there are probably a ton of units created by the time that one dies.

You could also make a second trigger (and this is better, overall) and add to that trigger the event - last created unit dies.

:goblin_good_job: you sir just solved my problem!
  • KeyBearer
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to KeyBearer
    • Actions
      • Item - Create Purple Key at (Position of (Dying unit))
 
Status
Not open for further replies.
Top