Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Need help with a trigger for my spawn defence
Need help with a trigger for my spawn defence
This topic is locked. You can no longer write replies here.
Jun 13 2010, 8:46 pm
By: tentons01  

Jun 13 2010, 8:46 pm tentons01 Post #1



Hi.

Iv been trying to figure out this trigger for quite some time, but its really makeing me mad :crazy: so i have decided to try asking on some forums to see what the people smarter than me think

The trigger im trying to set up, is for a spawn defence map i am makeing.
Everytime you make a unit, which cost minerals, you get 1/3 of the mineral cost in gas, and gas is your amount of income. You get income everytime the timer resets to 60 seconds. The gas is suppose to be the amount of minerals you get when the timer resets, but i dont know how to set it without makeing your gas go to 0. It needs to stay at the same amount. Any ideas?



None.

Jun 13 2010, 9:06 pm Aristocrat Post #2



Quote from tentons01
Hi.

Iv been trying to figure out this trigger for quite some time, but its really makeing me mad :crazy: so i have decided to try asking on some forums to see what the people smarter than me think

The trigger im trying to set up, is for a spawn defence map i am makeing.
Everytime you make a unit, which cost minerals, you get 1/3 of the mineral cost in gas, and gas is your amount of income. You get income everytime the timer resets to 60 seconds. The gas is suppose to be the amount of minerals you get when the timer resets, but i dont know how to set it without makeing your gas go to 0. It needs to stay at the same amount. Any ideas?

Have it set up like this:

-Subtract 1 gas.
-Add 1 to minerals.
-Add 1 to deaths of Cantina for Current Player.

Then, when that's done, flip a switch and start transferring Cantina deaths to Gas. (Subtract 1 death of Cantina, Add 1 gas).

You could do this with binary countoffs if you know how to.

Post has been edited 1 time(s), last time on Jun 13 2010, 9:16 pm by Aristocrat. Reason: Spelling fail :hurr:



None.

Jun 13 2010, 9:14 pm 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

Basically you are right. So what you do is you transfer the gas to minerals, but the same time you transfer it to a death counter* via binary countoff**. After it's done you transfer the death counter back to gas.

*death counter: The variables in sc mapping. We pick an unused unit, for example neutral - neutral - cantina, that can't die in the map and modify its death count by triggers. We can set, add to or subtract from death counters and we can check them in conditions, so we can just use them like a variable in a programming language. Read up death counters in our wiki for more info.

**binary countoff: Is a method that uses binary properties to quickly (within 1 trigger loop) transfer an arbitrary value into another variables. Variables can be gas, custom score, death counters, etc.
First you need to determine the max amount that will be transferred in your map. Lets assume 50 income is max.
Now you just add numbers of powers of 2 until you exceed 50:
Code
2^n value sum
_2^0 =  1  1
+2^1 =  2  3
+2^2 =  4  7
+2^3 =  8 15
+2^4 = 16 31
+2^5 = 32 63

-- here you exceeded 50, so you need 6 (0-5) triggers
For the transferring to work in 1 trigger loop you need to sort from highest to lowest:

C: Current Player accumulated at least 32 gas
A: Add 32 minerals
A: Subtract 32 gas
A: Add 32 deaths of 'temp'

C: Current Player accumulated at least 16 gas
A: Add 16 minerals
A: Subtract 16 gas
A: Add 16 deaths of 'temp'

C: Current Player accumulated at least 8 gas
A: Add 8 minerals
A: Subtract 8 gas
A: Add 8 deaths of 'temp'

C: Current Player accumulated at least 4 gas
A: Add 4 minerals
A: Subtract 4 gas
A: Add 4 deaths of 'temp'

C: Current Player accumulated at least 2 gas
A: Add 2 minerals
A: Subtract 2 gas
A: Add 2 deaths of 'temp'

C: Current Player accumulated at least 1 gas
A: Add 1 minerals
A: Subtract 1 gas
A: Add 1 deaths of 'temp'

-- so now you transferred all gas into minerals and the death counter named 'temp'
In the very same manner you transfer the value stored in 'temp' back to gas.

If you want more information on binary count-offs read about them in our wiki.

Post has been edited 1 time(s), last time on Jun 13 2010, 9:21 pm by NudeRaider.




Jun 13 2010, 10:12 pm tentons01 Post #4



Thanks guys (: this worked :D i had to edit a few things for it to fit what i was doing but the basic idea is the same (:



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[02:43 am]
Symmetry -- I'm doing my best, damn it
[2026-9-28. : 4:46 pm]
Ultraviolet -- @:@
@:@ shouted: this community still going strong?
Still going.. strong is debatable though.
[2026-9-28. : 4:13 pm]
WeirdoX4857 -- I can't believe this is really been around since 2003 but it does look classic and old asf still better than talking to kids on discord ranting about skibidi toilet and sexuality or whatever mental illness is going on in their heads
[2026-9-28. : 4:11 pm]
WeirdoX4857 -- Nigga how you ask is it still going strong when you get a text every 3 miles per hour or something
[2026-9-28. : 4:10 pm]
WeirdoX4857 -- Where is everybody
[2026-9-28. : 1:21 pm]
@:@ -- this community still going strong?
[2026-9-27. : 4:30 pm]
Oh_Man -- yeah, probs
[2026-9-27. : 3:11 pm]
NudeRaider -- I bet it just needs another training session against pros instead of only against itself and nobody will be able to stop it anymore.
[2026-9-27. : 3:09 pm]
NudeRaider -- Oh_Man
Oh_Man shouted: pluto vs pro gamer snow: https://youtu.be/NOXXpATkdZU
so it can be beaten by a prepared pro, even in macro games, if only barely. the muta micro in particular seems really hard to handle for protoss ground though. In the open goons can't catch them, in the base they trip over buildings, it just instantly flies out of storms and they fly circles around archons. Mass cannons do work, but can't cover the whole map with it. Probably need mass corsair to counter and hope you can outmaneuver all the scourge.
[2026-9-27. : 2:14 am]
Oh_Man -- pluto vs pro gamer snow: https://youtu.be/NOXXpATkdZU
Please log in to shout.


Members Online: @:@