Skip to content

Instantly share code, notes, and snippets.

@Alzarath
Created November 26, 2024 04:20
Show Gist options
  • Save Alzarath/867b9b266266f9d044f7f678347e6861 to your computer and use it in GitHub Desktop.
Save Alzarath/867b9b266266f9d044f7f678347e6861 to your computer and use it in GitHub Desktop.

Custom Resource Manipulator

Custom Resource Manipulator is a GUI-friendly trigger library and UI addition dependency created and distributed by Alzarath that adds custom resource icons and labels that can be created and manipulated.

Installation

To install, add the Custom Resource Manipulator dependency to your map. Alternatively you can rip the triggers and UI elements and inject them into your own map, which I won't help with.

The dependency mod is available in the StarCraft 2 Arcade on the US, EU, and KR servers using the name "Custom Resource Manipulator".

Usage

The 4 standard resources—Minerals, Vespene, Terrazine, and Custom Resource—have custom resource entries set up by default. Whether or not you plan to manipulate the standard resources, it's recommended you use them if you plan to add custom resources as the custom resources are offset based on the standard variants of the custom resources.

To use the standard resources, it's recommended to hide the existing resource display with the Show/Hide Resource action, then show the custom versions with the Show/Hide Custom Resource action.

Creating custom resources

Creating custom resources is fairly simple. Run the Create Custom Resource action. It will create a new resource panel for you offset from the last created resource (initially this is Custom Resource).

You'll want to get and probably store the index of the resource. This index, an integer, can be acquired from the Last Created Custom Resource Index function.

To customize the resource, you have a few options available to you:

  • Set Custom Resource Icon sets the image of the icon of the given resource type.
  • Set Custom Resource Text sets the text of the label of the given resource type.
  • Set Custom Resource Tooltip sets the tooltip of the icon of the given resource type.
  • Set Custom Resource Value sets the value and text of the label of the given resource type. This is a real number and the recommended way to set the text if you only plan on using numbers as it has a smoother animation.

Finally, you may want to show the custom resource along with your other resources. This can be done with the Show/Hide Custom Resource action.

Additional Configuration

By default, we display 5 columns of resources at a time. This can be changed with the Set Custom Resource Columns action.

Supply information is not handled by the Custom Resource Manipulator, and so the position of the resources is not directly affected by its visibility. Should you wish to hide supply info and want the resources to line up with the far side of the screen, you can use the Set Supplies Visible For Custom Resources action to indicate whether supplies are visible. By default this is set to True.

Finally, if for whatever reason you want to modify the label of the standard resources without worrying about it getting overwritten, you can use the Turn On/Off Standard Resource Updates action to disable automatic updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment