FALLOUT 4
Tutorial - Adding custom workshop categories with scripts by DarthWayne
Fallout 4 » Modders Resources and Tutorials
Added: 20/04/2016 - 01:31PM
Updated: 24/02/2017 - 03:50PM

1,072 Endorsements

1.2 Latest version

11,005 Unique D/Ls

23,290 Total D/Ls

66,382 Total Views

Uploaded by DarthWayne

Description

Last updated at 15:50, 24 Feb 2017 Uploaded at 13:31, 20 Apr 2016

This is a simple tutorial showing you how to add custom categories to the workshop menu using scripts without producing compatibility issues. No more compatibility patches!

With this template you can:

- Add new workshop menus and categories without conflicts!
- Add new crafting categories without conflicts!
- Add weapons to leveled lists without conflicts!
- Add whatever you want to whatever formlist you want without conflicts!


As you may know, the workshop categories are defined in formlists. If you want to add a category, you have to add kewords and/or other formlists to the vanilla ones. If two mods edit the same formlist, you will automatically have a compatibility problem.

>>> NEVER EVER EDIT VANILLA FORMLISTS! <<<


So what else can you do? Formlists can also be edited with scripts (see CK wiki for details). That way multiple mods can add categories to the same menu without conflicting to each other. The only problem is, that you somehow need to automatically run your script. That is what this template was made for. It adds a quest to the game that runs on startup. Here you can add all your categories to the crafting menu.



How to use this template in your mod

  1. Open up this file and your workshop mod in xEdit.
  2. Copy the quest WorkshopAddCategoriesTemplate to your mod.
  3. Now switch to CK and fill the properties. Add more if needed.
  4. Adjust the script to your needs and rename it. See comments in source code for details.
  5. Don't forget to also implement the uninstall function and test disabling your mod!


How to implement an uninstall function

This is important. If you want to uninstall or disable a mod that adds new menus or categories with a script, you have to add an uninstall functionality. Otherwise users will loose the edited menu, as the forms you previously added to them will be "none" then. There are basically three ways you could implement this:

  1. Use an uninstall chem, that can be crafted at the chem station. This method will only work before disabling the mod.
  2. Use a while loop to check if your mod is still active and remove all "none" values from the vanilla formlist if not.
  3. Use the fixer quest, that runs every time you start the game and remove all "none" values from all formlists.
  4. Special cases: In my mod Build your own Vault I add the categories when the player enters the vault and remove them if he leaves the vault again.

>>> IMPLEMENT THE UNINSTALL FUNCTION! <<<

Source Code

All source codes are included in the download. You have to adjust the CustomCategoriesInstallerScript a bit to fit your needs.


Credits

Thanks to ad3d0 and steve40 for giving me very important hints regarding the uninstall functions!