Staredit Network > Forums > SC2 Assistance > Topic: Setting button color
Setting button color
May 26 2010, 10:29 am
By: LooKe  

May 26 2010, 10:29 am LooKe Post #1



Alright, so I've got a grid for my zone control map and I'm trying to figure out how to set the button color when a unit enters the zone. It should be set to either the player who owns the bunker in that zones color, or gray if there is no bunker there. How would I do this?
I was going to have it just set it when a player built a bunker, but that basically eliminates any surprise in the game.



None.

May 26 2010, 4:05 pm Temp Post #2



Just disable/enable the ability



None.

May 26 2010, 6:40 pm LooKe Post #3



Huh?



None.

May 26 2010, 9:57 pm payne Post #4

:payne:

Have you looked at the triggers in my RMA map? There is an action which "set color to 'x' for the last created button" or something like that in it :O



None.

May 27 2010, 3:11 am LooKe Post #5



I can set the color fine, I'm looking for the condition to set the color.



None.

May 27 2010, 4:57 am Temp Post #6



You could set an int array when they build a bunker in the region then use that as a condition for bringing the unit into the zone. (I am assuming you have a region for each zone)



None.

May 27 2010, 6:51 am LooKe Post #7



I'm a little confused by how to do that together. I understand each thing individually but not how to put it all together. I do have a region for each zone, yes.



None.

May 27 2010, 7:07 am payne Post #8

:payne:

Just a thought off the top of my head: it looks like people are afraid of regions now. I open up a map and if I think of a way to trigger it nicely, I think of SC1 and sets regions everywhere, but I look at the map and there's like 1 region and uber useless triggering ;o



None.

May 27 2010, 9:41 am LooKe Post #9



I think sc1 as well, I have regions all over the place.

Anyone have any ideas?



None.

May 27 2010, 4:11 pm Temp Post #10



Ok so my idea involves 3 triggers. First one is recognizing that a bunker was created in a region.

Make a trigger that has an event for everyone zone (probably unit enters area, cond: unit is bunker) and do some math to figure out what zone you are in. Get offset of triggering region and then subtract top left most point of the zones minus the offset divide by the height/width of the regions and you have what region you are in. You need a global 2d array of ints representing the zones on the map. When you figure out what zone a bunker was just built in you set that int in the array to 1.

For when a bunker dies it is the same thing but use unit dies event and get the offset of the unit which you reduce down to the region in a similar fashion. Except you will need to round down at the end, you set the position in the array to 0 and you need to make sure you change the button colour back for that region.

For the setting of the colour have a unit enters zone trigger pretty much the same again except this time check the array to see if the zone the unit entered has a bunker or not.

Sorry if this is confusing I decided to write this before I had eaten anything. Ask me about any part of this that you are having trouble understanding.



None.

May 27 2010, 10:51 pm LooKe Post #11



Quote from Temp
Ok so my idea involves 3 triggers. First one is recognizing that a bunker was created in a region.

I have the trigger for building a bunker, so I could just have it set the int as well.

Quote from Temp
For when a bunker dies it is the same thing but use unit dies event and get the offset of the unit which you reduce down to the region in a similar fashion. Except you will need to round down at the end, you set the position in the array to 0 and you need to make sure you change the button colour back for that region.

I have a trigger that runs when a bunker dies, so I could probably add this there as well.

Quote from Temp
For the setting of the colour have a unit enters zone trigger pretty much the same again except this time check the array to see if the zone the unit entered has a bunker or not.

Alright, I think this is easy enough, I'll set it up and see if I can get it.



None.

May 28 2010, 1:22 am LooKe Post #12



I'm a dumb ass, I forgot to define --triggering player--

Ok, so I set the first and last trigger up to see if it would even work, and here is what I've got it setup as:

Bunker Create Trigger

unit enters region


The problem is, when the unit enters the region, it doesn't change the color. Any ideas?

After a quick test, something about the red text isn't working " Dialog - Set Zones[3][3] color to Grid Colors[Zone Owner[3][3]] for --triggering player-- " doesn't work.

Post has been edited 4 time(s), last time on May 28 2010, 1:46 am by JB4times4.



None.

May 28 2010, 1:44 am Temp Post #13



Do Owner of unit(triggering unit)



None.

May 28 2010, 1:48 am LooKe Post #14



Thanks. Now I'm having a hard time with detecting what region the dying bunker is in, whats the best way for that?



None.

May 28 2010, 2:01 am Temp Post #15



If you don't want to do it the math way you could do this.

Have an array of all your regions.
When a bunker is created use the Set Custom Value to the index of the region in the array.
Grab the value in your unit death trigger.



None.

May 28 2010, 2:05 am LooKe Post #16



If the math way is easier, then I'd rather do that But I didn't understand it.

I'll try the array way now.



None.

May 28 2010, 2:08 am Temp Post #17



The math way would only be worth it over this way if you needed to use it for the other triggers.



None.

May 28 2010, 2:33 am LooKe Post #18



What do you mean by "Set Custom Value"?



None.

May 28 2010, 3:17 am Temp Post #19



Its an action that you can do to a unit.



None.

May 28 2010, 3:27 am LooKe Post #20



Ok, so I have it set it with:
Unit - Set (Last created unit) custom value 1 to 3.0
Unit - Set (Last created unit) custom value 2 to 3.0

But I can't find how to access it in the death trigger.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
Please log in to shout.


Members Online: Roy, Vrael, Dem0n, NudeRaider