• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

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

Status
Not open for further replies.
Level 8
Joined
Mar 15, 2007
Messages
230
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:
Code:
Void Cage Trigger
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) has buff Void Cage (Drow)) Equal to True
    Actions
        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
 
Status
Not open for further replies.
Top