Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Question of tracking what units are closest in proximity to a si
Question of tracking what units are closest in proximity to a si
Sep 26 2017, 8:56 am
By: m.0.n.3.y  

Sep 26 2017, 8:56 am m.0.n.3.y Post #1



Question of tracking what units are closest in proximity to a single central unit

So here's the situation.

I have a human p1 controlling a single zergling. Players 4, 5, and 6 also have a single zergling each. I would like to track which player (4, 5, or 6) is closest in proximity to the p1's zergling.

The way I've thought of to do this is to stack multiple locations on top of p1's zergling, each being normal grid square than the last. For example, Location 1 would be the size of the zergling, location 2 would be 1 normal grid square bigger than location 1 on all sides, location 3 would be 1 normal gride square bigger than location 2 on all sides, and so on and so on. If X = zergling the visual would be this: X,location 1, location 2, location 3, location 4.

The triggers would be something like this:
Trigger
Players

  • Player 1
  • Conditions

  • Player 4 brings exactly 1 Zergling to Location 4
  • Player 5 and 6 bring exactly 0 Zergilng to Laction 3
  • Actions

  • Then it is determined that player 4 is the closest


  • Then repeat this for each location and each player.

    If two players are the same distance, as in p5, and p6 are both in location 3, then I'd just say that p5 is the closest. Tie just goes to one of the players.

    That's my idea, I was wondering if there's a better or more accurate way to do this? Or would this work just fine?

    Thanks for your help guys



    None.

    Sep 26 2017, 5:03 pm Roy Post #2

    An artist's depiction of an Extended Unit Death

    This would be a sufficient implementation for your requirements. It's worth pointing out that you can use the same set of locations for all players, so the number of locations you'll be using won't increase with the number of players.




    Sep 27 2017, 2:06 am m.0.n.3.y Post #3



    Quote from Roy
    This would be a sufficient implementation for your requirements. It's worth pointing out that you can use the same set of locations for all players, so the number of locations you'll be using won't increase with the number of players.
    Awesome thanks Roy!



    None.

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [2026-8-06. : 2:41 am]
    Oh_Man -- i used to play TF2 competitive in that clan, and also was PR manager (ie: i wrote all the website posts)
    [2026-8-06. : 2:41 am]
    Oh_Man -- another fun fact iaguz actually joined the clan i was part of - Frenetic Array
    [2026-8-06. : 2:40 am]
    Symmetry -- Human memory is a fragile, fallible thing
    [2026-8-06. : 2:39 am]
    Oh_Man -- i realised all his shit was halluc and i wiped out his measly army of fake hallucs and he called GG - yeah thts wat actually happened damn false memory strikes again
    [2026-8-06. : 2:38 am]
    Oh_Man -- i was zerg, the toss guy did a bunch of hallucinates, and i was like, welp, i guess i'm dead, but i have that mindset of never giving up, so attacked him anyway, then tht was wen
    [2026-8-06. : 2:38 am]
    Oh_Man -- coz i was actually a zerg main, so wat ACTUALLY happened was a complete reverse of this
    [2026-8-06. : 2:37 am]
    Oh_Man -- i found an old comment of mine i actually think the idra thing over-ride my own memory
    [2026-8-06. : 2:22 am]
    Symmetry -- was it idra
    [2026-8-06. : 1:52 am]
    NudeRaider -- Oh_Man
    Oh_Man shouted: and i went on to win the tournament, and a pair of steelseries headphones. i even reember how i won the final match - hallucinated a fck-tonne of units and my opponent thought i had way more than he did and GGed
    classic
    [2026-8-05. : 2:56 pm]
    Oh_Man -- long story short - patience is a virtue!
    Please log in to shout.


    Members Online: Vorgozz, Sie_Sayoka