Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Detecting if a reaver has no scarabs?
Detecting if a reaver has no scarabs?
May 31 2010, 2:04 pm
By: Aristocrat  

May 31 2010, 2:04 pm Aristocrat Post #1



Essentially, the player has a reaver, and I wish to destroy it when it fires the first shot/has no remaining scarabs. I have tried several trigger conditions, such as "Command", "Bring", etc., but none seem to work. Most intriguing is the fact that BOTH of the following conditions

Quote
Bring("Current Player", "Protoss Scarab", "field", At least, 1);
Quote
Bring("Current Player", "Protoss Scarab", "field", At most, 0);

return "true" no matter what. (That means if they are put in the conditions of the SAME trigger, the trigger will still fire. wut)

How do I accomplish this? The player will have at most one reaver at any time and will only ever have one scarab.

EDIT> I figured out how to do it, but I am still not aware of the reason why those two conditions can be simultaneously true. Would anyone care to elucidate? :><:

Post has been edited 1 time(s), last time on May 31 2010, 2:12 pm by Aristocrat.



None.

May 31 2010, 2:54 pm Heinermann Post #2

SDE, BWAPI owner, hacker.

I would've thought command would work.
What happens if you switch the order of the conditions?




May 31 2010, 3:06 pm Cinolt Post #3



It only returns true when a scarab is inside the reaver. So my guess is that a scarab still inside a reaver returns as a negative value with the bring condition and StarCraft doesn't handle the comparisons as expected.



None.

May 31 2010, 3:55 pm Aristocrat Post #4



Quote from Heinermann
I would've thought command would work.
What happens if you switch the order of the conditions?

Still fires for some incomprehensible reason.

I suppose -1 is at most 0 and at least 1, but I don't see how you can bring -1 of a unit to a location...



None.

May 31 2010, 4:26 pm Gidoza Post #5



I had a similar problem recently, but I figured out how to get around it. I've found that if a unit is loaded in a transport, regardless of location levels, ANY value you place on "at most" and ANY amount of units of that type on the screen loaded in transports will return true.

However, when I used "exactly", it worked perfectly.

Try using Exactly 0 and see if it doesn't work for Scarabs as well.



None.

May 31 2010, 4:42 pm Cinolt Post #6



If my theory is correct then one reason it would return negative is for a special case like a scarab inside the reaver, because it's not visible but it's still there. It isn't detecting that -1 of a scarab is brought there, it's just returning a reserved value for the special case which is negative because in a normal case you can't bring a negative number of units to a location.



None.

May 31 2010, 4:48 pm Gidoza Post #7



Oops, sorry kwun, I didn't want to minusate your post. =P For some reason I never noticed before what those pluses and minuses were and decided to click one to see what it did, haha.



None.

May 31 2010, 9:40 pm Azrael Post #8



I thought this was more commonly known than it apparently is. Gidoza is right, the problem here is that you are using "at most" instead of "exactly". Conditions using "exactly" and "at least" work the same way, but "at most" operates under its own set of rules, such as detecting unfinished buildings. You should never be using "at most 0" unless you're specifically trying to get some sort of special effect from it.

In this specific instance, the reason your conditions are both coming back true is because "at most" does not detect units that are within other units, such as units in a shuttle, scarabs in a reaver, etc.

That being the case, "at most" will always return a value of 0 when checking for scarabs. Use "exactly" and you can detect their quantity the way you are expecting it to work.

Post has been edited 2 time(s), last time on Oct 12 2010, 12:23 pm by DevliN. Reason: Mineral abuse.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[03:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[01:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[01:52 am]
Vrael -- hah do you think I was born yesterday?
[01:08 am]
O)FaRTy1billion[MM] -- i'll trade you mineral counts
[2024-4-16. : 5:05 pm]
Vrael -- Its simple, just send all minerals to Vrael until you have 0 minerals then your account is gone
[2024-4-16. : 4:31 pm]
Zoan -- where's the option to delete my account
[2024-4-16. : 4:30 pm]
Zoan -- goodbye forever
Please log in to shout.


Members Online: Roy, jjf28, l)ark_ssj9kevin, O)FaRTy1billion[MM], lil-Inferno