Re-arm scripts
TTT has a system for creating or modifying the weapon and player spawns of a map. This is primarily useful for taking a map not created for the gamemode and making it playable in TTT. The system works by creating what are called “re-arm scripts” (because you are placing new weapons, hence the term re-arming) using the TTT Weapon Placer tool in Gmod’s Sandbox mode. Placing those scripts on a server will apply the new spawns when the map is loaded.
In this guide I will go through the basic process by placing some guns and stuff, in this case on the CS:S map de_dust. Being a standard CS:S map it does not have any TTT weapons, no ammo, and really boring player spawn locations by default (though TTT includes a re-arm script for it). We can fix that by making a re-arm script.
NOTE: You may run into a problem where your own re-arm script for a CS:S map (like de_dust) is ignored and the game always loads the script that is included with TTT. You can avoid this by moving or renaming the included script for the map located in /garrysmod/gamemodes/terrortown/content/maps, for example changing “de_dust_ttt.txt” to “de_dust_ttt_original.txt”.
You won’t have this problem with maps for which TTT does not include a re-arm script.
Setting up the tool
You can grab the TTT Weapon Placer tool from the Steam Workshop. Just hit the subscribe button and you’ll have it in Garry’s Mod as an addon, and you can move on to the next section right away.
Getting started
Start up Garry’s Mod. Open the new game menu, and select the map you want to create spawnpoints on. Make sure the game is set to the “sandbox” gamemode. Start the game in singleplayer. The tool will not work properly in multiplayer.
Once you’re on the map in sandbox, you can start placing some spawns. First you should know that any existing weapons (for example on HL2DM maps) will be removed by TTT when the map is loaded in the gamemode. You may still see the weapons right now in sandbox, so you can either choose to use the Remover to get rid of them, or just ignore them.
For the most part, you should try not changing anything about the map. If, for example, you push over a barrel, and then place a gun on the lying barrel, things could get weird. When playing the map, the gun will be spawned by TTT in that position, but the barrel won’t be lying there. It will be in its original place. You have to act a bit like the world is in a frozen state. In fact, you could freeze physics entities to prevent making mistakes. Using noclip to get around is useful as well.
Placing weapons and ammo
Open the sandbox Spawn Menu, default is Q, and you should see a long list of tools on the right side. At the bottom, there should be a “TTT Weapon Placer” entry, if the addon was installed correctly. Select it and leave the spawn menu.
Now when you have the tool gun out and you press and hold the Context Menu key (default C), you should see a small menu with a list and some buttons. The list contains the different entities you can place, and we’ll get to the other options later.
Select one of the items in the list, such as deagle. Close the menu again and left click on the ground somewhere. You should see the weapon you selected appear there. The entity will spawn in a TTT game in that same spot. If you right click, ammo will spawn for the weapon you selected (if any fitting ammo exists).
You can move the items you have created using the physgun or other tools. You can also safely freeze the entities, it won’t affect the export. Item spawned there will just fall to the ground in TTT.
At this point, place some more weapons and ammo if you want. Some entities that could be useful are the random weapon and the random ammo. These will turn into a random gun and ammo box respectively. Place them like any other entity, but make sure there is some room around them. The gun/ammo it turns into might be larger than the dummy model you see.
Once you’ve placed all the weapons/ammo you want, you could just export your script and be done with it. For this guide however, we will look at placing player spawnpoints as well.
Placing player spawnpoints
The process is very similar to weapons and ammo. Just open the Context Menu, select the “player spawn” item from the list and click somewhere. A green guy should appear. You can move him around with the physgun, turn him so players spawned there face a certain way, etc.
There are some extra things to watch out for: There must be enough room around the spawn for a player to spawn there. The dummy entity helps you with that, because it will collide as if it is a big box of just the right size. So you can’t place two dummies over each other in a way that will cause telefrags. You should also make sure the dummy stands upright (freezing can be handy). I don’t really know what happens when it’s lying facedown, but it’s probably not good.
It’s a good idea to place player spawns such that there is a bunch of room around them, so the game can spawn extra players there if necessary. I also recommend you place plenty of spawns (32+), because it’s not a lot of effort and can help a lot with larger servers.
You can use the Report counts button to show a short report in your chat of how many of each broad category of entity you have placed, such as primary weapons, grenades, and player spawns. For a more detailed summary you can use the console command report_entities
and find the relevant entities in the list, such as “item_ammo_357” for Rifle ammo, to see the exact count.
In your Context Menu, you might notice the &Replace existing player spawnpoints* checkbox. When enabled, TTT will remove all existing spawnpoint entities before creating the ones you’ve placed. This lets you completely override the spawnpoints in the map. Sometimes this is useful, for example with CS:S maps that have boring spawns. Sometimes, it’s not needed, for example for maps that already have good spawn locations and only need a couple of extra ones. When the checkbox is unchecked, your spawnpoints will only be added, meaning the map will simply have extra spawn locations besides the ones the mapper made.
Exporting
The time-consuming part is over now, all you need to do to export is pressing the Export button. You should see a line in the chat like:
169 placements saved to /garrysmod/data/ttt/maps/de_dust_ttt.txt
In this example I placed 169 entities. You might have less. As you can see it has exported successfully to a text file. Keep in mind you are subject to Source’s entity limits like a mapper is. If you place a thousand shotguns, you will get errors when TTT loads the script.
If there is an existing file with the same name, you will be asked to either confirm the overwriting of it, or put in a different name.
Testing in TTT
Garry’s Mod only lets addons save files under the /garrysmod/data/
directory, so that’s where our exported weapon script can be found. Specifically, in /garrysmod/data/ttt/maps/
. In my case, there is a file called “de_dust_ttt.txt” there.
Copy the script to your /garrysmod/maps/
directory. TTT will look there for scripts with a “mapname_ttt.txt” filename when it loads the map and will try to import them. An alternate location TTT will check is /garrysmod/data_static/
, which is primarily useful if you want to include the rearm script in a Workshop addon.
In Garry’s Mod, select TTT as your active gamemode. Select your map, in my case de_dust, and start a game.
Once the map loads, TTT will go into “waiting for players” mode. Open the console and type the following commands:
ttt_debug_preventwin 1
ttt_minimum_players 1
The round will now start, and will not end. As soon as the round starts, all entities should spawn properly and you should spawn as a terrorist. Walk around and see if your weapons came out okay. In the console, you should see something similar to:
Weapon/ammo placement script found, attempting import...
Reading settings from script...
Removing existing player spawns
Removing existing weapons/ammo
Importing entities...
Spawned 169 weapon/ammo ents found in script.
Weapon placement script import successful!
In my case, all 169 entities were imported successfully. Using the command report_entities
, I can verify that there are 32 info_player_deathmatch entities (the imported version of the dummy player spawns), and all the weapon and item entities I placed are present.
Importing
When using the tool in sandbox mode, you may have noticed the Import button. You can use this to load an existing .txt from your /garrysmod/data/ttt/maps/
directory and create all the entities in that script. You can use this to modify someone else’s script, by removing or adding entities and exporting again.
Advanced: manual editing
It is possible to manually edit the exported text file, for example to easily change all smoke grenades to incendiary grenades. You can open the file with any text editor.
WARNING: do not save the script with any sort of “tabs to spaces” conversion enabled in the editor. The tabs are required for TTT to be able to parse the script. Plain and simple Notepad will never do bad things like this, so it’s a safe choice if you’re unsure.
An advanced use of editing is to add automatic ammo spawning to random weapons you have placed. The process is pretty straightforward. Find a random weapon line, like this one (note: this is shown with spaces for the example):
ttt_random_weapon -1107.0369 2109.9438 194.0788 1.843 132.992 -92.726
Go to the end of the line, press TAB (again, must be a “real” tab, not a bunch of spaces), and write “auto_ammo 2”. That 2 determines how many ammo boxes it should create, so make it 4 if you want four, etc. It should now look like this:
ttt_random_weapon -1107.0369 2109.9438 194.0788 1.843 132.992 -92.726 auto_ammo 2
Save the script, load up TTT, and that random weapon will now be spawned with two boxes of the right ammo.