Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Detecting Unpowered Buildings
Detecting Unpowered Buildings
Oct 30 2008, 7:28 am
By: Hercanic  

Oct 30 2008, 7:28 am Hercanic Post #1

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Can triggers distinguish, detect, or otherwise react to the unpowered state of a building, such as Photon Cannons when their Pylon is destroyed?




Oct 30 2008, 8:13 am y10k Post #2



I dont think there is a real way to detect psi supply for buildings, but there might be a way to check, if you move a location on the building and see if there is a pylon there to provide psi.



None.

Oct 30 2008, 11:17 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

I case of photon cannons you can move a low HP enemy unit near and check if it has been killed after a short time.

For production buildings it might be possible to use a computer AI which should build units. You have to find an AI that does reliably build and then you can just wait appropriate time and check if a unit has been built.
High pylon build times help increasing reliablility and low unit build times help decreasing time to detect.

If the disabling caused a cloaking of a building you could place a low damage enemy outside his weapon range, but inside sight range (e.g. melee) and check if the unit moves to attack the building. If it moves, he sees it, so it's not cloaked so it is not disabled.

Pretty bad solutions which dont cover all buildings. But I'm afraid that's all you can do.




Oct 30 2008, 1:34 pm JaBoK Post #4



Well, a reliable way of doing it would be to create a set of locations that precisely mimics a pylon's aura size, then start by giving all buildings to a different player, cycling through the pylons with a grid system that detects the ones in the aura and then giving all buildings in there (including pylons) back to the original owner. After this, all nonpowered buildings will be owned by another player, but to do this in one trig cycle you will need alot of triggers. Not sure if this will eff up upgrades and unit construction though.



None.

Oct 30 2008, 6:27 pm NudeRaider Post #5

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

Giving buildings cancels every research / building done inside. Money is given back.
So although what Jabok said sounds possible it's only recommendable if you don't want to build / research or you do it only once or a few times at certain points in the game.

Btw. instead of a grid I would use different shaped locations all centered onto the pylon. If you give them different height to width ratios you can also approximate a pylon aura. Especially if you have preplaced buildings snapped to tile.
However keep in mind that you don't need to cover the full size of the aura or you risk that a unpowered building overlaps into the aura without being affected. The good part of it is buildings that ARE powered by the pylon overlap into the aura, so you don't have to fully cover it.




Oct 30 2008, 7:04 pm Vi3t-X Post #6



Just remember that the Pylon aura is more biased to the left side.



None.

Nov 3 2008, 7:08 pm Hercanic Post #7

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Thank you everyone who responded. Basically, when buildings are unpowered, I wanted them to be destroyed or otherwise removed. As this is for a mod, some solutions will not work as they would for a normal UMS map. I'm going to try modding the death animation of the Pylon to include a useweapon script, causing enough damage on death to destroy the surrounding buildings.

Is there a way to detect the difference between when a foe kills your unit, versus when you kill your own units? I'd like the explosion effect from the pylon to refund part of the cost of the buildings through triggers, if possible. The key is whether there is a distinction between how a unit dies, or what you kill.




Nov 3 2008, 8:05 pm poiuy_qwert Post #8

PyMS and ProTRG developer

If its for a mod you could do it with a plugin. I could probably do it if you want.




Nov 3 2008, 8:51 pm NudeRaider Post #9

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

Well no one's razings score goes up when you kill your own buildings (and I'm fairly certain your kills count neither) while your death counts do.

Post has been edited 1 time(s), last time on Nov 4 2008, 11:16 am by NudeRaider.




Nov 4 2008, 6:43 am Hercanic Post #10

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Dear NudeRaider:
So could the two values be compared in a trigger to determine whether to cause the refund effect? Hmmm...

Of course, there are also things that could throw off the detection, such as if you are attacking someone's base while someone attacks you. I may just have to factor in a refund on buildings for this race no matter how they're destroyed.


Dear Poiuy Qwert:
I had LocUnlock in mind when I asked this question. Of the solutions suggested, though, the only feasible one would be ownership exchange, but that would be an ordeal, causing the loss of all upgrading and unit production (how does it affect warping-in buildings, by the way?). The principle building type that must be destroyed is one that yields supply (so unit creation as a detection wouldn't work, nor an AI on production buildings), since being unpowered will not affect the supply given. I wanted to curb potential abuse with unpowered buildings due to how the mod's gameplay works.




Nov 4 2008, 11:28 am NudeRaider Post #11

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

Quote from Hercanic
Dear NudeRaider:
So could the two values be compared in a trigger to determine whether to cause the refund effect? Hmmm...

Of course, there are also things that could throw off the detection, such as if you are attacking someone's base while someone attacks you. I may just have to factor in a refund on buildings for this race no matter how they're destroyed
Yes. Use hypertriggers and you can compare 8 times a game second.

You killing an enemy's building the exact same time (within 84ms real time) you're killing your own building results in no refund.
With units you got the problem that due to splash there's usually dying several each 1/8th of a game second, but buildings die much more scarcely so I would just do that. And if the no refund happens (which will be very rare) then he just had bad luck for once.
Be sure to only use razings score, not kills and razings.

To do the comparation you got 2 choices:
- Copy the razings score to 2 death counters (now and last trigger loop) and compare the 2 by using at least 24 binary countoffs (so that the razings score can go as high as 16,7million without your system screwing up)
- Just check for razings score at least 1 and reset it in the next trigger.

Option 2 will disable the score given for buildings killed in the score tally after games.




Nov 5 2008, 12:18 am poiuy_qwert Post #12

PyMS and ProTRG developer

What i meant by writing you a plugin is I could make a new trigger action to go through all the buildings and destroy unpowered ones.




Nov 6 2008, 5:26 pm Hercanic Post #13

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Dear NudeRaider:
Those are good ideas, though please excuse my triggering ignorance: What is a 24 binary countoff and how is it set up and used?


Dear Poiuy_Qwert:
New trigger actions? That's actually possible? =oO




Nov 6 2008, 6:04 pm NudeRaider Post #14

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

Quote from Hercanic
Dear NudeRaider:
Those are good ideas, though please excuse my triggering ignorance: What is a 24 binary countoff and how is it set up and used?
http://www.staredit.net/wiki/Binary_Countoffs
Basically it's a method that uses the properties of the binary system to transfer a decimal number with the least triggers possible.
When you wanted to transfer values via a decimal countoff you would do something like this:
If player has at least 1000 razings score
Add 1000 to death counter
Subtract 1000 razings score

If player has at least 100 razings score
Add 100 to death counter
Subtract 100 razings score.

... etc. You either would have to have a lot of copies or the system needed some time to transfer an arbitrary number.
==> not optimal

That's why we use binary values to subtract (count off) from one value, and add to another, hence the name:
If player has at least 1024 razings score
Add 1024 to death counter
Subtract 1024 razings score
(1024 = 2^10)

If player has at least 512 razings score
Add 512 to death counter
Subtract 512 razings score
(512 = 2^9)

... etc. ( ... 4, 2, 1 would be the last 3 triggers)

The great advantage is that this system transfer ANY number in only 1 trigger loop.
You need 10 triggers for every power of 10 values (1,048,576 = 2^20, 1,073,741,824 = 2^30, etc.)
I suggested to use 24 of these triggers because 16,7 million razings score seems to be high enough. Feel free to add more.




Nov 6 2008, 7:14 pm Hercanic Post #15

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Not sure I understand why Base 2 is more optimal than Base 10.




Nov 6 2008, 8:13 pm NudeRaider Post #16

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

Have you read the example in the wiki link?

If you do 1000 - 500 - 200 - 100 - 50 - 20 - 10 - 5 - 2 - 1
(this is a pretty good split as most of the time it halfes the number, which is the reason money usually has those values. But its not perfect as we'll see)
compared to 1024 - 512 - 256 - 128 - 64 - 32 - 16 - 8 - 4 -2 - 1
you have 1 more trigger in the base 2 variant
But when you just try a few numbers you will see that base 2 gets ANY number in 1 loop just because of the fact that it splits the rest of the number exactly in 2. Uhm it's hard to explain without a picture you'd have to follow the wikipedia link to learn binaries.
But lets do an example: 589 (you can try any other):
Collapse Box

And it's not just a coincidence that this number works for binary in 1 loop. It works with every number.
Btw. you could also add the steps 400, 40 and 4 to the base 10 variant to make it always work in 1 trigger loop. But you'd have 2 triggers more than with the base 2 method.

Also don't quote me on what I've just told you. In contains some simplyfied statements which are not right that way or only part of the truth. But I hope you get the point now.

Also note that I did NOT use a true base 10 countoff. True base 10 would only have 1000 - 100 - 10 - 1. But you surely realize without an example that while it doesn't need many triggers it would take several loops for any digit different than 1.




Nov 6 2008, 10:07 pm O)FaRTy1billion[MM] Post #17

👻 👾 👽 💪

Quote from Hercanic
Dear Poiuy_Qwert:
New trigger actions? That's actually possible? =oO
*cough* Remember my topic? >.> Also poiuy (maybe someone else) made something related to locations.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Nov 6 2008, 10:34 pm poiuy_qwert Post #18

PyMS and ProTRG developer

Yes it is totally possible, FaRTy's unreleased TrigPlug and my LocUnlock are examples. It'll be easy to make what you want, I could probably add other things for you too if you wanted.

Edit: I was bored so I already have a working plugin for 1.15.2, pm me with the sc version you need if you are interested in it (and more if you want). It only takes one trigger to do what you want (without hyper triggers that is):
Code
Trigger(All Players):
   Condition:
       Always()
   Action:
       EnableDebugMode() # This will conflict with LocUnlock. If you needed both plugins for your mod it can be changed.
       PreserveTrigger()


Post has been edited 1 time(s), last time on Nov 7 2008, 4:45 am by poiuy_qwert.




Nov 7 2008, 4:19 am Falkoner Post #19



Quote
Not sure I understand why Base 2 is more optimal than Base 10.

Base 2 only requires a single trigger to move up to the next place, base 10 would require 9 different triggers for each level, or it wouldn't transfer properly, in Base 10 you'd need a trigger for 1-9, and 10-90, and so on, in base two you'd only need 7 triggers to get to 128, and it only goes up faster from there.

I actually was planning on making a tutorial on my website for this



None.

Nov 7 2008, 8:27 pm Hercanic Post #20

STF mod creator, Modcrafters.com admin, CampaignCreations.org staff

Dear Farty:
Yes, I remember your thread on TrigPlug. However, not having a background in programming or SC triggering, the technical explanation of its function was lost on me. Examples always help the laymen, like myself. =o)


Dear Poiuy Qwert:
My mod has an entire system designed that revolves around LocUnlock, so TrigPlug would need to work with LocUnlock if I am to utilize TrigPlug as well.

When designing, I am limited by what I know is possible. It seems now with TrigPlug, there is a whole host of new possibilities that I am unaware of. I would love to be able to take advantage of that, but I need to understand its capabilities and limitations.


Dear Farty & Poiuy:
Would the two of you be interested in a PM parley about my mod's current design?




Dear NudeRaider:
Okay, I understand. There are holes in Base 10 and any bastardized variants, due to uneven cutting, that can result in a remainder on certain values. This remainder would need additional trigger loops to pass in order to convert it.


_

Post has been edited 3 time(s), last time on Nov 7 2008, 8:34 pm by Hercanic.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
Please log in to shout.


Members Online: eksxo