• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Spawning a new unit when another unit is slain that has a specific buff.

Not open for further replies.
Level 8
Mar 15, 2007
I have a spell in my map that is based on Entangling Roots called Void Cage. The difference though, is that if the entangled unit dies, I want it to spawn a new unit for the caster of said spell. My trigger is as follows:
Void Cage Trigger
        Unit - A unit Dies
        ((Dying unit) has buff Void Cage (Drow)) Equal to True
        Unit - Create 1 Lost Soul (Drow) for (Owner of (Killing unit)) at (Position of (Dying unit)) facing Default building facing degrees
        Special Effect - Create a special effect at (Position of (Last created unit)) using Void Teleport To.mdx
        Special Effect - Destroy (Last created special effect)
My problem is that the trigger just plain does not work, and it won't spawn the unit for me, or display the special effects I've chosen. Any help is much appreciated. Thanks!
Buffs are usually removed the moment a unit dies, so the trigger above will not work (due to the condition failing). A workaround will be to add the target unit into a group (of units that have the same buff). Have a separate trigger check the units in that group for the buff, and remove them if they don't have it anymore.

So, there would be two triggers, one to catch the moment the buff is applied, and a periodic trigger:

Buff applier:
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) equal to Void Cage
  • Actions
    • Unit Group - Add (Target of Ability being cast) to <watcher_group>
Buff watcher:
  • Events
    • Time - Every <your interval> seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick each unit in <watcher_group> and do (Actions)
      • Actions
        • If - If all (Conditions) are true, then do (Do Actions), else do (Else Actions)
          • If - Conditions
            • (Picked unit) has buff Void Cage (Drow) equal to false
          • Do Actions
            • Remove (picked unit) from <watcher_group>
          • Else Actions
Then, replace the trigger's conditional statement with the following condition.

  • (Triggering unit) is in group <watcher_group> equal to true
Not open for further replies.