FirstOfGroup, GetUnitsInRangeOfLocMatching, etc

Sooda

Diversity enchants
Reaction score
318
> what does this matter?

I agree there isn' t very solid answer why it is so important but maybe elmstfreddie will answer why he wants to know it.
Maybe answer would be because FirstOfGroup returns random unit, but we could know what it will return if we would know how it picks them. Then you could use that knowledge for picking Archer before Footman and not needing to do comparison is unit type Archer or something that.

EDIT: ROFL !!!! Locust units aren' t picked by GroupEnum functions, good point N-a-z-g-u-l and Exide >.< ! Rofl ! I gonna do new tests without locust but with 0 collision size instead :D .

EDIT2: Ok, now when I have fixed the *sigh* small bug of my test map I can tell you it is reversed :D ! It always picks first unit what was created with CreateUnit native and lastly from group is retrieved tenth Footman. I did quick check but it was opposite to my previous ones and all other units was picked in order of creation. Firstly very first unit created on map, then second, then third, etc.
Sorry for first *sigh* small bit of miss leading info.
By the way with 0 collision size they still get clustered around map center and that didn' t affect result. So I guess unit position on map isn' t in any way connected to 'picking unit' when getting all of them. It comes into play when you pick units in range or region I assume.
 

Exide

I am amazingly focused right now!
Reaction score
448
>Normally... we don' t deal with normal things here...
Oh-so-True! :)

>No, they even will be not considered as 'matching' to start that comparison.
Hmm, I think I saw somewhere, someone mention there was a way to pick Locust units.. Maybe I was wrong about the (Matching Unit) part, or maybe I simply remember wrong? :p
 

Sooda

Diversity enchants
Reaction score
318
> someone mention there was a way to pick Locust units..

Most known way is to order or manipulate unit with Locust by using instead unit it' s unit variable what points to that unit aka holds that unit.

My test map starts to get complete, I add few chat commands and few functions and you all can mess with it. It even will feature cool visual effects what will point to unit with Shop arrow who was picked first.

My so far conclusion is that it always picks units before who was created with native CreateUnit. Even in GroupEnumUnitsInRange picked first unit what was created before.

LAST EDIT:

I have finished my ultimate FirstOfGroup Test Map. You can choose what you want to test and how you want to. It is so advanced that you may be stunned. I suggest to type first "-help" into chat to see all commands.
My conclusion on some experiments says it just picks first unit what was created first with native CreateUnit (For GUI just create unit). In every GroupEnum pick it picked first and only first very first unit who was created with that native. If you can prove otherwise be my guest. I am so tired of writing and testing and adding help explanations that I can' t do any tests myself. So I ask you to download it and do some tests. If you find something interesting post it here. Map is attached under my post (See attached files.).

EDIT: Map removed.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Picking units in "units of type" and "units owned by player of type" will get Locusts too.

Though, there's no point in them having Locust here... or no collision.
Order them to some random point nearby.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
As for pre-placed units, I have concluded, that the picking pattern is following:

first placed unit for Player(0)
second placed unit for Player(0)
...
last placed unit for Player(0)

first placed unit for Player(1)
...
last placed unit for Player(1)

first placed unit for Player(2)
...
etc.

Why? I put my money on that, the pre-placed units are created on map initialization for each player in a row. (war3map.j)
JASS:

function CreateUnitsForPlayer0 takes nothing returns nothing
    local player p = Player(0)
    local unit u
    local integer unitID
    local trigger t
    local real life

    set u = CreateUnit(p, &#039;hfoo&#039;, -6717.9, 6708.3, 270.000)
    ...
endfunction


Another one for Player(1), 2, etc.


I guess it's the same with dynamically created units:

The unit created first for player(0) will be picked first, then the second etc. If all the units for Player(0) are picked, it continues with Player(1), etc.
 

Sooda

Diversity enchants
Reaction score
318
You are right Andrew, and only counts CreateUnit native call, it will add unit created to the list. Then it always picks first unit on list first when unit meets conditions (Dosn' t care will it be 'unit in range' or 'unit in rect'). If I get fixed some minor display bugs and adding some more commands I will upload it again. But so far FirstOfGroup just picks unit' s before who was created on map and thats all, no special patterns to look for.

@ Ace

Did it with default Footmen and results were same.
 

Sooda

Diversity enchants
Reaction score
318
> no special patterns to look for.

Made conclusions too soon >.<

It picks Heroes before units. Soon coming more.

EDIT:

The list gets updated with new units and there is some kind of a priority what will be picked first. But I don' t know it.

I spent much time updating and fixing small bugs in map. You know can create to any player (Neutral Players included) any unit. You can set each unit health and mana if you want. Shorts out from first to last 'FirstOfGroup' return value and how many times that unit previously was returned as 'FirstOfGroup' value. Displays currently available test info about lastly or currently selected unit. You can use help menu to navigate and seek out commands what interests you. All 'GroupEnum' natives listed. Freedom to easily set test values. Displays test progress and test can be canceled at any time. Shorts out and includes in tests all pre-placed units or in real time created units.
Latest test map can be found under my post (See attached files).
 

Attachments

  • FirstOfGroupTestMap12.w3x
    31.7 KB · Views: 129
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top