Garry's Mod

Garry's Mod

Not enough ratings
[TTT2] Defective [ROLE]
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: ServerContent
Addon Tags: Fun, Roleplay
File Size
Posted
Updated
1.820 MB
8 Oct, 2020 @ 2:01am
27 Mar @ 2:06am
21 Change Notes ( view )

Subscribe to download
[TTT2] Defective [ROLE]

In 1 collection by blackmagicfine
TTT2 Mods For BMF's Server
93 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) # 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
48 Comments
Musp 28 Mar @ 7:39pm 
seems to be working now, thanks for fixing it :)
blackmagicfine  [author] 27 Mar @ 2:08am 
@Musp: Thanks for providing this information! I think I rootcaused the bug. The short of it is that the logic for handling the rare Defective + Spy combination is pretty convoluted. There's a lot of logic that has the Spy's handling take priority over the Defective's. However, for body confirmation it seems like I missed a spot. It should be fixed now, but please check on your end though and let me know how it goes.
Musp 25 Mar @ 5:22pm 
I don't have any experience using GitHub so here's a video that shows the issue:
https://youtu.be/jmveQPf7Wg4

also here is a link to the collection of addons I'm using, hope this helps:
https://steamproxy.net/sharedfiles/filedetails/?id=2913451164
blackmagicfine  [author] 24 Mar @ 9:59pm 
@Musp: I am unable to reproduce your issue. The only way that this can happen that I'm aware of is if you change ttt2_defective_corpse_reveal_mode mid-game (for example, after you have killed the def).

It could be that there's some sort of conflicting addon that you have. Or perhaps there's some combination of ConVars that I haven't properly tested. If you wish, you could submit a bug on GitHub, though I would need more information from you (ex. video, addon list, etc.)
Musp 23 Mar @ 2:21pm 
I have ttt2_defective_corpse_reveal_mode set to 0 but when a det searches the corpse of a def it shows the role icon on the body as def instead of det. Any way to fix this :)
blackmagicfine  [author] 24 Nov, 2023 @ 4:01pm 
@SylpheedW: Something I forgot to mention is that even if the Masterchief is demoted the music that plays when they're first selected will still play.
blackmagicfine  [author] 24 Nov, 2023 @ 2:57pm 
@SylpheedW: I am unable to reproduce your issue. I tested it out with a few other detective roles, such as the Vigilante and Banker. I also tested dynamically changing the role mid game, but it all seems to work fine on my end. I looked at the Masterchief's code and it seems fine. Perhaps this issue is related to a different addon or convar?
SylpheedW 24 Nov, 2023 @ 9:42am 
Hi @blackmagicfine
I have the problem that the detective still gets the role "Master Chief" even though ttt2_defective_special_det_handling_mode is set to "1".
Could you please look into this?
Voxel | Julia 25 Jun, 2023 @ 3:24am 
Thank you!
blackmagicfine  [author] 24 Jun, 2023 @ 7:44pm 
@Pixelblock: The feature was more involved than I originally anticipated, but it is done. When you set ttt2_defective_special_det_handling_mode to 3 you will activate "VISAGE" mode. Quick rundown:

1. The Defective may receive a visage of a special detective role. Probabilities are determined by that role's own chances of popping up in game
2. The Defective will be notified of the role they are disguised as through a rather large popup that disappears after a few seconds
3. Everyone who can see the Defective's true role (including the Defective themselves) will further be notified via chat message
4. Those who can see the Defective's true role will see a line like "Disguised as <ROLE>" when hovering their cursor over the Defective

The changes were substantial, so let me know if you (or anyone else!) runs into any issues.