Units Control Groups

dracolich

TH.net Regular
Reaction score
15
As every know, u can bind units into groups by Ctrl+1/2/3/...
is exist way to know, was some unit binded in some group, or get units in some of this group?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Is it possible to use numbers with [ljass]ForceUIKey[/ljass]? (I am away from WC3 and can't try right now.) If so, force each number key and, after a slight delay, get the unit group of the player's unit selection? (This would not be a player-friendly method.)
 

vypur85

Hibernate
Reaction score
803
If you mean via trigger, it's not possible, as far as I know. It's been discussed many times in the forum already. Not sure about all those second party addon editors though.
 

DioD

New Member
Reaction score
57
its no possible from standart editor, there is no native to get content of stored groups or event for group storage.

you may code it useleft with RTC and C++
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Is it possible to use numbers with [ljass]ForceUIKey[/ljass]? (I am away from WC3 and can't try right now.) If so, force each number key and, after a slight delay, get the unit group of the player's unit selection? (This would not be a player-friendly method.)
It works.

GUI example:
Trigger:
  • Actions
    • Game - Force Player 1 (Red) to press the key 2
    • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
      • Loop - Actions
        • Game - Display to (All players) for 1.00 seconds the text: (Name of (Picked unit))


JASS example:
JASS:
function CheckIfHotkeyed takes player whichPlayer, string whichHotkey, unit whichUnit returns boolean
	local boolean result = false
	local group oldSelection = CreateGroup() //Save the player's selection before the check
	local group g = CreateGroup()
	
	//Inlined from GetUnitsSelectedAll
	call SyncSelections()
	call GroupEnumUnitsSelected(oldSelection, whichPlayer, null)
	
	//Left as a BJ because why not
	call ForceUIKeyBJ(whichPlayer, whichHotkey)
	
	//Inlined from GetUnitsSelectedAll
	call SyncSelections()
	call GroupEnumUnitsSelected(g, whichPlayer, null)
	
	set result = IsUnitInGroup(whichUnit, g)
	
	//Left as a BJ because I'm lazy
	call SelectGroupForPlayerBJ(oldSelection, whichPlayer) //Restore the player's selection
	
	call DestroyGroup(g) //Leaks, use a global if not just making an example
	set g = null
	call DestroyGroup(oldSelection) //Leaks, use a global if not just making an example
	set oldSelection = null
	
	return result
endfunction


Tested working in single player, though it is not invisible to the player (the hotkeyed group is visibly selected for a fraction of a second).
 

DioD

New Member
Reaction score
57
not silent and not instant, also we cant force player to map units to group.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top