• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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