How to Add Workshop Collections to Garry's Mod
Before adding a workshop collection to your server, you will need to firstly create a collection on the Steam website. Start the Steam Launcher, and click on the game you want to create a collection for.
When the game page loads, click on the "browse the workshop" link in the Workshop section of the game's page. This will take you to the game's workshop page. Select "collections" under the "browse" tab, below the title bar
Here you can browse through collections created by other users, or start your own Workshop collection by selecting the blue "Create Collections" button on the right side of the screen. If you choose to start your own collection, you will be prompted for a collection title, an image to represent the pack in the collections listing, a description of the collection, and to choose a category for the pack.
The easiest method to select content to be included when creating your own Workshop Collection is to choose "addons" from the "browse" menu, and then view each addon, and add it to "favorites" . When you create a Workshop collection later on, you will be able to view all the addons that are on the favorites list, and select from those addons.
For a more detailed tutorial on this process, see the "related article" section below.
Find Workshop Collection ID
Once you've found the collection you want to use, you'll need to get the Workshop Collection ID. When on any collection page you'll need to find the ID from the URL in your browser's address bar. In this example we have bolded the ID:http://steamcommunity.com/sharedfiles/managecollection/?id=
1092079550
Enter Collection ID in Game Settings on Control Panel:
Enter the workshop ID in the box labelled "Workshop Collection ID", and click the "save" button below.
You can only enter a single workshop collection ID in this box. If you wish to have content from one collection, and content from a second, you need to make a new collection that includes both sets of content.
Entering the collection ID in this window is functionally the same as using the command line parameter
+host_workshop_collection WORKSHOPID
Force Connecting Players to Download Collection:
Navigate to
/garrysmod/lua/autorun/server/
Click
create file
button above file manager windowThe file will open in the file manager window, and enter the following text
resource.AddWorkshop( "AddonID" ) -- Awesome addon with sharks and laserbeams
You will have to add a separate line for each addon you want players to have to download.
Addons are not the same as the collection ID. Addons are each separate entry that is inside the collection. For some very large collections, this will require quite a few lines be added, and if you change or modify the contents of the Workshop collection, you will have to modify each affected line in this file. There are automated scripts that will generate the contents, but they require some advanced knowledge and fall outside the scope of this article.
The content found after the --
is a comment and won' be parsed by the Lua engine. It's helpful to comment each line with the addon is, so you can easily remove/add ones in the future without having to relocate the addon IDs.
When finished, give the file a title in the blue box directly above the file manager, ending with .lua.
YourTitle.Lua
, for example.Change the
YourTitle
part of the filename to whatever name you want.workshop.lua
is a common choice.