• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Need help with a 'kill all units in location' trigger

Status
Not open for further replies.
Level 3
Joined
Jul 19, 2008
Messages
27
I'm trying to figure out how to make a kill trigger for a bound map, but there aren't really any to go off of.

I want a trigger that basically says 'kill all units at X location'

I've been tinkering with this for quite awhile, and don't know if I'm overlooking something simple or what.

Any help is appreciated,

Thanks
 
Level 5
Joined
Jun 10, 2010
Messages
145
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Region 000 <gen>) and do (Unit - Kill (Picked unit))
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
You can either pick units in given Region or in area of given point.
@Spartan-117, you have forgotten about removing group, trigger leaks.
  • Init
    • Events
      • <your event>
    • Conditions
      • <your conditions>
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 000 <gen>) and do (Unit - Kill (Picked unit))
If we speak about point:
  • Init
    • Events
      • <your event>
    • Conditions
      • <your conditions>
    • Actions
      • Set temp_point = <your position>
      • Unit Group - Pick every unit in (your_range of temp_point) and do (Unit - Kill (Picked unit))
      • Custom script: call RemoveLocation (udg_temp_point)
If you want do add any conditions for selecting units in given group, add them while picking in action Unit Group - Pick ever unit (...)
 
Level 5
Joined
Jun 10, 2010
Messages
145
I didn't remove the leaks because I'm used to don't remove them....I don't know why, but codes of custom scripts or JASS doesn't work for me. :(
Everytime that I try a code in JASS (copied from aproved stuff) the editor disable my triggers.
 
Level 3
Joined
Jul 19, 2008
Messages
27
You can either pick units in given Region or in area of given point.
@Spartan-117, you have forgotten about removing group, trigger leaks.
  • Init
    • Events
      • <your event>
    • Conditions
      • <your conditions>
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 000 <gen>) and do (Unit - Kill (Picked unit))
If we speak about point:
  • Init
    • Events
      • <your event>
    • Conditions
      • <your conditions>
    • Actions
      • Set temp_point = <your position>
      • Unit Group - Pick every unit in (your_range of temp_point) and do (Unit - Kill (Picked unit))
      • Custom script: call RemoveLocation (udg_temp_point)
If you want do add any conditions for selecting units in given group, add them while picking in action Unit Group - Pick ever unit (...)

This is my trigger

  • Ob1
    • Events
      • Time - Every 1.50 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob1 <gen>) facing Default building facing degrees
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob3 <gen>) facing Default building facing degrees
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob5 <gen>) facing Default building facing degrees
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob7 <gen>) facing Default building facing degrees
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob9 <gen>) facing Default building facing degrees
      • Unit Group - Pick every unit in (Units in 1ob1 <gen>) and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in (Units in 1ob3 <gen>) and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in (Units in 1ob5 <gen>) and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in (Units in 1ob7 <gen>) and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in (Units in 1ob9 <gen>) and do (Unit - Kill (Picked unit))
      • Wait 0.75 seconds
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob2 <gen>) facing Default building facing degrees
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob4 <gen>) facing Default building facing degrees
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob6 <gen>) facing Default building facing degrees
      • Unit - Create 1 Ghoul for Player 12 (Brown) at (Center of 1ob8 <gen>) facing Default building facing degrees
      • Unit Group - Pick every unit in (Units in 1ob2 <gen>) and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in (Units in 1ob4 <gen>) and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in (Units in 1ob6 <gen>) and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in (Units in 1ob8 <gen>) and do (Unit - Kill (Picked unit))
My map is full of stuff like this. I assume this is creating a leak/causing unplayable lag after 3 minutes? What's a better way I could do the same thing without cauing a leak?

I'm not familiar with writing triggers through JASS, so any help would be appreciated.

Thanks!
 
Level 3
Joined
Jul 19, 2008
Messages
27
You should get Leak check. you just copy the trigger as text and shows you where you have leaks in your trigger.

ty very much. I downloaded this, and found 18 leaks just in that one trigger I posted. I don't even have to scan to know most of my other ones will have leaks as well.

So I was right about the problem... but how can i fix it? I'm not used to having to find solutions around leaks.. so I'd appreciate a point in the right direction.

Thanks,
 
Status
Not open for further replies.
Top