In TTT some roles have shops where they are allowed to purchase weapons. Given the prevalence of custom weapons from the workshop, the ability to add more weapons to each role's shop has been added.
Follow the sections below to add any shop weapon to any role's shop, via step-by-steps instructions using our in-game UI or by manipulating files on your host server.
The easiest way to configure the role shops is via a user interface usable by administrators directly from a running game. To open the interface, run the ttt_roleweapons
command from your console. The window that opens should look something like this:
This window was made to closely resemble the role equipment shop so parts of it should be fairly intuitive to use. For example: the search bar, the weapon list, and the weapon info panel are all directly copied from the weapon shop.
Apart from those familiar pieces, this window also adds a few more controls specifically for configuring the role weapons shops:
To help understand the functionality of this window it might be easier to walk through an example: we are going to find the Health Station (which we know the Detective can buy) and add it to the Veteran's shop. The Veteran gets a shop when they are activated, but only if weapons are actually available to them. This is where the role weapons system comes into play.
First things first: we open the window and select "Detective" from the "Search Roles" dropdown. From there we can either scroll through the list of weapons or use the search text box to search for "health". We then choose "Veteran" from the "Save Role" dropdown and click the "Include" checkbox. With all that done the window should look like this:
From here, the last step is to click the "Update" button and we're done -- The Veteran now has the ability to buy a Health Station.
If you cannot or do not want to use the in-game UI to set up the role shop, it is also doable by manual file manipulation. This may be useful for server operators using Docker who want to have the configurations embedded in their server image.
NOTE: Using the configuration UI still creates and deletes files in the backend. Given that, you can use the UI on your local game and then copy the files to a server or Docker image build as needed.
Before a role's shop can be modified, the initial folder and file structure will need to be created. Follow the steps below to accomplish this:
{"Excludes":[],"Buyables":[],"NoRandoms":[],"Loadouts"[]}
To add weapons to a role (that already has a shop), modify the garrysmod/data/roleweapons/{rolename}.json file (using a text editor like Notepad++) and add the class name of the weapon wrapped in double quotes (e.g. "weapon_ttt_somethingcool") to the Buyables
array. For example, {"Excludes":[],"Buyables":["weapon_ttt_somethingcool"],"NoRandoms":[],"Loadouts"[]}
Also note the ttt_shop_* ConVars that are available above which can help control some of the role weapon shop lists.
At the same time, there are some workshop weapons that are given to multiple roles that maybe you don't want to be available to certain roles. In order to handle that case, the ability to exclude weapons from a role's weapon shop has been added.
To remove weapons from a role's shop, modify the garrysmod/data/roleweapons/{rolename}.json file (using a text editor like Notepad++) and add the class name of the weapon wrapped in double quotes (e.g. "weapon_ttt_somethingcool") to the Excludes
array. For example, {"Excludes":["weapon_ttt_somethingcool"],"Buyables":[],"NoRandoms":[],"Loadouts"[]}
With the addition of the Shop Randomization feature (and the ttt_shop_random_* ConVars), weapons may not always appear in the shop (which is the point). If, however, you want certain weapons to always be in the shop while other weapons are randomized, the ability to bypass shop randomization for a weapon in a role's weapon shop has been added.
To stop a weapon from being removed from a role's shop via randomization, modify the garrysmod/data/roleweapons/{rolename}.json file (using a text editor like Notepad++) and add the class name of the weapon wrapped in double quotes (e.g. "weapon_ttt_somethingcool") to the NoRandoms
array. For example, {"Excludes":[],"Buyables":[],"NoRandoms":["weapon_ttt_somethingcool"],"Loadouts"[]}
You can also use the roleweapons system to add a weapon to a role's loadout, meaning they would get that weapon automatically at the beginning of each round.
To add a weapon to a role's loadout, modify the garrysmod/data/roleweapons/{rolename}.json file (using a text editor like Notepad++) and add the class name of the weapon wrapped in double quotes (e.g. "weapon_ttt_somethingcool") to the Loadouts
array. For example, {"Excludes":[],"Buyables":[],"NoRandoms":[],"Loadouts":["weapon_ttt_somethingcool"]}
.
To find the class name of a weapon to use above, follow the steps below
lua_run PrintTable(player.GetHumans()[1]:GetWeapons())
Equipment are items that a role can use that do not take up a weapon slot, such as the body armor or radar.
To add equipment items to a role (that already has a shop), modify the garrysmod/data/roleweapons/{rolename}.json file (using a text editor like Notepad++) and add the name of the equipment item wrapped in double quotes (e.g. "bruh bunker") to the Buyables
array. For example, {"Excludes":[],"Buyables":["bruh bunker"],"NoRandoms":[],"Loadouts"[]}
Similarly there are some equipment items that you want to prevent a specific role from buying. To handle that case, the addon has the ability to exclude specific equipment items from the shop in a similar way.
To remove equipment from a role's shop, modify the garrysmod/data/roleweapons/{rolename}.json file (using a text editor like Notepad++) and add the name of the equipment item wrapped in double quotes (e.g. "bruh bunker") to the Excludes
array. For example, {"Excludes":["bruh bunker"],"Buyables":[],"NoRandoms":[],"Loadouts"[]}
You can also use the roleweapons system to add a weapon to a role's loadout, meaning they would get that weapon automatically at the beginning of each round.
To add a weapon to a role's loadout, modify the garrysmod/data/roleweapons/{rolename}.json file (using a text editor like Notepad++) and add the name of the equipment item wrapped in double quotes (e.g. "bruh bunker") to the Loadouts
array. For example, {"Excludes":[],"Buyables":[],"NoRandoms":[],"Loadouts":["bruh bunker"]}
.
To find the name of an equipment item to use above, follow the steps below
lua_run GetEquipmentItemById(EQUIP_RADAR); lua_run for id, e in pairs(EquipmentCache) do if player.GetHumans()[1]:HasEquipmentItem(id) then print(id .. " = " .. e.name) end end