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

[Trigger] How to detect a dead enemy unit?

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
Hello!

I have a trigger that looks like this:

  • Unit Spawns Aura
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Lorekeeper) and do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in (Player group((Owner of (Picked unit)))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Call from the Wild (Neutral Hostile) for (Picked unit)) Not equal to 0
                  • (Distance between (Position of (Picked unit)) and (Position of (Dying unit))) Less than or equal to 700.00
                • Then - Actions
                  • Unit - Create 1 Wolf for (Picked player) at (Position of (Dying unit)) facing Default building facing degrees
                • Else - Actions
The building that has this aura is called Lorekeeper.
The aura is called Call from the Wild.

If any unit dies within range of the aura, the dead unit is replaced with a friendly wolf. The trigger works fine, but

I would like the aura to work as this:

An ENEMY unit dies within the aura.
A FRIENDLY wolf is summoned from it's corpse.
If a friendly unit dies, nothing happens.




Anyone has any ideas how to change the trigger?
 
Level 10
Joined
Nov 5, 2008
Messages
536
Perhaps I am a bit ballsy now, but if I use this as a condition:

  • ((Dying unit) belongs to an enemy of (Picked player)) Equal to True
How do I do so all players counts as enemies to each other? Is there anythoing better to put in "Picked player"?
 
Level 10
Joined
Nov 5, 2008
Messages
536
Thanks for your help and answears, but I am a bit ashamed to admit that I don't get it to work : /

Any player can have this aura on their side, which means that only enemies to the player with the aura, only enemy unit's deaths will trigger the aura to summon a wolf.

If someone can clearify exactly what I need to put in the trigger that would be very kind of you!
 
Level 10
Joined
Nov 5, 2008
Messages
536
Now my trigger looks like this:

  • Unit Spawns Aura
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) has buff Call of the Wild ) Equal to True
    • Actions
      • Unit Group - Pick every unit in (Units of type Lorekeeper) and do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in (Player group((Owner of (Picked unit)))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Call from the Wild (Neutral Hostile) for (Picked unit)) Not equal to 0
                  • (Distance between (Position of (Picked unit)) and (Position of (Dying unit))) Less than or equal to 700.00
                • Then - Actions
                  • Unit - Create 1 Wolf for (Picked player) at (Position of (Dying unit)) facing Default building facing degrees
                • Else - Actions
The enemy units get's the buff from the aura, but no Wolfs are spawned when the unit dies. What more do I need to add in the trigger?
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Now my trigger looks like this:

  • Unit Spawns Aura
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) has buff Call of the Wild ) Equal to True
    • Actions
      • Unit Group - Pick every unit in (Units of type Lorekeeper) and do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in (Player group((Owner of (Picked unit)))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Call from the Wild (Neutral Hostile) for (Picked unit)) Not equal to 0
                  • (Distance between (Position of (Picked unit)) and (Position of (Dying unit))) Less than or equal to 700.00
                • Then - Actions
                  • Unit - Create 1 Wolf for (Picked player) at (Position of (Dying unit)) facing Default building facing degrees
                • Else - Actions
The enemy units get's the buff from the aura, but no Wolfs are spawned when the unit dies. What more do I need to add in the trigger?

you need to remove leaks.....
create this variables
UNITGROUP - UnitGroup
PLAYERGROUP = PlayerGroup
POSITION - Point
(no need to use POSITION if it is unit on map (some unit <gen>) than it will not leak


set UNITGROUP= (your unit group)
do whatever you want with UNITGROUP
Custom Script:call DestroyGroup(udg_UNITGROUP)

set POSITION = (your position)
do whatever you want on position
Custom Script:call RemoveLocation(udg_POSITION)



(group ALL PLAYERS DONT´T LEAK)

set PLAYERGROUP = (your player group)
do whatever you wont with PLAYER GROUP
Custom Script:call DestroyForce(udg_PLAYERGROUP)

You don´t need to use Custom Scripts every time when you use group/point but you must destroy it when you are about to change it or if you are done with it
 
Level 10
Joined
Nov 5, 2008
Messages
536
Thanks for good help!

set UNITGROUP= (your unit group)
do whatever you want with UNITGROUP
Custom Script:call DestroyGroup(udg_UNITGROUP)

set POSITION = (your position)
do whatever you want on position
Custom Script:call RemoveLocation(udg_POSITION)

You write that I can do whatever I want with these variables, but I wonder what I need to do with them? :)

ps. No unit in the beginning has this aura. They can be built by players later in the game and they can have many in play at the same time.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Level 13
Joined
Mar 4, 2009
Messages
1,156
Wohaaa.. I don't get it to work at all. I have read the tutorial, but my trigger won't obey my orders.. Is there any other way to create this trigger?

you dont need to pick players
Its not picked player :hohum: i think you want to create unit for owner of picked unit

-unit dies
-dying unit equal to (your unit)
-pick (your units)
if bla bla bla ....
than
create 1 (your unit) for owner of unit (picked unit)
 
Status
Not open for further replies.
Top