• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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