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

Super Noob Question? How to pick all units by a player?

Not open for further replies.
Level 1
Apr 12, 2009
Hi, It's been driving me crazy that I can't find a GUI based function that picked all units owned by a player. I was able to do this in Warcraft 3, but I've started messing around with the SC2 editor and can't find a function for it.

You can see a screenshot here of me trying to do it.

Uploaded with ImageShack.us

Your help is much appreciated.
Level 1
Apr 12, 2009
Hi, thank you very much for the replay, but I still have the problem. In the screenshot provided, even If I changed the parameter from Any to 1, it still works on only one unit that is randomly selected.

Is there a way to change (Any Units) to (All Units)?

Dr Super Good

Spell Reviewer
Level 63
Jan 18, 2005
There is no Any Units on screen, The "Any" is for the type (so all unit types are choosen). As it is it should be choosing all units matching that filter and running the actions on them.

The problem is the actions are probably total nonsense. The Wait is most likly messing up the enumeration on all units.

How to fix? Simple

1. Create group of units to affect and store as local.
2. Change movement speed of all units in group.
3. Wait
4. Change movememnt speed of all units in group.

Thus you are after enumerating through the group before the wait and after the wait. Storing the group as a local means multiple instances can run with no clash of variable space.
Level 7
Aug 13, 2007
This is an example of how I do it:

  • Kill Everything
    • Events
      • UI - Player Any Player presses K key Down with shift Allow, control Allow, alt Allow
    • Local Variables
      • g = (Any units in (Playable map area) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) <Unit Group>
      • u = No Unit <Unit>
      • ut = No Game Link <Game Link - Unit>
      • cv = (Integer((Custom value CVS of u))) <Integer>
      • p = 0 <Integer>
    • Conditions
    • Actions
      • General - Custom Script: gf_DebugMsg(StringToText("3..."));...
Wait(1.0, c_timeGame);
Wait(1.0, c_timeGame);
Wait(1.0, c_timeGame);
gf_DebugMsg(StringToText("MAP CLEARED!"));
while (!UnitGroupLoopDone()) {
    lv_u = UnitGroupLoopCurrent();
    lv_p = UnitGetOwner(lv_u);
    lv_ut= UnitGetType(lv_u);
    if (lv_ut == gv_sheep) {
        gv_sheepCount[lv_p] += -1;
        gv_livestockTotal[lv_p] += -1;
        UnitGroupRemove(gv_livestockGroup[lv_p], lv_u);
        lv_cv = FixedToInt(UnitGetCustomValue(lv_u, gv_CVS));
        if (gv_gender[lv_cv]) {
            gv_sheepMale[lv_p] += -1;
        } else {
            gv_sheepFemale[lv_p] += -1;
        gv_indexerArray[lv_cv] = false;
    } else if (lv_ut == gv_tree) {
        gv_treesCount += -1;
    } else if (lv_ut == gv_farmerMale) {
        gv_farmersMaleCount[lv_p] += -1;
    } else if (lv_ut == gv_farmerFemale) {
        gv_farmersFemaleCount[lv_p] += -1;
Not open for further replies.