Skip to content

Instantly share code, notes, and snippets.

@Shazbot
Shazbot / wh2_frontend_UI_dump.lua
Created August 12, 2021 19:41
Dump UI hierarchy in the frontend with a delay
core:remove_listener("pj_frontend_ui_dump_real_timer_cb")
core:add_listener(
"pj_frontend_ui_dump_real_timer_cb",
"RealTimeTrigger",
function(context)
return context.string == "pj_frontend_ui_dump_real_timer"
end,
function()
print_all_uicomponent_children(core:get_ui_root())
end,
@Shazbot
Shazbot / TW_exec_lua.md
Last active November 20, 2019 01:00
Little introduction to using the Execute External Lua File mod in Total War Warhammer 2

So, we have our scripts in a pack, but it'd be nice if we could pull out functions, or tables with data, or listeners, and modify them on the fly using exec.lua. So to do that we need access to those things from external files, i.e they need to be globally accessible. Therefore, we need our mod to put those references into a globally accessible table. We initialize this global table like this:

MYMOD = MYMOD or {}

this is just shorthand for

if not MYMOD then
	MYMOD = {}
end
@Shazbot
Shazbot / customize_reverse_twins.lua
Created October 21, 2019 16:18
Customize reverse twins breed transitions using Execute Lua Ingame
local mod = get_mod("SpawnTweaks")
local data = mod.reverse_twins_data
data.breed_tier_list = {
chaos_fanatic = {
"chaos_marauder",
"chaos_marauder_with_shield",
},
chaos_marauder = {
"chaos_berzerker",
@Shazbot
Shazbot / sigcheck.py
Last active September 2, 2019 21:44
Script that compares function signatures inside lua files to those in the Vermintide 2 Source Code
# Pass the mod folder as script argument: python3 sigcheck.py /c/mods/SpawnTweaks
# Put comments inside lua files in the format of
# CHECK followed by the function signature in a new line
# e.g. to check if HordeSpawner.spawn_unit was changed:
# -- CHECK
# -- HordeSpawner.spawn_unit = function (self, hidden_spawn, breed_name, goal_pos, horde)
import os
from os import path
import mmap