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

    you could be the rat??

    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.
    [2026-10-11. : 6:02 am]
    Donald -- Samase
    [2026-10-09. : 2:53 am]
    Mr.BurnLiquid -- Symmetry
    Symmetry shouted: I'll check it out this weekend!
    Thanks
    [2026-10-09. : 2:47 am]
    Symmetry -- I'll check it out this weekend!
    [2026-10-09. : 2:40 am]
    Mr.BurnLiquid -- Symmetry
    Symmetry shouted: Another map maker? Damn we really ARE back
    I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
    [2026-10-09. : 2:27 am]
    Symmetry -- Another map maker? Damn we really ARE back
    [2026-10-09. : 1:51 am]
    Mr.BurnLiquid -- Ultraviolet
    Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
    Now that I wanted to change my avatar, the error image is showing up, haha.
    [2026-10-09. : 1:34 am]
    Mr.BurnLiquid -- Ultraviolet
    Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
    Mr.BurnLiquid
    Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
    I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
    [2026-10-09. : 1:33 am]
    Mr.BurnLiquid -- Ultraviolet
    Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
    Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
    [2026-10-09. : 1:31 am]
    Ultraviolet -- Mr.BurnLiquid
    Mr.BurnLiquid shouted: Ultraviolet Is it forbidden to have a large avatar?
    actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
    Please log in to shout.


    Members Online: Milestone