Tutorial - Add a custom seminar category using script
教程 - 使用脚本添加自定义研讨会类别
Screenshots 2 screenshots
About this mod Machine translation
This is a simple tutorial that shows you how to use a script to add custom categories to your seminar menu without creating compatibility issues. No more compatibility patches!
Using this template you can:
- Added new workshop menu and categories, no conflicts!
- Added new crafting categories, no conflicts!
- Add weapons to the level list without conflicts!
- Add anything you want to any form list you want,
As you know, seminar categories are defined in table lists. If you want to add categories, you have to add kewords and/or other form lists to vanilla. If two mods edit the same form, you will automatically have compatibility issues.
>>Never edit VANILLA FORMLISTS! <<<
So what else can you do? Formlists can also be edited using scripts (see the CK wiki for details). This way multiple mods can add categories to the same menu without conflicting with each other. The only problem is, you need to run your script automatically. That's what this template is for. It adds the pursuit of a game that runs on startup. Here you can add all categories to your crafting menu.
How to use this template in your mod
Open this file and your studio mod in xEdit.
Copy the task WorkshopAddCategoriesTemplate to your mod.
Now switch to CK and populate the properties. Add more if needed.
Adapt the script as needed and rename it. See comments in source code for details
Don't forget to implement uninstall functionality as well and test disabling your mods!
How to implement the uninstall function
This is very important. If you want to uninstall or disable mods that add new menus or categories via scripts, you must add uninstall functionality. Otherwise, the user will lose the edited menu because the form previously added to it will be "None". There are basically three ways to achieve this:
Use the Unload Chemical, which can be crafted at the Chemistry Station. This method only works until the mod is disabled.
Use a while loop to check if your mod is still active and if not, remove all "none" values from the vanilla formlist.
Use a fix task that runs every time you start the game and remove all "None" values from all form lists.
Special case: Building my own Vault in my mod I add the category when the player enters the vault and remove it if he leaves the vault again.
>>Implement the uninstall function! <<<
source code
All source code is included in the download. You will have to tweak the CustomCategoriesInstallerScript slightly to suit your needs.
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- There is no universal mod manager for this game: some mods replace game files directly, some go into a game-specific Mods folder, and some need a game-specific community loader or tool first — follow the bundled readme.
- Place the files exactly as the readme says; mods with listed dependencies need those installed too.
- Launch the game to confirm it loaded; some games require enabling mods in settings or an in-game mod menu.
Install locations vary a lot between games and mods — the bundled readme is the most reliable guide.