Tutorial:Pooled Resource Unit Costs

From Total War Modding
Revision as of 03:59, 10 July 2023 by Freakpear (talk | contribs)

Originally written by Pear

Let's Talk Pooled Resources

Pooled Resources are an important part of what makes any faction unique. The problem is they're often not used for very much. This tutorial aims to fix that by explaining how to use Pooled Resources as costs using units in the main recruitment panel as an example. The theory used here can be applied to a range of other things such as RoRs, lords, agents, buildings, and technologies or anything you want really.

This guide is also my submission for Mod Jam #7, along with an example mod for making units cost Pooled Resources in the main recruitment panel.

The Theory

If you're not familiar with Lua UI modding then the UI Tutorial Series is a good place to start as this guide won't explain the full UI theory, just what we need to know.

There are 3 main elements to making something cost a Pooled Resource:

  • Building the UI: This involves finding existing UI components, copying them, and repositioning them.
  • Handling the UI: This involves handling refreshes to the UI, making sure UI components are enabled / disabled, and have the right text, tooltips, and icons at the right time.
  • Handling the Cost: This involves taking away / returning the Pooled Resource to the player in a multiplayer-friendly way.

Building the UI

In order to modify parts of the UI you first need to find where they are located. To do this you'll need to use the Context Viewer. So, the first step is figuring out where you want your cost to appear. For units this will probably be in the same place as normal recruitment and upkeep costs — below the unit card.

Finding UI Components: To find a component, open the context viewer, position your mouse on the screen where you want your UI component to go, and click with your mouse wheel. This will take you most, if not all, of the way to the path of your component. Hovering over


Handling the UI

Handling the Cost