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

checking if unit dies within aura range

Status
Not open for further replies.
Level 8
Joined
Apr 13, 2006
Messages
174
Basically, I want a skelleton to spawn whenever a unit dies within my aura (the skelleton should be owned by the owner of the dying unit and should be spawned at the position of the dying unit).

I use this:

If a unit dies within my aura (I use "If Unit has Buff")

Create 1 Skelleton for owner of dying unit at position of dying unit.

The problem is, I don't think it recognises the position of a unit if it just died right? so does anyone have an idea on how to acomplish this?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here's one way to do it. Units with the buff should be added to Temp_Group_1.

  • Untitled Trigger 100
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Temp_Group_1 and do (Actions)
        • Loop - Actions
          • Set Temp_Unit_1 = (Picked unit)
          • Set Temp_Loc_1 = (Position of Temp_Unit_1)
          • Set Temp_Group_2 = (Units within 512.00 of Temp_Loc_1)
          • Unit Group - Pick every unit in Temp_Group_2 and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to True
                  • ((Picked unit) is A structure) Equal to False
                • Then - Actions
                  • Set Temp_Loc_2 = (Position of (Picked unit))
                  • Unit - Remove (Picked unit) from the game
                  • Special Effect - Create a special effect at Temp_Loc_2 using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Create 1 Skeleton Warrior for (Owner of Temp_Unit_1) at Temp_Loc_2 facing (Random angle) degrees
                  • Custom script: call RemoveLocation(udg_Temp_Loc_2)
                • Else - Actions
          • Custom script: call DestroyGroup(udg_Temp_Group_2)
          • Custom script: call RemoveLocation(udg_Temp_Loc_1)
Another way is to do it with "Unit dies" event. Then pick every unit within range of the unit and possibly detect the nearest unit and create the unit for the owner od that unit.
 
Level 7
Joined
Jul 18, 2009
Messages
272
Units are still there until they are decayed. So using "position of dying unit" shouldn't be a problem.
 
Level 7
Joined
Jul 18, 2009
Messages
272
What is death time?

I think the trigger you posted in the first post should work just fine.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
-dying units have position - YOU SHOULD OF TEST THAT YOURSELF
-if u cant see that dying unit has buff than just create unit of type dying unit for owner of dying unit at position of dying unit
-if last created unit has buff Your Buff
than - Your Actions
else
(do nothing)
------and don't put this last action in if/than/else-----
unit - remove last created unit
 
Level 8
Joined
Apr 13, 2006
Messages
174
here's my trigger:

  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Dying unit) has buff The Aura ) Equal to True
  • Actions
    • Unit - Create 1 Skeleton Warrior for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing degrees
    • Special Effect - Create a special effect attached to the origin of (Dying unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
    • Special Effect - Destroy (Last created special effect)
It doesn't work for me...
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Yeah this will not work because the unit is dead and hasn't the buff anymore...

I recommend to use Maker's way, this works perfectly :wsmile:

( You pick every 0.05 seconds all units that have the aura buff and add them into "Temp_Group_1" )
( You pick every 0.05 each unit in this Temp_Group_1 and remove those who haven't the buff anymore )
( Rest is done by the trigger of Maker )
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

This sounds confusing ... you are able to get this when you:

bg3w0w03fkfvo280h.gif


bg3w2gdhymzl1t2xd.gif


The order:
1) Window up
2) Window middle
3) Window down


If you done this correctly but still can't get it ... then I think we got a new World Editor Error :wsmile:
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
did you try it on my way?,because doing something every 0.50 seconds is really bad...

i know one good trigger but with 0.5 to 1 sec delay

here is the other one with no delay,but you need to know the range of your aura

  • Unit dies within aura range
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set POINT = (Position of (Triggering unit))
      • Set UNITGROUP = (Units within X RANGE of POINT matching ((Level of YourAuraAbility for (Matching unit)) Not equal to 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UNITGROUP is empty) Not equal to True
        • Then - Actions
          • Unit - Replace (Triggering unit) with a Skeleton Warrior using The new unit's max life and mana
        • Else - Actions
      • Custom script: call DestroyGroup(udg_UNITGROUP)
      • Custom script: call RemoveLocation(udg_POINT)
 
Last edited:
Status
Not open for further replies.
Top