Trouble in Terrorist Town Garry's Mod 10 (Fretta) gamemode By Bad King Urgrain http://ttt.badking.net/ *** Description: Disaster strikes in the Terrorist team! These plucky bomb-planting fighters have traitors in their midst who are looking to kill them all! But who are the traitors... and who will come out of this alive? *** Fretta notes: TTT is Fretta-compatible, which in this case means players get the chance to vote in order to switch to a different Fretta gamemode. If you run a server with only TTT on it, you can disable the voting by putting: fretta_voting 0 In your server.cfg file. This will pretty much make TTT act like a non-Fretta gamemode. Note that it will also automatically switch maps according to the mapcycle.txt, so you should make sure you have one. A Fretta server does not have a mapcycle.txt for specific gamemodes, so TTT will not automatically switch the map as long as that is enabled. You can manually enable it even when Fretta is on using ttt_always_use_mapcycle. *** Installation: If you're looking at a version of TTT included in gmod, you're already done! If you're dealing with a .zip version, extract .zip contents into: X:\Steam\steamapps\your@account\garrysmod\garrysmod\ Or for a dedicated server: X:\srcds\orangebox\garrysmod\ So that you get a \garrysmod\gamemodes\terrortown\ directory. Installing is never necessary if you only want to play on servers. *** Dedicated server (srcds) preparation: The gamemode _requires_ CS:S content to be installed. The Garry's Mod wiki has some information on this (and other srcds setup procedures) here: http://wiki.garrysmod.com/?title=Dedicated_Server_Setup#Extra_content If you want TTT to automatically switch maps every few rounds, place a mapcycle.txt in the \garrysmod\ directory. It should contain a list of map names, exactly like the mapcycle.txt in Source games like CS:S or HL2DM. If you don't know what maps to use, just put in a list of the CS:S maps, all of them work. Once you have a mapcycle file, either disable fretta_voting or enable ttt_always_use_mapcycle in your server.cfg to enable map cycling. See ttt_round_limit and such in the convar section below for more configuration. A common problem is strange issues with floating grenades, floating weapons, and instant reloading. These are all caused by the server not having CS:S content installed. If the issues persist despite making sure the CS:S content is there, try moving the "cstrike" directory into the "orangebox" one, so you get \servername\orangebox\cstrike\. You'll also want to turn off sv_alltalk if it's on. It will override TTT's voice handling, and let dead people talk to living players during a round (bad). Note that you should enable GMod's ScriptEnforcer functionality. Without it, cheating will be very easy. All you should need to do is set sv_scriptenforcer to 1. For sv_downloadurl/FastDL, the gamemode files will also have to be on the download server. This includes an up-to-date version of the Lua cache in \garrysmod\cache\. You may also have to move the stuff in: \garrysmod\gamemodes\terrortown\contents\ .. into the main \garrysmod\ directory of the download server. In practice, players probably don't need to download those files though, because their gmod will include them. *** Modding the gamemode: You should feel free to modify the gamemode in any way you want. An easy way of customizing TTT is creating your own weapons. You can add your own scripted weapons without touching the TTT code, so you won't have to deal too much with code changes from TTT updates. To get started with custom weapons, check the GMod wiki about SWEPs, and then take a look at some of the standard TTT weapons that you can find in: \gamemodes\terrortown\entities\weapons\ The script for weapon_tttbase has a bunch of documentation you might find useful. There is a guide available at http://ttt.badking.net/ **** Hooks: TTT has a couple of hooks relating to its round structure: - TTTPrepareRound - TTTBeginRound - TTTEndRound - TTTDelayRoundStartForVote The first three are called on both server and client when the round changes as you'd expect. You could use them in a server plugin to play victory music or something with TTTEndRound, stuff like that. Use hook.Add as you would with a GMod hook, for example: -- if you are hooking in a clientside script, you could do this function MyClientHook() LocalPlayer():ChatPrint("The round is over! I'm in a hook!") surface.PlaySound(mysweetsound) end hook.Add("TTTEndRound", "MyUniqueClientHookName", MyClientHook) -- if you are hooking in a serverside script, it's only server stuff function MyServerHook() GameMsg("I'm the server and I say it's the end of the round") end hook.Add("TTTEndRound", "MyUniqueServerHookName", MyServerHook) The fourth hook, TTTDelayRoundStartForVote, can be used in a voting system. The game calls it when starting a new round, and delays that round by 30 seconds if the hook returns true. It is normally used for Fretta gamemode votes, but can be used for other voting on a TTT-only server. There's also a hook for scoreboard name colors: - TTTScoreboardColorForPlayer It's clientside, and you could use it as follows. Put the below in a text file in \garrysmod\lua\autorun\ on the server, called scoreboardcolors.lua: if SERVER then -- when the server loads this script, tell it to send it to clients AddCSLuaFile("scoreboardcolors.lua") else -- when a client runs it, add the hook function MySBColors(ply) if ply:SteamID() == "PUT A STEAMID HERE" then return Color(255, 0, 255) end end hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors) end Edit in a SteamID to test with, of course. Adding more players and changing colors should be easy from there. *** Convars: (Scroll down for concommands) Something you should know to understand these settings: A round in TTT has the following phases: Preparation phase -> [1] -> Round is happening -> [2] -> Post-round phase. During the preparation phase players cannot hurt each other or destroy explosive props. It's a ceasefire situation while everyone gets a chance to spread out and gather items. At [1], the traitors are picked, and newly connected players will spawn as spectator. After this point the game is on, you could say. It keeps going until at [2] a victory condition happens: either the traitors win, or the innocents win, or the timelimit is reached. Then a moment of contemplation and review occurs in the form of the post-round phase. **** Round structure convars: ttt_roundtime_minutes (def. 10): The time limit for each round, given in minutes. ttt_preptime_seconds (def. 30): The length of the preparation phase that occurs after players spawn in and before traitors are selected and a new round begins. Specified in seconds. ttt_posttime_seconds (def. 30): The length of time after a round has ended before the next cycle of begins. The round report is displayed at the start of this phase. During this phase, stats/points are no longer tracked. Specified in seconds again. ttt_round_limit (def. 6): The max number of rounds until the map is switched (needs a mapcycle.txt, and either fretta_voting 0 or ttt_always_use_mapcycle 1). ttt_time_limit_minutes (def. 75): The max number of minutes until the map is switched (needs mapcycle.txt, see above) ttt_firstpreptime (def. 60): The length of the preparation phase for ONLY the first round after a map loads. It is useful to make this higher than ttt_preptime_seconds so that players do not have to sit out a round just because they loaded slightly too slowly. ttt_haste (def. 1): Enables Haste Mode. In Haste Mode, the initial round time is short. Every death increases it by some amount. Puts pressure on traitors to keep things moving, which is more interesting for the innocent players. See below. ttt_haste_starting_minutes (def. 5): Replaces ttt_roundtime_minutes when Haste Mode is on. Sets the initial time limit. (Haste Mode only) ttt_haste_minutes_per_death (def. 0.5): Specifies the number of minutes that is added to the round time for each death. Setting this to 0.5 will result in 0.5 * 60 = 30 seconds being added. (Haste Mode only) ttt_always_use_mapcycle (def. 0): Enables the use of your mapcycle.txt even if Fretta is enabled (via fretta_voting). Has no effect if you disable fretta_voting, because then the mapcycle is always used. ttt_spawn_wave_interval (def. 0): If 0, spawns all players at once, and will attempt to rig extra spawnpoints if there are not enough. Can result in players spawning in walls. If larger than 0, spawns players in waves, where each wave spawns as many players as there are spawnpoints. The time between each wave is the value of the convar in seconds, so setting it to 5 will mean waves are 5 seconds apart. Spawn waves are probably the best method for large servers. IMPORTANT: make sure your ttt_preptime_seconds is large enough to fit all waves in it. Odd behaviour can occur if that is not the case. This spawn method is not widely used and is therefore not as well tested as the standard method. **** Gameplay convars: ttt_sherlock_mode (def. 1): Enables a large set of gameplay elements that make the game more detective-like. Most importantly, when a player dies this is no longer immediately visible on the scoreboard. Rather, his body has to be found to confirm his death. ttt_traitor_pct (def. 0.25): Percentage of total players that will be a traitor. The number of players will be multiplied by this number, and then rounded down. If the result is less than 1 or more than the player count, it is clamped to those values. ttt_traitor_max (def. 32): Maximum number of traitors. Customize this if you want to finetune the number of traitors at your server's max playercount, for example to make sure there are max 3 traitors on a 16 player server. By default there is basically no max. ttt_detective_pct (def. 0.13): Percentage of total players that will be a detective (detective innocent). Handled similar to traitor_pct (rounded down etc). ttt_detective_max (def. 32): Maximum number of detectives. Can be used to cap or disable detectives. ttt_detective_min_players (def. 10): Minimum number of players before detectives enter play. At lower playercounts it will be purely normal innocents vs traitors, at higher ones some innocents will be detective. ttt_detective_min_karma (def. 600): If a player's Karma falls below this point, his chances of being selected as detective are reduced. ttt_minimum_players (def. 2): Number of players that must be present before the round begins. This is checked before the preparation phase starts, and before the actual round begins. ttt_postround_dm (def. 0): Enables damage after a round has ended. Kills are not recorded for scoring purposes, so it's a free for all. ttt_dyingshot (def. 0): Experimental. Enables a feature that causes a player who is using his ironsights and is killed (by a gun, and not a headshot) to fire an inaccurate dying shot. ttt_no_nade_throw_during_prep (def. 0): Prevents the throwing of grenades during the preparation phase. ttt_weapon_carrying (def. 1): Enables the carrying of weapons with the Magneto-stick. If you are experiencing crashes, try disabling this. When the pickup range is short, as it is by default, crashes seem very rare. ttt_weapon_carrying_range (def. 50): Range at which weapons can be picked up for carrying with the Magneto-stick, see ttt_weapon_carrying. ttt_killer_dna_range (def. 550): Maximum range within which a DNA sample of the killer is planted on the corpse of the victim. ttt_killer_dna_basetime (def. 100): Killer's DNA samples time out depending on how near he was to the victim. After that time has passed, the sample cannot be gathered anymore. This cvar sets the time in seconds when the killer was 0 units away. The time is lower when the range was higher, via a falloff curve. Note that due to the shape of the curve the time can sink below 0 even if the killer is within range according to the ttt_killer_dna_range convar, if the basetime is too low. **** Karma convars: ttt_karma (def. 0): Enables the karma system. Players start with a certain amount of karma, and lose it when they damage/kill "teammates" (ie. innocent if they're innocent, traitor if traitor). The amount you lose is dependent on the karma of the person you hurt or killed. Lowered karma results in a damage penalty. The loss is exponential-ish, so going from 1000->900 only reduces your damage by a percent or two, whereas a karma of 600 or so will halve your damage. Besides the damage penalty, other players will have less incentive to hold their fire if you have terrible karma, because it will not cost them as much karma to kill you. The penalty is based on the victim's karma, after all. So kill a clean player and you will get penalised a lot, but kill an overly aggressive trigger-happy player or a griefer and your penalty will be much smaller. The damage penalty is computed at the start of the round. The karma at that time is the base karma, it's shown on the scoreboard and players have a karma status description like "Reputable" when you target them. During a round, as people kill each other, karma is adjusted as that happens, but players cannot see the "live" value (because it would betray who is innocent). The "live" karma is used in the penalty computations, so if you see a guy kill 5 others, you can kill him knowing he is either a traitor or his karma will be low. See the other karma convars for more details. ttt_karma_starting (def. 1000): Karma players start out with. If you want players to be able to "earn" a damage bonus, you could set this to 850 or so. Playing clean rounds will let them increase it to a 1000 and do a few percent more damage than a new player. ttt_karma_max (def. 1000): Maximum karma a player can have. Note that increasing it above 1000 does not mean players with 1100 karma will get a damage bonus. It would just give them a "buffer" before they get a damage penalty. ttt_karma_ratio (def. 0.001): The ratio of the damage that is used to compute how much of the victim's karma is subtracted from the attacker's. You can make penalties larger by slightly(!) increasing this, to eg. 0.0015, or smaller by reducing it. ttt_karma_kill_penalty (def. 15): All karma penalties are based on damage dealt. The kill penalty is just an extra amount of "damage" dealt when you kill someone. So if this was 100, and you headshot someone with a rifle, it would penalise you as if you dealt 200 damage. ttt_karma_round_increment (def. 5): The base amount by which everyone's karma is "healed" at the end of every round. ttt_karma_clean_bonus (def. 20): If a player has not hurt or killed a teammate this round, he will be "healed" an extra 20 karma (for a total of 25, under default settings). So if you have bad karma it is rewarding to lie low. ttt_karma_traitordmg_ratio (def. 0.0003): Like ttt_karma_ratio, but for the karma reward for damaging a traitor. By default damaging a traitor is rewarded roughly 1/4th of the penalty you'd get if it were a full-karma innocent. ttt_karma_traitorkill_bonus (def. 40): Bonus karma for killing a traitor. Scaled by the traitordmg_ratio. ttt_karma_low_autokick (def. 1): Automatically kick players who get a low karma level at the end of a round. ttt_karma_low_amount (def. 400): The karma threshold at which players get kicked. ttt_karma_low_ban (def. 1): When autokicking, also ban players if this is enabled. No effect if autokick is off. ttt_karma_low_ban_minutes (def. 60): Minutes to ban players, 0 should be perma. Of course has no effect if banning is off. ttt_karma_debugspam (def. 0): Enables debug output to console about karma changes. **** Map-related convars: ttt_use_weapon_spawn_scripts (def. 1): Toggles whether weapon scripts will be used. These .txt files in the /maps/ folder can be used to override or add weapon, ammo and player spawnpoints in a map. This is very useful for CS:S or HL2DM maps. **** Traitor equipment credits convars: ttt_credits_starting (def. 1): Number of credits traitors start with. Traitors can spend credits on special equipment. ttt_credits_award_pct (def. 0.35): When this percentage of the innocent players are dead, traitors are awarded more credits. ttt_credits_award_size (def. 1): The number of credits awarded. ttt_credits_award_repeat (def. 1): Whether the credit award is handed out multiple times. if for example you set the percentage to 0.25, and enable this, traitors will be awarded credits at 25% killed, 50% killed, and 75% killed. ttt_credits_detectivekill (def. 1): Number of credits a traitor receives when he kills a detective (detective) player. **** Detective equipment credits convars: ttt_det_credits_starting (def. 1): Number of credits detective players start with. ttt_det_credits_traitorkill (def. 0): Number of credits detectives receive when they kill a traitor. ttt_det_credits_traitordead (def. 1): Number of credits detectives receive when a traitor dies, no matter what killed him. **** Prop possession convars: ttt_spec_prop_control (def. 1): Toggle whether spectators can possess props. ttt_spec_prop_base (def. 8): Number of prop punches in a filled punch-o-meter with no score modifier. ttt_spec_prop_maxpenalty (def. -6): Maximum decrease of the punch-o-meter limit for a negative score. ttt_spec_prop_maxbonus (def. 16): Maximum increase of the punch-o-meter limit for a positive score. ttt_spec_prop_force (def. 110): Amount of force by which each punch moves the prop. ttt_spec_prop_rechargetime (def. 1): Number of seconds for one point in the punch-o-meter to recharge. **** Misc. convars: ttt_detective_hats (def. 1): Disable to make detectives not get their special hat. ttt_ragdoll_collide (def. 0): By default ragdolls will not collide with other ragdolls and some small physics objects (or doors set not to collide with debris). Enabling ragdoll collision will change that. Earlier versions of TTT had ragdoll collision, but this allowed griefers to create situations where ragdolls were physics-glitched to constantly collide, causing serious lag. Some maps may expect ragdolls to collide though. Use with care. ttt_bots_are_spectators (def. 0): Bots are spawned as spectators and will never be traitor. Useful for sourceTV. ttt_debug_preventwin (def. 0, ie. disabled): Prevents the round from ending, useful for testing on your own, but little else. ttt_idle_limit (def. 180): Time in seconds a player is allowed to be idle after a round has started before he is moved to spectator. ttt_locational_voice (def. 0): Toggles locational 3D voicechat sound for living players. ttt_namechange_kick (def. 1): Check for name changes during an active round, and kick players who did one. ttt_namechange_bantime (def. 10): Time in minutes to ban players who changed their name. Set to 0 to disable. *** Concommands: **** Admin commands: ttt_roundrestart: Triggers the round to restart, will go immediately to a new round in the form of a new preparation phase. Requires GMod admin/superadmin status, or sv_cheats enabled. ttt_print_traitors: Prints who are the traitors. Requires admin status, or RCON. ttt_print_adminreport: Prints who killed who. Requires admin status/RCON. ttt_print_usergroups: Prints everyone's usergroup, for debugging gmod admin status. ttt_print_damagelog: First enable the convar ttt_log_damage_for_console (set to 1) to enable damage logging. Then use this command to print out the log of the current round. Note that this is a lot of data. ttt_highlight_admins: Set to 0 to make admins not appear gold/yellow on the scoreboard. **** General commands: ttt_version: Prints current version number. ttt_dropweapon: Will drop your current weapon. By default the key that would open the GMod spawn menu (default: Q) instead performs this action. You can manually bind it to other keys using this concommand. ttt_equipswitch: Switches to slot 7 (your equipment weapon) if you have one. If you have that weapon out, it will instead switch to your previous weapon. So you can quickly toggle to your equipment and back. By default the noclip key (default: V) will perform this command if sv_cheats is off (else it will noclip you). ttt_quickslot : Switches to the given weapon slot without having to use the scroll menu. ttt_toggle_disguise: Toggles your Disguiser equipment if you have bought it as Traitor. Default key is Numpad Enter, this command can be used to rebind it. ttt_spectate: Moves you onto the spectator team. You will not spawn as Terrorist until you use "ttt_spectate 0" to turn this off again. Recommended you use the checkbox in the settings menu under F1 instead. **** Debug/cheat commands: ttt_force_terror: Forces you to spawn as a Terrorist. Cheat. ttt_force_traitor: Forces your role to traitor. Cheat. ttt_force_detective: Forces your role to detective. Cheat. ttt_cheat_credits: Gives you many equipment credits. Cheat. *** Credits: Bad King Urgrain made this in 2009/2010. Weapon/ammo/player spawn placement scripts included in TTT (such as those for the CS:S maps) were contributed by the following people: Ajunk Broadsword eeny JossiRossi that guy worbat