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:39 am]
Symmetry -- Man I wish we had this tech back in the day when people played ums lmao
[06:28 am]
NudeRaider -- EUD actions, specifically. The conditions remained. Today we can even have actions again, but they're all virtualized/whitelisted (not sure on the actual technical implementation) so you can only use them for specific intended purposed, not arbitrary code injections.
[06:26 am]
NudeRaider -- I mean yes, maps - through EUDs - were theoretically able to do that as well, but that was patched quickly.
[06:25 am]
NudeRaider -- Symmetry
Symmetry shouted: Ohhh imagine a SC map that could delete itself
not the map, the editor
[2026-7-16. : 2:28 am]
Symmetry -- I vaguely remember Voy doing some ACE back in the day, but I had no idea EUDs could do that kind of shit. I am very much catching up on the technology
[2026-7-16. : 2:28 am]
Symmetry -- Ohhh imagine a SC map that could delete itself
[2026-7-15. : 8:51 pm]
NudeRaider -- Symmetry
Symmetry shouted: NudeRaider Is EUD editor capable of writing shit onto the player's harddrive? That seems like it would be dangerous
yeah an editor that isn't allowed to write files sounds rather pointless, so I'd assume it can. Like most other programs too btw. and yes, obviously that's dangerous, but also kinda necessary. MS introduced that virtualization for exactly that reason.
[2026-7-15. : 4:10 am]
Ultraviolet -- I don't think so. I think they shut that shit down after 1.16, maybe even earlier
[2026-7-15. : 2:19 am]
Symmetry -- NudeRaider
NudeRaider shouted: Symmetry I can't tell if it's relevant. You provided literally no context so I was providing an equally generic answer.
Is EUD editor capable of writing shit onto the player's harddrive? That seems like it would be dangerous
[2026-7-14. : 11:43 pm]
Ultraviolet -- let's take each other's clothes off :teach:
Please log in to shout.


Members Online: l)ark_ssj9kevin