Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Detect adjacent nodes in a network/breadth-first search
Detect adjacent nodes in a network/breadth-first search
Jan 29 2022, 8:41 pm
By: Brusilov  

Jan 29 2022, 8:41 pm Brusilov Post #1



Basically, my map will involve players defeating their opponents in war and being able to annex territory from them - but they're limited in how much they can take, and this territory must be adjacent to the conqueror's territory, or contiguous to other territories they're also going to conquer. In this case, we'll say the hard limit is 1 or 2 provinces ("Duchies"). For example:



Red (The Holy Roman Empire) has defeated blue (France). The grey lines represent the connections between duchies, and thus whether or not they are adjacent. Each duchy has its own specific location, and each Cybernetics Core is also an invincible unit with a specific Unit Index ID. Red is now going to enforce peace against blue and annex a duchy (at the moment, my plan is to do this via blue clicking a button on the Duchy of his choice that he's occupying, which will put a unit into the build queue and activate a trigger.)

However, blue is demanding the Duchy outlined in yellow, which cannot be demanded because it is not adjacent to any of his territories. This should spit out an error for blue, telling him to try again.

Now, I know I could simply do this via a trigger like this:

Triggername
Players

  • Player Force
  • Conditions

  • Current Player brings 'Annex Duchy Unit' to 'Location 3'
  • Current Player brings 0 Protoss Cybernetics Cores to 'Location 1'
  • Current Player brings 0 Protoss Cybernetics Cores to 'Location 2'
  • Current Player brings 0 Protoss Cybernetics Cores to 'Location 4'
  • Current Player brings 0 Protoss Cybernetics Cores to 'Location 5'
  • Current Player brings 0 Protoss Cybernetics Cores to 'Location 6'
  • Actions

  • Remove 1 'Annex Duchy Unit' at 'Location 3'
  • Display Text 'Not allowed. Please select a duchy adjacent to your holdings.'


  • And then I could copy and paste this trigger about 150 times and manually change the locations/unit indexes of EUDs for each trigger. But that's a lot of work and it's pretty likely I'll screw up at least a few of them and have to bugtest later. I thought about using a location and simply centering it over the target, then detecting whether Current Player brings at 'at least 2' Duchies, but the layout of my map is highly irregular and this would be unreliable.

    Is there another way that this could be done, perhaps with fewer triggers, perhaps by using arithmetic on the Unit Index IDs? I feel like the basic principle here is to conduct a breadth-first search, but I'm not sure how to break it down into Starcraft triggers.

    Post has been edited 1 time(s), last time on Jan 29 2022, 8:50 pm by Brusilov.



    None.

    Jan 30 2022, 8:55 am GGmano Post #2

    Mr.Pete-Tong

    You can do a full scale cycle by having a trigger with give 1 cyber Core from current player to p8.

    And a trigger with condition current p bring 0 cyber core than give All cyber core p8 back to current p.

    That way you can do a specific action for All the owned cyber cores one at a time



    A Legendary Map Maker, Player. Apparently im more than intresting to observe Irl

    Ill try do my best in making all youre watchers happy

    The maps I made are tweaked into perfection and maximum strategy added

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [06:24 pm]
    NudeRaider -- "War nie wirklich weg" 🎵
    [03:33 pm]
    O)FaRTy1billion[MM] -- o sen is back
    [01:53 am]
    Ultraviolet -- :lol:
    [06:51 pm]
    Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
    [06:50 pm]
    NudeRaider -- Vrael
    Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
    sounds like moisture control is often a pressing concern in your city
    [06:50 pm]
    Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
    [06:49 pm]
    Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
    [06:48 pm]
    Vrael -- On this Topic, I could definitely use some Introductions.
    [06:48 pm]
    Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
    [06:47 pm]
    Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
    Please log in to shout.


    Members Online: RIVE, NudeRaider