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:39 am]
    Ultraviolet -- no u elky skeleton guy, I'll use em better
    [10:50 pm]
    Vrael -- Ultraviolet
    Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
    hey cut it out I'm getting all the minerals
    [10:11 pm]
    Ultraviolet -- :P
    [10:11 pm]
    Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
    [2024-4-17. : 11:50 pm]
    O)FaRTy1billion[MM] -- nice, now i have more than enough
    [2024-4-17. : 11:49 pm]
    O)FaRTy1billion[MM] -- if i don't gamble them away first
    [2024-4-17. : 11:49 pm]
    O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
    [2024-4-17. : 3:26 am]
    O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
    [2024-4-17. : 1:53 am]
    Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
    [2024-4-17. : 1:52 am]
    Vrael -- hah do you think I was born yesterday?
    Please log in to shout.


    Members Online: Frabotta