events.FirstTickAfterWorldCreated[#events.FirstTickAfterWorldCreated+1] = function(context) My_StartFunction(); return true;

if cm:model():campaign_name("main_warhammer") then --do you your ME stuff elseif cm:model():campaign_name("wh2_main_great_vortex") then -- do your vortex stuff end;

Hello, as some of you may know, when adding scripts in mods you face compatibility issues when several mods edits the same file. Unfortunately you still need to make such changes to add your own custom scripts files which forces you to edit one of the game files. A project like @Crynsos script compatibility mod was designed to provide a way to include several mods at once.After poking the system for a while I've found a solution that avoid this issue and allows you to include your own lua files a be compatible with any mod.Basically at the start of campaign, the game load several export files such as export_helpers and export_ancillaries. The good thing is that it will load any file following the good naming conventionSo to add you own scripts, do the following :Create a export_helpers_mysupermod.lua file in scriptsIn this file, start withMyStartFunction will be triggered at the start of a game, after the faction specific files. In it you can execute your code or require other files you may have writtenSince this file is loaded in all campaigns you may want to check which one is really activeAnd that's it! By including the export_helpers_mysupermod.lua file in PFM, it will be loaded and execute whatever you fancy. If you keep your file names and functions distinct, you won't have compatibility issues andIf you want to see a more complete example you can peruse these two mods of mine I've added commentaries in the slower intervention script.Caveats : of course with this method, you can't chirurgically insert your code at the exact moment you'd want. Try exploring the other events types to find something more adapted, perhaps. My first tries to directly attack the campaign manager in the loaded files didn't work out, but maybe I was missing somethingIn many case you'll want to exact changes in existing scripts because it is mandatory or simpler, and this method won't help you. You wil face the same compatibility issues. If you already have very distinct files and just insert a require line somewhere, this method will help you.Good luck, there would a lot to write on scripting, maybe another time.