Remove picked unit with trigger

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
  • cast2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Call of the Damned
    • Actions
      • Set CallofDamnedPoint = (Target point of ability being cast)
      • Set CallofDamnedGroup = (Units within 300.00 of CallofDamnedPoint)
      • Unit Group - Pick every unit in CallofDamnedGroup 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
            • Then - Actions
              • Unit - Change ownership of (Picked unit) to (Owner of (Triggering unit)) and Change color
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Legion Corpse
        • Then - Actions
          • Unit - Remove (Picked unit) from the game
        • Else - Actions
      • Unit - Create 1 Dummy Ressurect for (Owner of (Triggering unit)) at CallofDamnedPoint facing Default building facing degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Paladin - Resurrection



I have this trigger. It targets an area and a dummy unit is spawned and casts ressurection and ressurects units within the area.

I have an unit called Legion. When Legion dies, they drop no visible corpse so I have a trigger that spawns a "Legion corpse" when a Legion dies.

That unit looks like a flame and it shows where the dead Legion is so the ressurection-spell knows where to target.

But for some reason, the Legion Corpses are not removed by the spell.

What am I doing wrong?



(Thanks to Child_Of_Bodom for the trigger)
 
Level 5
Joined
Nov 7, 2007
Messages
134
I would believe it's because the action that is supposed to remove the corpse is triggered to remove "picked unit", but if you look closely, you'll see that the action is not a part of the "Pick every unit in region"-action, and because of that the corpse is not considered a "Picked unit" and is not removed. I'd suggest you put that action under the "Pick every unit in region"-action, or create a new "Pick every unit in region"-action and copy the "remove corpse" trigger into it.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Second If/Then/Else isn't in Unit Group actions.

You can check if your functions are in Unit Group Actions by clicking on
joinminus.gif
button near unit group function.

  • cast2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Call of the Damned
    • Actions
      • Set CallofDamnedPoint = (Target point of ability being cast)
      • Set CallofDamnedGroup = (Units within 300.00 of CallofDamnedPoint)
      • Unit Group - Pick every unit in CallofDamnedGroup 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
            • Then - Actions
              • Unit - Change ownership of (Picked unit) to (Owner of (Triggering unit)) and Change color
            • Else - Actions
      • ----- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Legion Corpse
        • Then - Actions
          • Unit - Remove (Picked unit) from the game
        • Else - Actions
      • Unit - Create 1 Dummy Ressurect for (Owner of (Triggering unit)) at CallofDamnedPoint facing Default building facing degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Paladin - Resurrection
  • cast2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Call of the Damned
    • Actions
      • Set CallofDamnedPoint = (Target point of ability being cast)
      • Set CallofDamnedGroup = (Units within 300.00 of CallofDamnedPoint)
      • Unit Group - Pick every unit in CallofDamnedGroup 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
            • Then - Actions
              • Unit - Change ownership of (Picked unit) to (Owner of (Triggering unit)) and Change color
            • Else - Actions
          • ----- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Legion Corpse
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
      • Unit - Create 1 Dummy Ressurect for (Owner of (Triggering unit)) at CallofDamnedPoint facing Default building facing degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Paladin - Resurrection
 
Level 5
Joined
Nov 7, 2007
Messages
134
Like I said, but you showed it more clearly. Gosh, how do you make those triggers? I've never figured that out.
 
Level 5
Joined
Nov 7, 2007
Messages
134
  • Wow
    • Events
      • Player - Player 1 (Red) types a chat message containing Well I'll be damned as An exact match
    • Conditions
    • Actions
      • Game - Display to (All players) the text: It worked!
Alright, thanks, that helps out a lot! I'll give you some rep for that :)
 
Level 10
Joined
Nov 5, 2008
Messages
536
I have fixed my mistake, but for some reason it still does not remove Legion Corpse Fire :(
The unit called "Legion Corpse Fire" is based on Disease Ward.
  • cast2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Call of the Damned
    • Actions
      • Set CallofDamnedPoint = (Target point of ability being cast)
      • Set CallofDamnedGroup = (Units within 300.00 of CallofDamnedPoint)
      • Unit Group - Pick every unit in CallofDamnedGroup 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
            • Then - Actions
              • Unit - Change ownership of (Picked unit) to (Owner of (Triggering unit)) and Change color
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Legion Corpse Fire
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
      • Unit - Create 1 Dummy Ressurect for (Owner of (Triggering unit)) at CallofDamnedPoint facing Default building facing degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Paladin - Resurrection
 
Level 5
Joined
Nov 7, 2007
Messages
134
Hm, strange, does everything else work the way it's supposed to?

EDIT: Btw, what kind of spell is "Call of the damned"? Is it a target area-spell or specific target point spell? Or maybe even a target unit-spell?
 
Level 10
Joined
Nov 5, 2008
Messages
536
Hm, strange, does everything else work the way it's supposed to?

EDIT: Btw, what kind of spell is "Call of the damned"? Is it a target area-spell or specific target point spell? Or maybe even a target unit-spell?

The spell work in the way it is supposed to: summon a dummy to cast resurection. But it does not remove the "fake corpses"

The spell itself is based on Blizzard, to create the Area of effect in within the dummy raises the corpses
 
Level 5
Joined
Nov 7, 2007
Messages
134
I see. Is the "Legion Fire Corpse" actually a corpse or just a regular, living unit that serves as a corpse? If that's the case, there might a possibility that the trigger somehow mixes up the first "If/Then/Else"-trigger with the second "If/Then/Else"-trigger and does not only check if the unit is the Legion Fire Corpse but also if it is dead, but if it is actually alive it will not remove it. I doubt this is the case, though, but I can't think of anything else.
 
Level 10
Joined
Nov 5, 2008
Messages
536
I see. Is the "Legion Fire Corpse" actually a corpse or just a regular, living unit that serves as a corpse? If that's the case, there might a possibility that the trigger somehow mixes up the first "If/Then/Else"-trigger with the second "If/Then/Else"-trigger and does not only check if the unit is the Legion Fire Corpse but also if it is dead, but if it is actually alive it will not remove it. I doubt this is the case, though, but I can't think of anything else.

Legion Fire Corpse is actually a living unit that serves as a corpse.

Anyway to get around it?
 
Level 10
Joined
Nov 5, 2008
Messages
536
If your Legion Fire Corpse has locust, remove it and set it's selectio scale to -1 (to remove health bar).

Locust "protects" units from Pick Every Unit functions.

You can make your fire dummy spawn for neutral passive (then players won't be able to select it with drag selection).

Thank you. The unit being a locust was the problem. Your other ideas works very well!



Why are you using variables when you're not removing them after?

I asume I am doing something wrong, but for some reason, when I add custom scripts, the game will not test-start. It says: Wrong Scriptname or something.

Any clues?
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
I asume I am doing something wrong, but for some reason, when I add custom scripts, the game will not test-start. It says: Wrong Scriptname or something.

Any clues?

Maybe you typed function wrong.
JASS:
call RemoveLocation(udg_<VariableName>)
call DestroyGroup(udg_<VariableName>)
// Note that this code is case-sensitive
 
Status
Not open for further replies.
Top