Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 11:12:31 PM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Making your own rearm (spawnpoint) scripts
Pages: [1]
Author Topic: Making your own rearm (spawnpoint) scripts  (Read 8365 times)
Bad King Urgrain
Administrator
*****
Posts: 12276



« on: December 20, 2009, 10:25:46 AM »

NOTE: this is an old version of this guide. Find the most up-to-date one here:
http://ttt.badking.net/rearm-guide


This is a quick guide on how to use the GMod Sandbox STOOL (scripted tool thing) to place spawnpoints and then play with them in TTT. This is useful for making a map ready for balanced gameplay in TTT, when the map was not 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 weapons, no ammo, and really boring player spawn locations. Let's change that.

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.

Here we go:




Setting up TTT
First thing you'll want to do is installing the latest version of TTT in your GMod. The process is simple: download the .zip and extract it into \garrysmod\garrysmod\gamemodes\, so you end up with a \gamemodes\terrortown\ directory. Make sure you don't put it in the \addons\ or \lua\ directories even though they sound like good places.

You can find the newest version in the newest post in the release thread.

Make sure you are using v201209b or newer, because earlier versions had issues with exporting.




Setting up the tool
In the \terrortown\ directory that was just created, there will be an \addons\ subdirectory. There's a short readme file there, and a \tttweapons\ dir. Copy that "tttweapons" directory, and go back to your \garrysmod\ directory. From there, go into \garrysmod\addons\, and paste. You should now have a \garrysmod\addons\tttweapons\ directory.




Getting started
Start up GMod. Open the new singleplayer 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.

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. 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 I believe, 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 a menu like this. The list contains the different entities you can place, and we'll get to the other options later.

For now, just select an ammo type as shown on the screenshot. Close the context menu (ie. let go of C) and click on the ground a few times. You should see ammo boxes appear like this.

[EDIT: since I wrote this the tool menu has changed a bit, though the basic process is the same. The biggest difference is that you spawn ammo by selecting the matching weapon and right clicking.]

Open the context menu again, and select the appropriate weapon for the ammo. In my case, as you can see in the screenshot, that was the revolver/deagle. Again, just click somewhere to spawn the weapon.

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

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 "ttt_playerspawn" entity 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. 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 console command report_entities to get a list of all the entities in the map and how many of each there are. Look for "ttt_playerspawn" in that list, and you have an easy count of how many spawnpoints you've placed so far. You can do the same for weapons and ammo.

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 ZM maps that already have good spawns. 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.

If you're a mapper, you might wonder about the name "ttt_playerspawn". This is an entity that does not exist in TTT. When importing, that name will be converted to info_player_deathmatch. The reason we need the fake entity is because info_player_deathmatch also exists in sandbox (unlike the weapons) which causes issues.




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


I went nuts and placed 169 entities. You might have less. As you can see it has exported successfully to a text file. We can now test it in TTT.

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.

Assuming you have TTT installed correctly, you should see "terrortown" in the list of gamemodes in the new game menu. Select your map, in my case de_dust, and select terrortown as base gamemode (leave "override" empty).

Once the map loads, it 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 ttt_playerspawn), and all the weapon and item entities I placed.




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.




Manual editing
It is possible to manually edit the exported textfile, for example to easily change all smoke grenades to fire 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 this, so it's a safe choice if you're unsure.

An advanced use 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.




If you run into issues, or I've forgotten to explain something, drop a post here.
« Last Edit: January 04, 2010, 08:33:55 PM by Bad King Urgrain »
that guy
Build Tester
*
Posts: 1190



« Reply #1 on: December 20, 2009, 11:04:25 PM »

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

Kay, I'm on this part, I copied the .txt file to my maps directory but the map wont show up when I make a single player game.
EDIT: I got it.
« Last Edit: December 20, 2009, 11:36:58 PM by that guy »

I want to know who was the first person to rub barrels, must of been an epic moment like discovering fire or your sisters vibrator.
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #2 on: December 20, 2009, 11:33:25 PM »

How do you mean? If you loaded it for the sandbox game, then the map should just be in the list in that same place. The only thing that's different is the gamemode selection, which would be terrortown rather than sandbox.
that guy
Build Tester
*
Posts: 1190



« Reply #3 on: December 20, 2009, 11:37:50 PM »

Nvm I thought there would be a whole new map I didnt know it would be just de_dust2.

I want to know who was the first person to rub barrels, must of been an epic moment like discovering fire or your sisters vibrator.
that guy
Build Tester
*
Posts: 1190



« Reply #4 on: December 21, 2009, 02:47:34 AM »

I cant really tell if this is a bug or not but on two of my maps im working on I have everything finished but when I try to test it using the terrortown gamemode all of the weapons just get scattered evrywere it's really weird.
Theres also a blue error in console:
Weaponless CS:S-like map detected. Placing extra guns.
EDIT: It's all good now
« Last Edit: December 21, 2009, 02:56:01 AM by that guy »

I want to know who was the first person to rub barrels, must of been an epic moment like discovering fire or your sisters vibrator.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Making your own rearm (spawnpoint) scripts « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.011 seconds with 17 queries.