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.
    [01:35 am]
    Ultraviolet -- Vrael
    Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
    Gonna put deez sportballs in your mouth
    [01:24 pm]
    Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
    [2024-4-30. : 5:08 pm]
    Oh_Man -- https://youtu.be/lGxUOgfmUCQ
    [2024-4-30. : 7:43 am]
    NudeRaider -- Vrael
    Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
    Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
    [2024-4-29. : 6:36 pm]
    RIVE -- Nah, I'm still on Orange Box.
    [2024-4-29. : 4:36 pm]
    Oh_Man -- anyone play Outside the Box yet? it was a fun time
    [2024-4-29. : 12:52 pm]
    Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
    [2024-4-29. : 11:17 am]
    Zycorax -- :wob:
    [2024-4-27. : 9:38 pm]
    NudeRaider -- Ultraviolet
    Ultraviolet shouted: NudeRaider sing it brother
    trust me, you don't wanna hear that. I defer that to the pros.
    [2024-4-27. : 7:56 pm]
    Ultraviolet -- NudeRaider
    NudeRaider shouted: "War nie wirklich weg" 🎵
    sing it brother
    Please log in to shout.


    Members Online: Ultraviolet, Roy