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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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