Skip to content

Hammer Mapping Reference

Sam edited this page Aug 25, 2021 · 1 revision

Mapping for TTT:Reborn

To create a map for TTT:Reborn, you have to use the 'Hammer' editor built into S&box, which can be opened by launching the sbox-dev.exe located in the root installation directory of S&box then pressing the hammer icon within the navigation bar. For those coming from Source 1/Garry's Mod, Source 2 Hammer feels very similar to the old hammer, but has some major differences. For more information on mapping within Source 2 check out the S&box Wiki Page for it, or the Half Life: Alyx Workshop tools page.

Map requirements for TTT:Reborn are relatively simple, only requiring spawn points for players, weapons and ammo. It's best practice to built your map for the amount of players playing it, most TTT servers tend to average between 12 to 24 players. You want to make sure you have enough weapons and ammo for every player to be able to find one, as well as allow players to swap weapons if they prefer a better one. Spawn points are created by placing info_player_start entities within your map. Once you have some geometry created and spawns place, you can place ttt_ammo_random and ttt_weapon_random entities around the world to spawn random weapons at the start of the round, if you prefer to manually place weapons/ammo, you can select those specific entities within Hammer and place them.

Entities

TTT:Reborn has a handful of custom entities that can be placed and used for a variety of purposes, if you've experimented with mapping in Garry's Mod TTT, you might recognize some of these entities.

ttt_map_settings

In future updates, this entity will allow maps to control certain relevant behavior, such as the opening of doors on certain weapon inputs. As it stands currently, this entity is only used as a way of exposing the current game round to the map. This entity has 4 Outputs, SettingsSpawned which is ran when the TTT:Reborn gamemode loads entities post-map loading. Then 3 Outputs for round handling: RoundPreparation, RoundStart and RoundEnd. Currently, none of these outputs passes any parameters.

ttt_force_win

This entity allows the map to force a specific team to win which can allow for the creation of innocent objectives.

Property Description
string Team Name of team that will win when ForceWin() is fired.
bool UseActivatorsTeam Overrides Team value and selects the Activator's team when ForceWin() is fired.
[Input] ForceWin Finds a registered team with a matching name to the Team property and forces that team to win.
[Input] InnocentsWin Built-in and easy innocents win input.
[Input] TraitorsWin Built-in and easy traitors win input.
If you are not creating a map with support for a specially named team, use the InnocentsWin() and TraitorsWin() inputs instead.

ttt_credit_adjust

Allows for modification of the credit count of a credit-baring role. Works identically to the original Garry's Mod TTT credit adjust entity.

Property Description
int Credits Amount of credits to remove.
[Input] ExchangeCredits Exchanges Credits amount with Activator.
[Output] OnSuccess Fires if Credits amount can be added or removed successfully.
[Output] OnFailure Fires if Credits amount cannot be added or removed successfully, such as trying to remove credits a player does not have.

ttt_feed_entry

TTT:Reborn equivalent to Garry's Mod TTT's ttt_game_text. Allows for map to submit messages into the text feed located in the top right of the player's UI.

Property Description
string Message Message to display.
string Receiver Receiving group, choices† are Activator, All, Innocents, Traitors.
Color Color Fires if Credits amount can be added or removed successfully.
[Input] DisplayMessage Fires if Credits amount cannot be added or removed successfully, such as trying to remove credits a player does not have.

† Note: If passing a value different from the four provided, TTT:Reborn will attempt to look for a Team with that name, if one can be found, it will be displayed to them, if none can be found, it will throw a warning in console.

ttt_logic_assigned

This entity allows for checking against the assigned role or team of the activator, which can be used for things like traitor testers. For example, in setting up a traitor tester, you can create a trigger_multiple within the interior of your tester and set it to Start Disabled, then use a button to Enable the trigger for a few seconds, then disable it again. The trigger can use an OnTrigger output to call Activate on the ttt_logic_assigned entity, which would then return your check result then you can utilize the Hammer IO system to represent the result in your map (such as with a light). There will be an example posted soon. (Preferably before this goes up within a github wiki of some sorts)

Property Description
Check CheckType Type of check to make, can either be Role or Team.
string CheckValue Value to check against, such as Traitor(role) or Innocents(team).
[Input] Activate Triggers the entity to check the Activator's CheckType against CheckValue.
[Output] OnPass Fires after Activate if the Activator's CheckType is equal to the CheckValue. This would call if an Activator had the 'Traitor' role and CheckValue was equal to Traitor.
[Output] OnFail Fires after Activate if the Activator's CheckType is no equal. If we were checking for the Traitor role and an Innocent is the Activator, this would fire.

ttt_role_button

The role button is similar to the traitor button in Garry's Mod TTT, rather than being strictly limited to Traitors, this can be expanded to other roles such as Detective or custom roles.

Property Description
string Role Role that can see this button, defaults to Traitor.
string Description Text within the UI that describes the function of this button.
int Range Range in Hammer Units that the button can be pressed.
int Delay Delay in seconds that button will be unusable after pressing.
bool RemoveOnPress If true, will remove the button immediately after pressing it. Set to false by default.
bool Locked If true, will not display the button until unlocked. Set to false by default
[Input] Lock Hides button and disables use if unlocked
[Input] Unlock Shows button and enables use if locked
[Input] Toggle Flips lock state
[Input] Press Not recommended to use, but useful for testing. Allows Hammer IO to force a button press. Requires the player to invoke this if you want the activator parameter to function.
[Output] Pressed Fires when button has been pressed.