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

[General] Two Questions on Unit Groups

Status
Not open for further replies.
Level 4
Joined
May 20, 2011
Messages
59
Hey Guys,
How do you create a Unit Group through a Custom Script/JASS? And also, is it possible to check if a Unit Group is Empty and if so how would both of these things be accomplished through Triggers? Thanks so much!
Cordially,
Adorm
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
This creates an empty group:
JASS:
local group g = CreateGroup()
If you want to pick units in range of a point you can use:
JASS:
call GroupEnumUnitsInRange(g,x,y,radius,null)
To check if group g is empty you can check:
JASS:
if(FirstOfGroup(g)==null) then

endif
 
Level 4
Joined
May 20, 2011
Messages
59
This creates an empty group:
JASS:
local group g = CreateGroup()
If you want to pick units in range of a point you can use:
JASS:
call GroupEnumUnitsInRange(g,x,y,radius,null)
To check if group g is empty you can check:
JASS:
if(FirstOfGroup(g)==null) then

endif
Is it possible to check if the group is empty through a normal GUI Function?
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
Boolean Comparison - Unit Group - Unit Group is empty
  • ((Last created unit group) is empty) Equal to True
 
Status
Not open for further replies.
Top