How should I show shared resources during a Shared Resource game in the Galaxy Editor?

One of my favorite ways to play the original StarCraft was in a “Team” game. In this game type, multiple players on the same “team” would share control, resources, supply, and even the same starting location. It was like playing as 1 player, only 2 humans were controlling it. It was a lot of fun.

I want to do something very similar in StarCraft 2, but I need to create a custom map in the Galaxy Editor to do it.

I found the editor can quite easily emulate this behavior. There is a Trigger action “Set Alliance for Player Group” to “…treat each other as Ally With Shared Vision, Control, And Spending.” To use this, I create units for only 1 of the players, and then set all players to be allied with each other in this way. All the other players get no units and no resources. This makes it so 1 player is the actual owner of all the units and everyone else is tagging along with full control.

This nearly works! The problem is that if I am not the actual owning player, I can’t actually see how many minerals/gas/supply the team has. This makes it pretty difficult to build stuff.

What would be the best way to display to the other players how many Minerals/Gas/Supply the team has?

Answer

Meanwhile, I figured it out! As @Wikwocket says, custom Dialogs are the way to go; however, here’s a very detailed explanation of precisely how I did it.

First off, for convenience I made a new Record in the Trigger Editor I called ResourceDialogUI.

New Record in the Trigger Editor

I also had to make a variable of type “– Record / ResourceDialogUI,” which I cleverly also called ResourceDialogUI.

I then painstakingly recreated the positions and sizes of the ingame Resources UI to make a UI that looks almost, but not quite, entirely like the defaults. Also I turned off the defaults. I hope these numbers are useful to someone else too.

New UI setup to mimic the ingame UI

Edit: dialogSizeX might need to be a little bigger and dialogRightBuffer correspondingly larger to account for supply sizes in the triple digits; otherwise you get … truncation.

Then it’s just a matter of updating the numbers at appropriate times using ResourceDialogUI.MineralsText etc. and the “Player Property” getter function to get the values. To update, I simply used a Trigger that fires every .5 seconds, and it works pretty well. It’s not as nice as the default text, which “rolls” around to the real numbers, but I’m sure I could polish that.

Also of note: Supply is “SuppliesUsed / SuppliesMade.” That took me a couple tries. I was not able to get the color to update to red when you need more supplies; the trigger to set the text color on the fly didn’t seem to actually do anything.

My map lets you join other teams on the fly, so I also added in a Trigger to change the icons to appropriate race-specific icons. Using a local variable “race” which is a “Game Link -> Race,” here’s what does that:

Trigger to update race icons

Attribution
Source : Link , Question Author : Mag Roader , Answer Author : Mag Roader

Leave a Comment