FirstOfGroup, GetUnitsInRangeOfLocMatching, etc

elmstfreddie

The Finglonger
Reaction score
203
Just wondering, what order (if there is any order) does GetUnitsInRangeOfLocMatching take units? You'd expect FirstOfGroup to get the nearest, but apparently it doesn't. So I was just wondering how it makes the order of units in a unit group, or if there is any order, etc etc.
 

elmstfreddie

The Finglonger
Reaction score
203
Well, it can't just RANDOMLY do it, that's like impossible. There's gotta be some order, and I wanna know it, lol
I guess I could spend my time doing experiments do find it out... Got nothing better to do (sadly)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
You have no idea how the game works internally.

Presumably, it has at least one list with units currently on the map.
Chances are there is one.
Or several.
What type of list is it though?
...
No idea?
Yep.

So there's also no real way to guess how the game goes about finding, for example, "every unit owned by players 2-5 that have a health > 50%"...

It goes through its list(s), and finds them... that's about it.
 

elmstfreddie

The Finglonger
Reaction score
203
So presumably it's the order they were placed on the map in, or created, right? Wrong? Yes? No?
If that's true what you said, then, I guess there's no way that you can use this to some kind of evil advantage.
 

Jazradel

Helping people do more by doing less.
Reaction score
102
I thought it did units by x/y from left to right, top to bottom.

I've also heard it was set by the units priority, though I have my doubts.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> that makes sense

Barely.

Pikcing units in a region for example... if they were to check every single point in that region and compare it to the position of every unit...
Man, that would be slow as all hell.
Clearly, they use something more advanced.
Occasionally, it might appear as left-right, top-bottom, but that's coincidence at best.
 

N-a-z-g-u-l

New Member
Reaction score
30
i expiremented with FirstOfGroup() once, too, and buildings were always picked before units (or the other way around, but i think bulidings first)
perhaps it has a building list and a unit list, or sorts by classifications, or, which is what i believe, it takes the buildings because they are placed on the map from the beginning...
another possibility is, that they are sorted by their handle ids
 

Exide

I am amazingly focused right now!
Reaction score
448
> it takes the buildings because they are placed on the map from the beginning...

Not necessarily..
So you mean pre-placed units are picked first?
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
> it takes the buildings because they are placed on the map from the beginning...

Not necessarily..
So you mean pre-placed units are picked first?

Most likely since they are the ones that are stored in generated globals.
 

Sooda

Diversity enchants
Reaction score
318
Shall we start testing ? I gonna try adding same units to same location on map with locust. Then there isn' t much to be compared and start to check what unit was picked first. This is getting interesting.
 

Exide

I am amazingly focused right now!
Reaction score
448
>Shall we start testing ? I gonna try adding same units to same location on map with locust. Then there isn' t much to be compared and start to check what unit was picked first. This is getting interesting.

Do share your results. :)
 

Sooda

Diversity enchants
Reaction score
318
O boy ! First results !

I made cool test map what has all possible natives what 'collect' units on map. I just made first test to GroupEnumUnitsInRect native (In GUI pick every unit on playable map area.) with ten Footmen placed with Locust ability exactly to map center (X and Y coordinates are 0.).

Still want to hear what happened ?

Seriously ?

You must be kidding me...

Oh, you' r not ?

:p

Each time it was picked last unit created with CreateUnit native, my tenth Footman. I did 3 times map restart to be sure, after 300 GroupEnumUnitsInRect native calls still it picked my tenth Footman. 100 % it picked it. I didn' t added yet 'give order from FirstOfGroup return value to last FirstOfGroup return value, but I bet it will be from lastly created unit to oldest created unit.

We have very first parts of these GroupEnum native lists revealed. Isn' t it exciting ?
I plan to upload my little demo map so every kid can start to find answer to our mysterious FirstOfGroup native return value.
 

N-a-z-g-u-l

New Member
Reaction score
30
the units had locust ability? are you sure? i mean, normally locust units are not even picked into groups...

and make more tests than 1 :p
with random locations for example, if its still the same result... and try creating 10 new footmans with some footmans already existing in the map, perhaps its just because of a handle space or something like that, which is free at that moment, but not, if you have pre-placed units
 

Exide

I am amazingly focused right now!
Reaction score
448
>the units had locust ability? are you sure? i mean, normally locust units are not even picked into groups...

They're picked if you define something like '(Matching Unit) has Locust buff' or something, right?
 

Sooda

Diversity enchants
Reaction score
318
> normally locust units are not even picked into groups...

Normally... we don' t deal with normal things here... :p I store each created unit into variable and compare variable directly.

> and make more tests than 1 with random locations for example

With first sentence part I agree, with second part of it no ! I get your idea but it isn' t randoming. If I start to place units randomly on map I will never figure out why some of them are picked before others.
Instead I have to compare conditions like will unit (same type) will be picked always first from north of map or from south. Will Archer be picked before Footman or Archimonde before Arthas, etc. Simple ones :D If you still want to start from randoming and then trying to find some logic from it, good luck.

> They're picked if you define something like '(Matching Unit) has Locust buff' or something, right?

No, they even will be not considered as 'matching' to start that comparison.
 

emjlr3

Change can be a good thing
Reaction score
395
what does this matter?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top