• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Kill units with buff

Status
Not open for further replies.
Level 6
Joined
Jun 8, 2008
Messages
256
I'm trying to create a trigger that puts all units with a certain buff (BossKillerBuff) in a group, and kills them.
However, I can't make it work, and nothing happens at all, I'm thinking the issue lies within the trigger that picks the units, but I'm not sure.

This is supposed to work like in escape maps, where you die if you get close to patroling units.

Anyhow, here's my trigger:
  • VoidwalkerAura
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in LavapoolRegionTarget matching (((Picked unit) has buff BossKillerBuff ) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to KillerAuraGroup
          • Unit Group - Pick every unit in KillerAuraGroup and do (Unit - Kill (Picked unit))
I've tested it and units do get the buff, but they don't die.

Also, if you see any leaks, feel free to point them out.
The unit group is dealt with when the unit with the aura goes away.
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
Unit Group - Pick every unit in (Units in LavapoolRegionTarget matching (((Picked unit) has buff BossKillerBuff ) Equal to True)) and do (Actions)

Should be MATCHING unit has buff, I think.

and your code leaks indeed.
But try my solution before I fix your leaks.

and why do you use
  • Unit Group - Add (Picked unit) to KillerAuraGroup
  • Unit Group - Pick every unit in KillerAuraGroup and do (Unit - Kill (Picked unit))
and not just
  • Unit - Kill (Picked unit)
makes no sense to me, because it doesn't change anything.
 
Level 6
Joined
Jun 8, 2008
Messages
256
I guess you've got a point. And Billy the Cat already pointed out the matching unit-issue, and it works.

Where's the leaks? :p
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
  • blah
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Set MyGroup = (Units in #YOUR REGION# matching (((Matching unit) has buff #YOUR BUFF#) Equal to True))
      • Unit Group - Pick every unit in MyGroup and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup(udg_MyGroup)
Should work, Shouldn't leak.
 
Level 11
Joined
Feb 22, 2006
Messages
752
Easier solution:

  • blah
  • Events
    • Time - Every 0.20 seconds of game time
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in #YOUR REGION# matching (((Matching unit) has buff #YOUR BUFF#) Equal to True)) and do (Actions)
    • Loop - Actions
      • Unit - Kill (Picked unit)
It still leaks a boolexpr, but that's unfixable with GUI.
 
Level 6
Joined
Jun 8, 2008
Messages
256
After some arguing in the chat if I needed the custom script or not, I came to the conclusion that I'll use it.

Anyhow, +rep for helping! :D

Wow, you were talking without me knowing.

Won't this leak though?
  • Unit Group - Pick every unit in (Units in #YOUR REGION# matching (((Matching unit) has buff #YOUR BUFF#) Equal to True)) and do (Actions)
 
Status
Not open for further replies.
Top