Tutorial:Pooled Resource Unit Costs: Difference between revisions

From Total War Modding
No edit summary
No edit summary
Line 2: Line 2:


== Let's Talk Pooled Resources ==
== Let's Talk Pooled Resources ==
[https://tw-modding.com/wiki/Tutorial:Pooled_Resources_Updated 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 for units in the main recruitment panel, and eventually, I hope, a range of other things such as RoRs, lords, agents, buildings, and technologies.
[https://tw-modding.com/wiki/Tutorial:Pooled_Resources_Updated 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.
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.
Line 17: Line 17:
*'''Handling the Cost''': This involves taking away the Pooled Resource from the player and returning it in a multiplayer-friendly way.
*'''Handling the Cost''': This involves taking away the Pooled Resource from the player and returning it in a multiplayer-friendly way.


== Main Recruitment Panel ==
== Building the UI ==


== RoRs & Other Panels ==
== Handling the UI ==


'Work In Progress'
== Handling the Cost ==
 
== Lords & Agents ==
 
'Work In Progress'
 
== Buildings ==
 
'Work In Progress'
 
== Technologies ==
 
'Work In Progress'

Revision as of 04:42, 10 July 2023

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 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 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 the Pooled Resource from the player and returning it in a multiplayer-friendly way.

Building the UI

Handling the UI

Handling the Cost