• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Grouping units within range

Status
Not open for further replies.
Level 13
Joined
Mar 29, 2012
Messages
530
Think of 7 units on the ground, five are close to each other (with distances between each: less than 500), the two other are some distance away from those five.
How to calculate and recognize those five?

What I'm trying to make is a function that will do pick nearby units within range and group all units that are close together (forming a squad group).
 
Level 13
Joined
Mar 29, 2012
Messages
530
This would be painful to do in GUI and JASS, slightly less painful to do in vjass, and easy to do in wurst. What do you want the solution in?
I always want for anything I made can be edited with the original vanilla editor while achieving best performance. So I would prefer JASS. :)
Even if it painful.

Edit
What I really need is just what kind of approach to achieve this and how?
 
Last edited:
I can code this but it'll be painful. I will make it a jass script with gui interaction.

EDIT: alright, so WE crashed when I saved a faulty jass script. I won't be coding anything in this garbage.

Instead, I will explain:
1) Pick all units in the range of the spell
2) For each unit, create a group, and put all units that are close enough (<500 range) in that group, including that unit
3) Keep track of the group with the biggest number of units, with a minimum of (let's say, 3)
4) Pick all units in that ^ group and do whatever you want the spell to do
5) Destroy all groups since you won't be using them anymore
 
Last edited:
Status
Not open for further replies.
Top