Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Detecting if a building is under construction
Detecting if a building is under construction
May 13 2014, 7:41 am
By: sethmachine  

May 13 2014, 7:41 am sethmachine Post #1



Hi,

Edit: Looks like "Bring" correctly distinguishes between the two.

Is there anyway to determine if a building is under construction?

I have a problem with a counting mechanism I'm using. Essentially I count the number of buildings a player has by giving them to another player (e.g. P8), and then returning them all when the player has no more buildings (so they all got counted).

The end condition is "Player X commands at most 0 building of type Y." But, a building under construction returns true for this case. The issue is that a player could start building one of these structures and never finish it. The system would then grind to a halt and hang up the game for everyone (until it was finished or destroyed). Furthermore, this makes it necessary to remove building times (which I do not want to do). I cannot give each player their own counting player because I have 6 humans but only 3 (perhaps 4) available extended players. It is not possible to use P7, P8 (or it would be super awkward).



None.

May 13 2014, 8:16 am O)FaRTy1billion[MM] Post #2

👻 👾 👽 💪

If you use Move Location it will move on to a building under construction you can detect if it is under construction using Bring. So if you did commands at least 1, move location, brings 0 to location then that building is under construction.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

May 13 2014, 8:55 am sethmachine Post #3



Actually Bring is doesn't work in all the cases.

I tried this procedure with a Terran Bunker and Terran Academy:

1. If player brings 0 Terran Bunker to Anywhere
2. Display text message: "No bunker"

This works for Terran Bunker and Terran Academy. But Terran Barracks gives a surprising result: it counts incompleted terran barracks (no matter the completion level) as satisfying "Player Brings at least 1 Terran Barracks to Anywhere."

So I can't use Bring to distinguish between a completed and incompleted Terran Barracks.

But another interesting thing about my counting.

If I have any number of incompleted Barracks to the LEFT of a completed one, the system counts the incompleted ones just fine.

BUT, if I have any number of incompleted Barracks to the RIGHT of a completed one, the system stops counting at the completed one and then grinds to a halt. Now this makes no sense, since semantically the position of a building should not determine whether it satisfies being in "anywhere" relative to another building--a building is always in Anywhere (unless we could change the flags but those are at default).

I do not understand this behavior. Here is a snippet of the relevant triggers---how would I fix it to handle incompleted barracks?

Triggers




None.

May 13 2014, 9:18 am Roy Post #4

An artist's depiction of an Extended Unit Death

Quote from sethmachine
The end condition is "Player X commands at most 0 building of type Y." But, a building under construction returns true for this case.
From the context, I believe you mean this condition is false when there is a building under construction. Farty's solution is one of the best for detecting if a building is under construction.

As per the Quirks and Nuances article we all know and love:
Quote from Wiki
Incomplete buildings cannot be detected in any conditions that use the "at least" or "exactly" modifiers, but they can be counted using the "at most" modifier; unfortunately this is generally not very useful. Incomplete buildings will be considered for actions.
An alternative to Farty's solution would be to have a two-step trigger process where the first trigger with a condition of "exactly 0" sets a switch, and then the second trigger checks "at most 0" and clears the switch. If the switch remains set, it means there is a building under construction.

Although for the system you described, it would probably be best to exclude incomplete buildings from the calculation: after all, you don't really have the building until it's finished. Change your "at most 0" to "exactly 0" and it will ignore incomplete buildings.



On a slight tangent, saying "at most 0" outside of the context of incomplete units is pointless: values cannot be less than 0 in SC triggers, so when checking for 0, it makes sense to just say "exactly." In fact, -1 is greater than 0 because the fields are unsigned integers, meaning entering "-1" into SCMDraft simply underflows the value to the largest integer value (4294967295). (i.e., "Commands at least -1 [any unit]" would always return false.)

Edit:
Quote from sethmachine
This works for Terran Bunker and Terran Academy. But Terran Barracks gives a surprising result: it counts incompleted terran barracks (no matter the completion level) as satisfying "Player Brings at least 1 Terran Barracks to Anywhere."

So I can't use Bring to distinguish between a completed and incompleted Terran Barracks.
That's news to me.




May 13 2014, 9:30 am sethmachine Post #5



Edit2: Nevermind, I forgot to switch to the fixed map. The triggers appear to work now, correctly ^^

Edit: I tried using Exactly but it still does not fix the problem and counts incompleted buildings. Strangely, it only counts incompleted buildings that are to the left of a completed building. Please advise...

Revised Triggers with Exactly


Oh wow that is quite a nuance. I've never even heard of it!

But I think I am wrong in saying Terran Barracks is different--I think I used "exactly" for the bunker and academy, but still "at most" for the barracks. The result is now what would be predicted and not surprising.

This fixes my problem I believe, just changing them all to "exacts."

Many many thanks Roy and Farty.

Post has been edited 2 time(s), last time on May 13 2014, 10:03 am by sethmachine.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:53 pm]
Oh_Man -- https://youtu.be/MHOZptE-_-c are yall seeing this map? it's insane
[2024-5-04. : 1:05 am]
Vrael -- I won't stand for people going around saying things like im not a total madman
[2024-5-04. : 1:05 am]
Vrael -- that's better
[2024-5-04. : 12:39 am]
NudeRaider -- can confirm, Vrael is a total madman
[2024-5-03. : 10:18 pm]
Vrael -- who says I'm not a total madman?
[2024-5-03. : 2:26 pm]
UndeadStar -- Vrael, since the ad messages get removed, you look like a total madman for someone that come late
[2024-5-02. : 1:19 pm]
Vrael -- IM GONNA MANUFACTURE SOME SPORTBALL EQUIPMENT WHERE THE SUN DONT SHINE BOY
[2024-5-02. : 1:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[2024-5-01. : 1:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 5:08 pm]
Oh_Man -- https://youtu.be/lGxUOgfmUCQ
Please log in to shout.


Members Online: lil-Inferno, Zycorax