• 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.

How to set control groups in jass?

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
I've done something similar for some Guitar Hero rip-off I made, but the player must still press CTRL...
It's not possible to mimic/force "CTRL" (not SHIFT) in the editor.

JASS:
loop
    set i = i+1
    exitwhen i > 5
    call ClearSelection()
    call SelectUnit(udg_Unit[i], true)
    call ForceUIKey(I2S(i))
endloop

That's what I did.

This loop keeps running until the control groups have been set.
That means the player has to hold CTRL for about half a second in order to set all control groups to what they should be.

In my map, you cannot start the game until the player pressed CTRL.
 
Level 5
Joined
Nov 7, 2007
Messages
134
I suppose the closest thing you could do is causing player to select a certain group when doing something, in GUI that could be creating a trigger with the event "types chat message" or "selects unit" or something, I'm not familiar with Jass but I can imagine there must be similiar functions you can do with it. In GUI you can set the player pressing one of the arrow keys as an event, which could be used for accessing a control group just as quickly as with CTRL + number. The downside is that this will also move the screen a little, but if you could live with that this might be an idea. But yeah, that's GUI, I don't know how to do it in Jass.

EDIT: And I didn't read ap0calypse post before posting, that solution seems smoother anyway.
 
Status
Not open for further replies.
Top