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.
[2024-5-12. : 8:51 pm]
l)ark_ssj9kevin -- Are you excited for Homeworld 3?
[2024-5-12. : 8:44 pm]
l)ark_ssj9kevin -- Hi Brusilov
[2024-5-12. : 4:35 pm]
O)FaRTy1billion[MM] -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
my server that was hosting it died
[2024-5-10. : 8:46 pm]
NudeRaider -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
https://armoha.github.io/eud-book/
[2024-5-10. : 8:36 am]
Brusilov -- Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
[2024-5-09. : 11:31 pm]
Vrael -- :wob:
[2024-5-09. : 8:42 pm]
Ultraviolet -- :wob:
[2024-5-08. : 10:09 pm]
Ultraviolet -- let's fucking go on a madmen rage bruh
[2024-5-08. : 10:01 pm]
Vrael -- Alright fucks its time for cake and violence
[2024-5-07. : 7:47 pm]
Ultraviolet -- Yeah, I suppose there's something to that
Please log in to shout.


Members Online: lil-Inferno