Total War: WARHAMMER II

Total War: WARHAMMER II

Table Top Caps - Silent and Furious Edition
 This topic has been pinned, so it's probably important
DrunkFlamingo  [developer] 20 Mar, 2021 @ 2:42pm
How to add your modded units to Tabletop Caps
Full example here:
https://drive.google.com/drive/folders/1xsnnEYeJ3wxr8K56G9-w3cuuKDMhh9wN?usp=sharing




To add units to tabletop caps, create a fill in /script/campaign/mod. It does not matter what you name the file so long as your name is unique and has the .lua extension.

At the top of your file, write:
local rm = _G.rm


Prepare a table as follows:
local my_units = { {"wh2_dlc11_cst_inf_depth_guard_ror_0", "cst_special", 2}, {"wh2_dlc11_cst_inf_zombie_gunnery_mob_ror_0", "cst_special", 1}, {"wh2_dlc11_cst_inf_deck_gunners_ror_0", "cst_special", 1} }

In this table, the first string is the unit key, the second string is the group that the unit belongs to, and the number is the cost of the unit. If a unit is a member of a core group, you can omit the number if you like.

Then, simply call this command:
if not not rm then rm:add_units_in_table_to_tabletop_groups(my_units) end


I have one unit key which is given to multiple subcultures, what do I do?

Add the unit to its primary subculture (whoever uses it most, just pick one it doesn't matter) the normal way. Then, for each additional subculture the unit must be added to, follow this example:

local multiple_subculture_units = { {"wh2_main_lzd_cav_cold_ones_feral_0", "wh2_main_sc_def_dark_elves", "def_core"}, {"wh2_main_lzd_mon_stegadon_0", "wh2_main_sc_def_dark_elves", "def_special", 3}, {"wh2_main_lzd_mon_carnosaur_0", "wh2_main_sc_def_dark_elves", "def_rare", 2} } if not not rm then rm:add_loaned_units_in_table(multiple_subculture_units ) end

The only difference in this table is that you must insert the subculture which this unit is going to. If you are assigning a unit to more than 2 subcultures, things stay the same, just add it to the normal table once and add it to this secondary table as many additional times as is necessary.

I want to make a special rule

if not not rm then rm:add_post_setup_callback(function() --this gives skrolk core plague monks rm:create_unit_override("wh2_main_skv_inf_plague_monks", "core_plague_monks") rm:add_subtype_filter_for_unit_override("wh2_main_skv_lord_skrolk", "core_plague_monks", "skv_core", 1) rm:set_ui_profile_for_unit_override("core_plague_monks", "[[col:yellow]]Special Rule: [[/col]] Lord Skrolk can recruit Plague Monks as Core units in his armies. \n Armies may have an unlimited number of Core Units.", "ui/custom/recruitment_controls/common_units.png") end) end

Follow this example. In the first command, the first arg is the unit key, the second arg is a name for the special unit. In the second command, the first arg is the character subtype key of the lord who is recieving a special unit, the second arg is the name for the special unit, the third arg is the group of the special unit, and the final arg is the cost of the special unit.

I'm adding units for a subculture which doesn't appear in the Vanilla game. What do I do?

You'll want to create a second file to hold subculture relevant settings. I would recommend following the example from the templates and vanilla data files. The important commands are:

rm:add_subculture_path_filter("subculture_key", "PathKey")
This tells the script what kind of UI your subculture uses. See the script\campaign\mod\TableTopCaps_vanilla_ui_settings.lua file for possible Path Keys to use with this command.

rm:set_group_prefix_for_subculture("subculture_key", "prefix")
which tells the script what three letter prefix (example: emp) should be used for your subculture.

Both of these commands are used in the template files and you should be able to figure it out based on that.

My main_unit keys and land_unit keys don't match
In order to get everything to display properly, the script needs to know what the land unit keys are. You can fix this problem by copying this template code:

local main_unit_to_land_units = { ["wh_dlc07_brt_peasant_mob_0"] = "wh_dlc07_brt_inf_peasant_mob_0", ["wh_dlc08_nor_mon_warwolves_0"] = "wh_dlc08_nor_mon_marauder_warwolves_0", ["wh_dlc08_nor_veh_marauder_warwolves_chariot_0"] = "wh_dlc08_nor_cav_marauder_warwolves_chariot_0" } rm:add_post_setup_callback(function() for main_unit_key, land_unit_key in pairs(main_unit_to_land_units) do rm:get_unit(main_unit_key):set_land_unit(land_unit_key) end end)

Can I see a full example?

Here is an example from JvJ which adds units from OvN:
https://drive.google.com/drive/folders/1xsnnEYeJ3wxr8K56G9-w3cuuKDMhh9wN?usp=sharing
Last edited by DrunkFlamingo; 22 Mar, 2021 @ 9:18am
< >
Showing 1-2 of 2 comments
DrunkFlamingo  [developer] 21 Mar, 2021 @ 1:31pm 
Always remember to make sure that any calls you make to "rm" are incased within an "if not not rm then" - "end" block. This will ensure that your script doesn't cause issues when your users are not using my mod.
dr.makafui 9 Jul, 2021 @ 6:42am 
Hi, when I try to redefine the special rules for certain characters, it doesn't seem to work. So I followed your example and was successfully able to redefine the shadow warriors as core for Alith Anar. But when I try to redefine the shadow-walkers as special with one point or the dragons for imrik as rare with one point, it seems they get removed from the system altogether. Please help
< >
Showing 1-2 of 2 comments
Per page: 1530 50