Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Math and triggers
Math and triggers
Oct 26 2008, 5:13 am
By: Morphling  

Oct 26 2008, 5:13 am Morphling Post #1



How can I simplify a fraction via triggers. I have DC1 as my denominator and DC2 as my numerator.



None.

Oct 26 2008, 1:03 pm y10k Post #2



This should work
how it works:

You have, A/B

You decrease B to 0 with a binary countdown, simultaneously decreasing it from A too.
You need to store B's value to a C one during the countoff. You might need to store your original numerator as well (A->D).
With this you can count, how many times (E) this can be executed (till A reaches 0).
You restore C's value to B and start again.

S2 is set, S1 is cleared, DC1 & DC2 >= 32 => DC1 & DC2 : -32 , DC3 & DC4 : +32
S2 is set, S1 is cleared, DC1 & DC2 >= 16 => DC1 & DC2 : -16 , DC3 & DC4 : +16
more required: 8,4,2,1, and additionally you can go up to 64,128,256,512.....etc.
but in decreasing order.
S2 is set, S1 is cleared, DC2 = 0 => DC5++ , set S1
S2 is set, S1 is set, DC3 >= 32 => DC2 : +32 , DC3 : -32
S2 is set, S1 is set, DC3 >= 16 => DC2 : +16 , DC3 : -16
more required: 8,4,2,1, and additionally you can go up to 64,128,256,512.....etc.
S2 is set, S1 is set, DC3 = 0 => clear S1.
S2 is set, S1 is cleared, DC1 = 0, DC2 >= 0 => clear S2

S2 is cleared : DC5 = quotient, DC4 = original numerator, DC2 = should stay whatever it is.

S1 is set when you count the denominator and check if it is lower than the numerator, if yes you increase quotient by 1 and reset denominator (S1 is cleared)
S2 is cleared when operation has finished. Set S2 to start the operation.
Required amount of trigger cycles is the quotient (these must be run as many times as that is)

17123 / 3 will take a long time, while 400/31 takes only 13 cycles.



None.

Oct 26 2008, 2:13 pm Falkoner Post #3



You could also increase the speed by having conditions that if they have, say 300, then you add 100 to the quotient, and subract 300, and that can speed it up so it can be done in a single trigger loop.

Of course, the best method would be to use Binary Count-Offs instead, check out this tutorial on how to use them for division.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[04:56 am]
Ultraviolet -- I suppose we'll likely never know, but my guess would be that they already saw it operating successfully and there was no monetary incentive to finish the original work. And the dev cycle in old school Blizzard was so hectic, it's possible it just got forgotten about after the original game got released. Plus there's an element of existing MPQ files that were packaged with the original discs becoming outdated if they updated it. And it's not like they remade the original MPQs, they just made new ones for BW specifically
[04:26 am]
Oh_Man -- so that makes me think maybe the theory they are unfinished is not true and its a deliberate design decision, coz why not finish them wen ur making brood war?
[04:25 am]
Oh_Man -- the thing is thos buildings are from classic. that means they went ahead and made brood war without ever finishing the 'unfinished' buildings
[06:15 pm]
Ultraviolet -- Yeah he's talked about a lot of that stuff in his casts before. It seems plausible. Especially knowing how Blizzard of yesteryear operated.
[03:47 pm]
NudeRaider -- to clarify: couldn't recall the behavior for every single Protoss building but I was aware the disparity exists.
[03:43 pm]
NudeRaider -- Contained nothing new for me. Didn't know all building's behavior, but very much all unit's. Also Terran balance whine - also nothing new :lol:
[2026-6-19. : 9:57 am]
Oh_Man -- makes me wonder if SEN knows anything about the topic
[2026-6-19. : 9:57 am]
Oh_Man -- artosis dropped pretty interesting vid: https://youtu.be/EqZHB8Blra4
[2026-6-18. : 5:01 pm]
Ultraviolet -- :wob:
[2026-6-17. : 6:15 am]
RexyRex -- :wob:
Please log in to shout.


Members Online: Moose