Garry's Mod

Garry's Mod

Not enough ratings
[TTT2] Defective [ROLE]
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Server content
Addon Tags: Fun, Roleplay
File Size
Posted
Updated
1.822 MB
8 Oct, 2020 @ 2:01am
23 Mar @ 1:21am
22 Change Notes ( view )

Subscribe to download
[TTT2] Defective [ROLE]

In 1 collection by blackmagicfine
TTT2 Mods For BMF's Server
95 items
Description
It cost us significant capital, but we finally did it. We turned a detective into a no good rotten traitor.

You have to use TTT2 in order to use this role. Additionally using ULX for TTT2 is recommended. Report bugs concerning this role here[github.com] and submit new role ideas here[github.com]. A list of all currently available roles can be found here.

Discord: https://discord.gg/Npcbb4W
Source: https://github.com/AaronMcKenney/ttt2-role_def




Visually and functionally, the defective operates similarly to a regular detective. They use the detective's shop, have a DNA scanner, and look like a detective to those not on their team. However, they are a traitor: They take up a traitor's spot and a traitor test will reveal them as such.

Plays best with:




Convars are variables that are introduced to allow server owners to customize the gameplay without changing the code. There are always a handful of convars automatically created by TTT2, that define the spawn parameters of this role and are found in ULX. Additionally there might be some role specific convars, which have to be set in the server config file.

Normal Role Convars (also found in ULX):
# enable or disable this role ttt_defective_enabled [0/1] (default: 1) # the percentage of players that are spawned as this role ttt_defective_pct [0.0..1.0] (default: 0.13) # the limit of players that spawn as this role each round, this overwrites the percentage ttt_defective_max [0..n] (default: 1) # the probability each round of this role being spawned at all ttt_defective_random [0..100] (default: 30) # the amount of players needed for this role to spawn ttt_defective_min_players: [0..n] (default: 10)

Rolespecific Convars:
# Send a popup message if there's a defective and detective at the start of the round? ttt2_defective_inform_everyone [0/1] (default: 1) # What is the Defective's role color? ttt2_defective_color_mode [0..1] (default: 0) # 0: Default color (purple) # 1: Traitor color (a shade of red) # Prevent the detective from purchasing items that aren't in the defective's shop? # You can create your own custom shop for the defective via the "shopeditor" command. # You can use this as a way to prevent the detective from purchasing a portable tester, golden deagle, etc. when a defective is active. # Do not enable if ttt2_random_team_shops is enabled (may prevent dets from purchasing most things at random). ttt2_defective_shop_order_prevention [0/1] (default: 0) # Prevent all defectives and detectives from harming one another (unless all other members on their teams are dead)? ttt2_defective_detective_immunity [0/1] (default: 1) # Can the defective see their fellow team mates (e.g. traitors, bodyguards, etc.)? ttt2_defective_can_see_traitors [0/1] (default: 1) # Are traitors informed about who the defective is? ttt2_defective_can_be_seen_by_traitors [0/1] (default: 1) # Can the defective see their fellow defectives? ttt2_defective_can_see_defectives [0/1] (default: 1) # When should def's true role be revealed? ttt2_defective_corpse_reveal_mode [0..3] (default: 0) # 0: Search never reveals def's role # 1: Search reveals def's role when all dets and defs are dead # 2: Search reveals def's role when all defs are dead # 3: Search reveals def's role # How should special detectives (ex. Sheriff, Vigilante, Sniffer) be handled when the defective is in play? ttt2_defective_special_det_handling_mode [0..3] (default: 1) # 0: Do not alter special dets # 1: Force all special dets to be normal dets # 2: Force all special dets to be normal dets, but give them back their roles if: all defs are dead, defs can be revealed, and the former special det didn't undergo a role change (ex. did not become infected) # 3: Do not alter special dets. The Defective has a chance to take the visage of a special det, but will not have any of their abilities. # If there are no detectives at the beginning of the round, should any player with this role be forced into a generic Traitor role? ttt2_defective_disable_spawn_if_no_detective [0/1] (default: 1) # The chance that at the beginning of the round a detective will be "demoted" into an innocent for every defective. Note: ttt2_defective_inform_everyone won't activate if all detectives have been demoted. Note: ttt2_defective_disable_spawn_if_no_detective takes priority over this ConVar. ttt2_defective_demote_detective_pct [0.0..n.m] (default: 0.0)

--
Credits:
BlackMagicFine: creator of this role addon
Smuggles: designer of the role icon
Mineotopia: designer of the role thumbnail
berry, Creyox[github.com], sbzlzh[github.com]: translators
65 Comments
Sl0ter 2 May @ 4:33am 
strange is that the same model has the detectiv hat but not as defective:
i will try something. one by one adding a workshop until it does not work anymore
blackmagicfine  [author] 2 May @ 12:42am 
@Sl0ter: What part of this is strange? The default playermodel is "css_phoenix", which is the guy with the ski mask. Bots generally spawn with this player model (via the "bot" command). So you can spawn a bot and change their role to Detective/Defective for verification on your end.

If that playermodel doesn't show up wearing a hat, it could be an issue with some addon you've gotten from the workshop. I think it's unlikely to be an issue with the Defective itself, but I've been wrong in the past on these sorts of things.

A bit of history: The reason not all playermodels can wear the hat is because a lot of the custom ones deviate too much from the standard model. Most of them don't even have head hitboxes, even if they do have "heads" (TTT2 can show you which ones do and don't in the F1 menu under playermodels). If you want a playermodel to be hattable, it can be done, but I forget if it's something the admin has to force or if the playmodel's creator has to make that change.
Sl0ter 1 May @ 9:00am 
@blackmagicfine
that's strange.
blackmagicfine  [author] 26 Apr @ 10:15pm 
@Sl0ter: The defective is supposed to wear the detective hat, yes. However, most custom playermodels do not support the wearing of detective hats in general. I just verified that the logic is still working for me (support for detective hats was added several years ago).
Sl0ter 26 Apr @ 1:55am 
should the detective hat work as defective?
the detective has a hat but the defective doesn't.
if the role is reversed it's the same.
ramley 27 Mar @ 11:08am 
I see. Understandable
Thanks anyway!
blackmagicfine  [author] 27 Mar @ 10:54am 
I see. Yeah I don't think there's an easy way to do this without introducing some hacky code that'll inevitably run into weird edge cases. In general though, the idea of having a role be worth two traitor slots is kind of interesting, but this would require a change in the TTT2 source code, rather than something I introduce here.
ramley 27 Mar @ 1:48am 
The thought process is trying to make it so a defective basically takes up two traitors
eg. two defectives = 4 traitors, one defective = two traitors
i think it'd be capable of stirring more chaos is all
if it's not possible though that's perfectly fine
blackmagicfine  [author] 27 Mar @ 1:25am 
@ramley: The short answer is that the settings can't easily force there to be a specific number of players with a given role, or in general change the role selection process while roles are being selected (Even the Anonymous role I made has a bit of a hack to workaround this). It would essentially involve changing player roles right after the round started and hope that no one notices.

But what is the use case for this behavior? Are you trying to make it so that, for example, there's only two Traitors when a Defective is chosen (and both of those Traitors would be Defectives)?
ramley 27 Mar @ 1:08am 
It works, thanks
One more thing, though, is there a way to make it so defective can change the number of traitors when it spawns, or is that out of the scope of what the settings can do?