Rearm scripts

This is a quick guide on how to use the TTT Weapon Placer tool to place weapon and ammo spawnpoints, appropriately referred to as "rearming", and then play the map with them in TTT. This is useful for making a map ready for balanced gameplay in TTT, when the map was not originally made for the gamemode.

In this guide I will show the basic process by placing some guns and stuff on de_dust. This is of course a CS:S map that does not have any TTT weapons, no ammo, and really boring player spawn locations by default (though TTT includes a rearm script for it). Let's see how we can change that.

UPDATE: since this guide was written, some things have changed. As a result you may have a problem where your own rearm script for a CS:S map (like de_dust) is ignored and the game always loads the one that is included with TTT. You can avoid this by moving/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 rearm script.

The guide may look a bit long, but there's a lot of details that are pretty common sense if you've used the GMod sandbox stuff before, so you can skim over those.

Setting up the tool

You can grab the 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.

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, so you can either use the Remover to do the same, 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.

Anyway, let's move on.

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 the Context Menu key (default C), you should see the  menu shown below. The list contains the different entities you can place, and we'll get to the other options later.
(Note: the menu has different colors these days because the screenshots are a little old, but everything still works the same)

For now, just select the deagle as shown on the screenshot. Close the context menu (ie. let go of C) and left click on the ground. You should see the deagle appear there. Now right click once or twice, and deagle ammo will pop up.

Some guns/entities do not have a matching ammo entity, and right click will do nothing for those.

Entities you've placed can be repositioned using the physgun or other tools:

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.

You can safely freeze the entities, it won't affect the export. Ammo spawned there will just fall to the ground in TTT.

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, I'm going to place player spawnpoints as well.

Placing player spawnpoints

The process is very similar to weapons and ammo. Just 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.

I went nuts and placed 32 spawnpoints. Most of them have a bunch of room around them so the game can spawn more players there if necessary. I recommend you put a lot of spawns in, 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 one's you've placed. This lets you completely override the spawnpoints in the map. Sometimes, this is good, for example with CS:S maps that have boring spawns. Sometimes, it's not needed, for example for Zombie Master maps that already have good spawns and only need a couple of extra ones. When the checkbox is unchecked, your spawnpoints will just be added, meaning the map will simply have extra spawn locations besides the ones the mapper made.


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
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.

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

(You may want to put these in a text file called "listenserver.cfg" in /garrysmod/cfg/ so you don't have to type them every time).

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 there.


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.

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 "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:

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.