Tutorial:Custom Lords & Heroes

From Total War Modding
Revision as of 16:02, 8 August 2024 by Casualfield (talk | contribs) (→‎agent_subtypes.loc)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

By Nanu

Contents

  • Creating a Character
    • agent_subtypes
    • agent_uniforms
    • campaign_character_art_sets
    • campaign_character_arts
    • character_skill_node_sets_tables
    • faction_agent_permitted_subtypes
  • Agent Actions
    • agent_actions_tables
  • Legendary Lords and Heroes

Setup

This guide assumes you have created the unit for you custom hero/lord, see Cryswar's Unit Guide if you haven't yet.

You should also have Rusted Pack File Manager (RPFM). It's free, it's easy to use, and it's well maintained.

Below is a list of tables, localization files, and other resources that are required to add a new agent to the game, as well as a few optional ones.

Required

  • Tables
    • agent_subtypes
    • agent_uniforms
    • campaign_character_art_sets
    • campaign_character_arts
    • character_skill_node_sets
    • faction_agent_permitted_subtypes
  • Localizations
    • agent_subtypes.loc
  • Porthole Process

Optional

  • Tables
    • agent_actions
    • effect_bonus_value_agent_action_record_junctions_tables
    • character_skill_level_to_effects_junctions_tables
    • character_skill_nodes_tables
    • names
  • Localizations
    • names.loc
  • Lua script to spawn your character

Now I can drone on about the tables and whats in them or we can build a mod together. Lets do the latter. We're going to make a mod that adds new characters to the game.

So what kind of characters should we mod into the game? What kind of characters does Total War Warhammer II need?

How about a Chaos Sorcerer of Life, and a Chaos Sorcerer Lord of Life. Maybe Archaon had a change of heart and wants to heal the world.

We're going to ignore the unit tables, if you want to build this mod along with this guide then go ahead and set up the unit tables now. This guide will help you set everything up

Great! Now that we have our units ready lets walk through the tables we need to create our tree hugging Champions of Chaos. I have provided the tables needed in this guide, but some are too large to fit on the page. You'll need to zoom out (left ctrl + mouse wheel) to see them fully.

One more thing, this is our completed mod, you can download it and use it to follow along if you'd like.


Creating the Character

agent_subtypes

Any character or lord on the campaign map or embedded into an army is an agent. The agent_subtypes table contains basic information about this specific subtype of agent.

Here's the agent_subtypes table for our new chaos characters

I know, theres a lot, but don't worry! Its not as hard as it looks and most of it is self explanatory

  • Key
    • Key is well, the key of our agent subtype. This is a unique key that will be used to reference our agent from the db or scripts. This must be a unique key and if possible should match the main_unit key for your agent.
  • Auto Generate
    • Whether or not the game should automatically generate this character and add them to the character pool. Leave this unchecked for unique characters like Legendary Lords. Names will be generated from the factions name list. Starting traits have to be added to a list for each subtype. More on that later. For our characters, we are going to leave this checked, since we want the game to make generic versions of these characters
  • Is Caster
    • This just determines whether or not this character can use casting items.
  • Small Icon
    • The icon you'll see on the campaign map for this character. Lords have this icon overridden so you can leave it blank for them.
  • Associated Unit Override
    • The main_unit key associated with this character. You don't need a new subtype for each mount, only the base unit is needed here.
  • Audio Voiceover Actor Group
    • The voice that this character has on the campaign map. Battle voice actor is determined in main_units (yes, they can be different).
  • Show in Ui
    • Whether or not this character shows up in the recruitment panel. Set to false for Legendary Heroes like Cylostra's Damned Paladin or Wulfhart's unique hereos.
  • Cap
    • This is only used for Gotrek, Felix, Lord Kroak, and Henri le Massif. As far as I know it isn't needed even for Legendary Lords or unique heroes. Leave this as -1.
  • Has Female Name
    • Self Explanatory
  • Can Gain Xp
    • Self Explanatory
  • Loyalty is Applicable
    • This doesn't add your lord to the loyalty system, it only shows the loyalty icon above their banner and in their details panel. Loyalty is scripted, you must add your lords to the loyalty scripts to add them to the loyalty system
  • Contributes to Agent Cap
    • Whether or not this subtype takes up an agent slot. I set this to false for my unique Heroes, but you can leave it as true if you want. This should always be true for Lords.
  • Recruitment Category
    • As of the Warden and the Paunch, Lords now are separated into different groups like Heroes. This value determines which group your lord should be sorted into. Leave this blank for Heroes
  • Magic Lore
    • Used only for sorting Lords into categories under their respective Recruitment Category. Leave this blank for Heroes
  • Audio Vo Culture Override
    • Only Grom and the River Troll Hag use this. Just leave it blank

agent_uniforms

This one is simple, and you should have already done this when you went through the porthole process. I won't go through it since this its pretty simple, just reference the variant key for your subtype (or for this variation, you need a uniform for each variant unless you want this hero type to all look the same).


campaign_character_art_sets

This table is one of two that determine your agent's campaign variant.

  • Art Set Id
    • Unique ID for your character Art Set. This is needed for every variation of your subtype. Most vanilla agents have 2-5 different art sets (and subsequent uniforms/portholes). Our characters only have one each to make things easy.
  • Is Custom
    • Leave this false. Only a few unique characters like Kemmler and Mannfred use this and idk why
  • Agent Type
    • The agent type your subtype belongs to. Lords are all generals, heroes can be wizards, champions, spies, dignitaries, and engineers. There are others but they're deprecated
  • Faction
    • I'm pretty sure this is how you limit which faction this art set applies to, Lokhir is the only one I'm aware of that uses this. Best to leave this blank
  • Culture
    • Same as above, just follow a vanilla equivalent
  • Subculture
    • Again, same as above. Chaos Lords and Heroes use this column, so I did too. When in doubt do what CA does
  • Is Male
    • Leave this checked. Yes, even if your character is a girl.
  • Agent Subtype
    • Your agent_subtype key
  • Campaign Map Scale
    • Leave as 1

campaign_character_arts

  • Art Set Id
    • Same as your art set Id from the above table
  • Level
    • Leave this as 0
  • Season
    • Leave this as none
  • Age
    • Leave this as 0
  • Portrait
    • Leave this blank
  • Uniform
    • The agent_uniform this character art uses
  • Card
    • Leave blank
  • Info
    • Leave blank
  • Sea Uniform
    • The ship you see on the campaign map when this agent embarks onto the water
  • Navy Uniform
    • Deprecated. Use the faction's default lord Navy Uniform
  • Land Animation
    • The animation your character uses on the campaign map. Must be a campaign animation, battle animations don't work here.
  • Sea Animation
    • The animation your ship uses on the water.
  • Navy Animation
    • again, deprecated, copy the vanilla Lord default value
  • Id
    • Unique ID for this character art. This must be a unique number.
  • Religion
    • Leave blank
  • Land Animation Vfx Filter
    • Leave as 0
  • Sea Animation Vfx Filter
    • Leave as 0
  • Navy Animation Vfx Filter
    • Leave as 0

character_skill_node_sets_tables

This table connects your character skill node set to your subtype. Without this table, your character won't have any skills to use when they level up. I won't go through the basics of skills in this guide, there already exists a guide for it, but you will need this to fully flesh out your characters so I've added it.

  • Key
    • Unique Key for this node set
  • Faction Key
    • Leave blank
  • Campaign Key
    • Leave Blank
  • Agent Key
    • The Agent type for you subtype. Yes, you have to specify it again. This isn't even the last time either.
  • Subculture
    • Leave Blank
  • For Army
    • Leave unchecked
  • For Navy
    • Leave unchecked
  • Agent Subtype
    • This will add this character node set to your agent subtype. All characters with this subtype will have the same skill node set. If you want your characters to have different skill node sets you need to make new subtypes

faction_agent_permitted_subtypes

This mess of a table is what adds your agent subtype to the faction of your choice. You have to add your subtype to every faction that will have access to the subtype.

  • Faction
    • The faction that will now have access to this agent subtype
  • Agent
    • Yes, you have to specify this again. No, I don't know why
  • Subtype
    • Your agent subtype

agent_subtypes.loc

You should be familiar with loc files by now, but agent_subtypes_onscreen_name_override_YOUR_KEY specifies the name and agent_subtypes_description_text_override_YOUR_KEY specifies the description of your agent subtype.


And that's it! With those tables filled out, you've done everything you need to turn your unit into a recruitable character! Assuming you have your unit tables finished, you can now go into campaign and recruit your new Chaos Sorcerer Lord of Life.

If it's crashing or your characters aren't showing up as recruitable, check that you filled out everything right, or use the example mod as a comparison.


Adding Agent Actions

But wait! What about our Chaos Sorcerer's campaign actions? How can we get our new campaign hero to assault units or assassinate a character?

Well, the campaign actions are added via skills, and we can just add a skill that CA already defined for us to our characters skill node set. But maybe we want our character to be a little more unique?

Lets give them a different set of abilities, we'll need to create a new skill, which you can do by following this guide. After you made a new skill and added it to the skill node set, lets add some agent actions to it in the character_skill_level_to_effects_junctions table:

This is a copy of the vanilla wh2_main_skill_all_dummy_agent_actions_chs_sorcerer skill, but we want to make some changes, so lets replace the passive wh2_main_effect_agent_action_enable_wizard_hinder_settlement_steal_technology, which give our hero the ability to boost technolofy by attacking a settlement, and replace it with wh2_main_effect_agent_action_enable_wizard_hinder_settlement_damage_walls, which lets him damage the walls instead:

Great! Now we have a hero who has a different set of campaign actions. Keep in mind you must use effects that apply to your agent type, if you want to add an agent action that doesn't exist already, you must make the agent action and effect to apply it. Lets go ahead and make a new agent action for the Chaos Sorcerer of Life. We'll give him the ability to assassinate, something normal wizards can't do in the base game. Here are the tables you'll need:

  • agent_actions
  • effect_bonus_value_agent_action_record_junctions_tables

I'm going to skip over the effect tables, you can make a new empty effect using this guide if you want to follow along, otherwise, I'll assume you have your effect ready.

agent_actions

This table is very convoluted and particularly finicky, you'll want to start with an agent action that already exists to avoid making mistakes. Lets start with the Exalted Hero's assassinate ability, defined as wh2_main_agent_action_champion_hinder_agent_assassinate

in the agent_actions table.

We're not going to change much here, just the Agent and the Unique Id. We'll copy this row from the CA data.pack into our mod, change Agent to wizard and Unique Id to chs_chaos_sorcerer_life_assassinate

Now we can add the agent action to the effect_bonus_value_agent_action_record_junctions_table

And finally add our effect to the chs_chaos_sorcerer_life_agent_actions skill we made

And that's it! We now have a custom hero subtype that has a unique set of campaign actions!

Legendary Lords and Heroes

Making Legendary Lords and Heroes is simple, plus you've already done most of the legwork. A guide on how to name them and spawn them on the campaign map is available here.