TofuSojo
Chieftain
I'm trying to get my mod to detect if my other mod is enabled and only then update the database with a specific xml file. Detecting my other mod is easy, and I read elsewhere how to get a lua script to update the database with an xml (assuming it works). The trouble I'm having is getting my lua script to run at the right time, since it has to happen after mods have been enabled but before the debug database has been created (after which it's too late to change it).
From Gedemon's great Custom Advanced Setup mod I got the idea to use Events.AfterModsActivate, since that sounded like the right event for when my lua should run and like his AdvancedSetup.lua file I've set mine to VFS=true and not added it to the Content tab as an InGameUIAddIn--which I understand only happens right before the player presses the Begin Your Journey Button, so it's too late--yet, my lua file never even runs. Here is the only function in the lua file:
DetectTechtreeOverhaul is the custom action I added to the Actions tab of my mod that updates the database with my xml file. Confirming that works right would be the next step
.
Anyone know how to get this to work?
From Gedemon's great Custom Advanced Setup mod I got the idea to use Events.AfterModsActivate, since that sounded like the right event for when my lua should run and like his AdvancedSetup.lua file I've set mine to VFS=true and not added it to the Content tab as an InGameUIAddIn--which I understand only happens right before the player presses the Begin Your Journey Button, so it's too late--yet, my lua file never even runs. Here is the only function in the lua file:
Code:
function DetectTechtreeOverhaul()
print("DetectTechtreeOverhaul running...")
local TechtreeOverhaulModID = "265a41e4-afb6-45d3-b361-fa16d74a8a70"
for _, mod in pairs(Modding.GetActivatedMods()) do
if (mod.ID == TechtreeOverhaulModID) then
print("Techtree Overhaul mod detected!")
Modding.PerformActions("TechtreeOverhaulDetected")
end
end
end
Events.AfterModsActivate.Add(DetectTechtreeOverhaul)
DetectTechtreeOverhaul is the custom action I added to the Actions tab of my mod that updates the database with my xml file. Confirming that works right would be the next step

Anyone know how to get this to work?