Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: How does income defense work
How does income defense work
This topic is locked. You can no longer write replies here.
May 11 2009, 8:22 am
By: fool  

May 11 2009, 8:22 am fool Post #1



Lets say I have a player that has some score like custom at 5, or deaths of supply depot at 10.

How would I make a trigger that says

conditions - always
actions - create ( # custom) marines at location xxxx

Or if I was doing income it would be set resources to add (# of deaths of supply depot) ore to player xxxx



None.

May 11 2009, 8:37 am rockz Post #2

ᴄʜᴇᴇsᴇ ɪᴛ!

Conditions:
score is x
Actions
Subtract x score
add x deaths
create x marines

Repeat (x = some binary number, like 64, 32, 16, 8, 4, 2, 1, in that order. This will make 127 marines max)

Next, do it again, but this time, return the score.

conditions:
deaths is x
Actions
Subtract x deaths
add x custom

These are called binary countoffs



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

May 11 2009, 8:43 am NudeRaider Post #3

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Starcraft doesn't support variable values in actions or conditions. So there's a few ways to approach this, I'll give you the most efficient:
Binary countoffs. You can read more about them in the wiki.
Basically you have a set of triggers that work with binary numbers, starting with the binary number that is just smaller than your max. custom score. For example when max. custom score is 50 you start with 32, then 16, 8, 4, 2, 1.
That way you can convert every possible score into units/resources in one trigger loop. The trigger(s) would look like this:
<Human Players>
C: Current Player has at least 32 custom score
A: Subtract 32 custom score
A: Create 32 marines / res

Then triggers with 16, 8, 4, 2, 1 too. That's 6 easy triggers you can mostly copy and paste. Order is important here.
If your max custom score is below 10 then it's probably acceptable to make only the last trigger with the 1. It'll take at most 9 trigger loops which isn't much with hyper triggers.

EDIT: Oh, rockz beat me to it.
And yes, after reading his reply I think he's right, you want the score to stay the same, so you have to do a 2nd countoff to return the score.




May 11 2009, 8:48 am fool Post #4



Yea I actually just got it working using 2 items like you guys have. I guess yea that sucks theres no better way to do this



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:57 am]
NudeRaider -- https://staredit.net/381600/ You have 5 minutes, then you can only edit your posts.
[04:05 pm]
NudeRaider -- DarkenedFantasies
DarkenedFantasies shouted: you eat lots of beans
:lol:
[11:30 am]
NudeRaider -- I would like 3000 minerals, please
[2026-4-16. : 7:32 pm]
Zoan -- I got $2000 bonus. I would like 2000 minerals, please
[2026-4-16. : 4:15 am]
DarkenedFantasies -- you eat lots of beans
[2026-4-16. : 3:46 am]
IskatuMesk -- how do i get gas
[2026-4-15. : 11:43 pm]
Moose -- you don't
[2026-4-15. : 10:06 pm]
Zoan -- how do i get minerals
[2026-4-14. : 11:45 pm]
ClansAreForGays -- Anyone wanna played Skewed StarCraft?
[2026-4-14. : 12:07 am]
Vrael -- NudeRaider
NudeRaider shouted: Vrael ranting still is though
you're a gentleman and a scholar, thank you
Please log in to shout.


Members Online: NudeRaider, DarkenedFantasies