Total War: WARHAMMER III

Total War: WARHAMMER III

Tabletop Caps: Thrones of Decay
DrunkFlamingo  [developer] 12 Apr, 2022 @ 5:48pm
Unit Submod Code Template
NOTE: Starting with the last update, you should put these files in script/ttc/. Scripts inside of script/campaign/mod will still work, but won't be included in Mod Configuration Tool options.



Use this template to make your unit mod support tabletop caps.


local modded_units = { {"a_unit", "core"}, {"a_better_unit", "special", 2}, {"a_bester_unit", "rare", 1} } local ttc = core:get_static_object("tabletopcaps") if ttc then ttc.add_setup_callback(function() ttc.add_unit_list(modded_units) end) end


Place this inside a .lua script file in script/ttc/

This file is safe to include directly in other mods - the script will do nothing when TTC is not present.
Last edited by DrunkFlamingo; 2 Jun, 2022 @ 10:48am
< >
Showing 1-9 of 9 comments
Laevatain II 20 Apr, 2022 @ 5:06pm 
local wh3_units = {

----Cathay_radious
--Common
{"wh3_cat_jade_spear", "core"},
{"wh3_cat_peasa_sword", "core"},
{"wh3_cat_fear_archer", "core"},
{"wh3_cat_fear_axe", "core"},
{"wh3_cat_feat_halb", "core"},
--Special
{"wh3_cat_impe_sword", "special", 1},
{"wh3_cat_impe_spear", "special", 1},
{"wh3_cat_impe_rifle", "special", 1},
{"wh3_cat_tera", "special", 3},
--Rare
{"wh3_cat_sworn_heavy", "rare", 1},
{"wh3_cat_sworn_halb", "rare", 1},
{"wh3_cat_cele_sword", "rare", 1},
{"wh3_cat_saphire", "rare", 1},
{"wh3_cat_onyx", "rare", 1},
{"wh3_cat_onyx_cav", "rare", 1},
{"wh3_cat_front_sword", "rare", 1},
{"wh3_cat_front_spear", "rare", 1},
{"wh3_cat_front_cros", "rare", 1},
{"wh3_cat_front_bow", "rare", 1},
{"wh3_cat_sea_fire", "rare", 1},
{"wh3_cat_sea_repeat", "rare", 1},
{"wh3_cat_sea_mace", "rare", 1},
{"wh3_cat_sea_spear", "rare", 1},



local ttc = core:get_static_object("tabletopcaps")
if ttc then
ttc.add_setup_callback(function()
ttc.add_unit_list(wh3_units, true)
end)
end

all right, here is the code that i try to put into a new lua. it do not work, but when i copy this to your lua, put it under cathay park, works. those units from radious parks, I want do a Submod that can compatible to Radious unit park.
Last edited by Laevatain II; 20 Apr, 2022 @ 5:11pm
DrunkFlamingo  [developer] 20 Apr, 2022 @ 5:45pm 
Originally posted by Laevatain II:
local wh3_units = {

----Cathay_radious
--Common
{"wh3_cat_jade_spear", "core"},
{"wh3_cat_peasa_sword", "core"},
{"wh3_cat_fear_archer", "core"},
{"wh3_cat_fear_axe", "core"},
{"wh3_cat_feat_halb", "core"},
--Special
{"wh3_cat_impe_sword", "special", 1},
{"wh3_cat_impe_spear", "special", 1},
{"wh3_cat_impe_rifle", "special", 1},
{"wh3_cat_tera", "special", 3},
--Rare
{"wh3_cat_sworn_heavy", "rare", 1},
{"wh3_cat_sworn_halb", "rare", 1},
{"wh3_cat_cele_sword", "rare", 1},
{"wh3_cat_saphire", "rare", 1},
{"wh3_cat_onyx", "rare", 1},
{"wh3_cat_onyx_cav", "rare", 1},
{"wh3_cat_front_sword", "rare", 1},
{"wh3_cat_front_spear", "rare", 1},
{"wh3_cat_front_cros", "rare", 1},
{"wh3_cat_front_bow", "rare", 1},
{"wh3_cat_sea_fire", "rare", 1},
{"wh3_cat_sea_repeat", "rare", 1},
{"wh3_cat_sea_mace", "rare", 1},
{"wh3_cat_sea_spear", "rare", 1},



local ttc = core:get_static_object("tabletopcaps")
if ttc then
ttc.add_setup_callback(function()
ttc.add_unit_list(wh3_units, true)
end)
end

all right, here is the code that i try to put into a new lua. it do not work, but when i copy this to your lua, put it under cathay park, works. those units from radious parks, I want do a Submod that can compatible to Radious unit park.

You're missing a } to close the list and the last item in the list should not have a comma after it.
Laevatain II 20 Apr, 2022 @ 6:06pm 
thanks you, so can I submit a Radious compatible mod?
Captain Freakout 23 May, 2022 @ 4:57pm 
Hi DF and modders, I was hoping you could help. I'm a complete newbie at this and not very good, to be honest. I'm trying to make a submod for Stratovarius' Gnoblar Horde and Lost2Insanity's Yehtees. I added your code to the Yhetees and it worked; tried doing it as a "patch" and it worked. Then I tried doing it to SGH and it's not working, not even when I try to add it directly into the mod itself. I'm certain I have the unit names set down correctly, but maybe I'm doing something else wrong.

Here's the code:

local modded_units = {

----Gnoblar Horde by Stratovarius
--Common
{"str_gnoblar_shield", "core"},
{"str_gnoblar_dw", "core"},
{"str_gnoblar_groin", "core"},
{"str_gnoblar_flinger", "core"},
{"str_gnoblar_man", "core"},
{"str_gnoblar_squig", "core"},
{"str_gnoblar_squig_ror", "core"},
{"str_gnoblar_flinger_ror", "core"},
{"str_gnoblar_groin_ror", "core"},
{"str_gnoblar_man_ror", "core"},
--Special
{"str_gnoblar_lucky", "special", 1},
{"str_gnoblar_lucky_ror", "special", 1}
--Rare
{"str_gnoblar_boglar", "rare", 1},
{"str_gnoblar_blood", "rare", 1},
{"str_gnoblar_boglar_ror", "rare", 1},
{"str_gnoblar_blood_ror", "rare", 1}

}


local ttc = core:get_static_object("tabletopcaps")
if ttc then
ttc.add_setup_callback(function()
ttc.add_unit_list(modded_units)
end)
end

Is there something wrong with it? Or am I doing something else incorrectly?
DrunkFlamingo  [developer] 24 May, 2022 @ 5:03am 
You're missing a comma on the file entry in the special list.

All entries except the last need a comma following them.
Captain Freakout 24 May, 2022 @ 7:22am 
Thank you so much!!
Cipher 6 Jun, 2023 @ 6:10am 
@DrunkFlamingo Hey, I've edited the script for my 'Asrai Unit Pack (Wood Elves)' and it works perfectly. I'm trying to decide if its better to make it a submod or have it integrated.

My question is; do you see any issues with leaving the script in the mod when not used alongside this mod? It seems fine on my end but thought I'd check with you just to be safe. Thanks :)
DrunkFlamingo  [developer] 6 Jun, 2023 @ 6:55am 
As long as you used the template, containing the "if ttc then" line, there is no issue with you including the script in your mod.

If the person isn't using the mod, then "ttc" won't exist and the code inside the 'if ttc then' block will never be executed, so nothing will happen. If they are using TTC, then the integration will work.
Cipher 6 Jun, 2023 @ 7:16am 
Perfect, yep I've got the script containing the full template just with my own units added in.

Thanks for the quick answer, the script is well made too, I'm just overly cautious! I'll update it now and mention compatibility in the description. :steamthumbsup:
< >
Showing 1-9 of 9 comments
Per page: 1530 50