Garry's Mod
[TTT2] Defective [ROLE]
65 件のコメント
Sl0ter 5月2日 4時33分 
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  [作成者] 5月2日 0時42分 
@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 5月1日 9時00分 
@blackmagicfine
that's strange.
blackmagicfine  [作成者] 4月26日 22時15分 
@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 4月26日 1時55分 
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 3月27日 11時08分 
I see. Understandable
Thanks anyway!
blackmagicfine  [作成者] 3月27日 10時54分 
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 3月27日 1時48分 
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  [作成者] 3月27日 1時25分 
@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 3月27日 1時08分 
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?
blackmagicfine  [作成者] 3月27日 0時16分 
@ramley: I think you could make this happen by following similar settings to how I created the Anonymous TTT2 role.

I think setting these two ConVars to the specified values will do the trick (haven't tested myself):
ttt_defective_pct 1.0
ttt_defective_max 99
A percentage of 1.0 will attempt to force every Traitor into a Defective, and raising the max to a sufficiently high value is needed (the default value of "1" will make it so that only one Defective can spawn)
I'll also note that ttt_defective_random controls the actual chance of the Defective role being considered during role selection. You shouldn't have to change this).

If I recall correctly, to make this work I believe you'll also need the Defective on its own layer, with a higher priority than any other Traitor subroles that you may have. This should prevent issues where TTT2 selects a Traitor subrole (ex. Glutton) first for one Traitor, and only afterwards encounters the selection logic for the Defective.
ramley 3月26日 23時54分 
Sorry I realize that was bad wording
I mean prevent traitors from spawning (so just defective spawns)
ramley 3月26日 23時48分 
I've seen videos of this role where it was able to spawn in place of a traitor, but i don't see any way of doing that in the settings. Was this removed or was that a custom version?
Cpt.Haxray 3月23日 12時51分 
the Color set in the convar seems perfect, but i'll wait to see if I get any feedback/complaints from some colorblind players of mine.
Cpt.Haxray 3月23日 12時08分 
Cheers. Really appreciate the change :)
blackmagicfine  [作成者] 3月23日 1時32分 
@Cpt.Haxray: Hey Haxray, long time no talk, just saw your comment (been busy these past few weeks). I have added ttt2_defective_color_mode for you. It is 0 by default (for the default purple color), but if you set it to 1 the Defective will have a more red color. Changes you make to this ConVar won't become apparent until the server restarts or the map changes.

Let me know if you want it to be a different shade of red (and if so, provide the RGB values)
Cpt.Haxray 3月14日 17時34分 
Would you be willing to consider adding a convar or changing the default role color? It is incredibly confusing for Traitor teammates if they miss the notification at the start of the round, or in the heat of the moment.

This has been a common complaint both on the server I used to run, and on multiple other servers. Changing the default to a shade of Red would make it a lot harder to accidentally teamkill your defective teammate.
Buttercup 2024年3月28日 19時39分 
seems to be working now, thanks for fixing it :)
blackmagicfine  [作成者] 2024年3月27日 2時08分 
@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.
Buttercup 2024年3月25日 17時22分 
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  [作成者] 2024年3月24日 21時59分 
@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.)
Buttercup 2024年3月23日 14時21分 
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  [作成者] 2023年11月24日 16時01分 
@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  [作成者] 2023年11月24日 14時57分 
@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 2023年11月24日 9時42分 
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 2023年6月25日 3時24分 
Thank you!
blackmagicfine  [作成者] 2023年6月24日 19時44分 
@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.
Voxel | Julia 2023年6月21日 16時03分 
I do know that not having the abilitys of thier presumed role is a big risk for the def, but i also think this is the best way of handeling it. It would be amazing if you could add this new mode as it would solve my problem perfectly!
blackmagicfine  [作成者] 2023年6月21日 13時26分 
@Pixelblock: I assume that you have ttt2_defective_special_det_handling_mode set to 0. By default it is 1, which forces special Dets (ex. Sheriff, Sniffer, Banker, etc) to be regular Dets, which prevents the problem that you're observing entirely.

If you want, I can add a new mode for ttt2_defective_special_det_handling_mode. This new mode would assign a probability for the Def to look like a Sheriff/Sniffer/Banker/etc. while also not altering the role of special Dets. However, I should warn you that this will put the Def at a significant disadvantage: They would not have the abilities of their assumed role. This is particularly evident if the Def is masquerading as a Sheriff or Sniffer, as they would not have a Magnifying Glass or Deputy Deagle and thus would be extremely easy to identify.

I would be unwilling to also give the Def the abilities of the special Det role that they're masquerading as: This would require hardcoding for every special Det role (i.e. buggy)
Voxel | Julia 2023年6月21日 12時35分 
It would be nice if the defective could also be displayed as another configurable dt role. This would stop defectives being easily identifyable in rounds where the dt always has another role
blackmagicfine  [作成者] 2023年5月1日 21時41分 
@Dill: Short answer:
Set ttt2_defective_inform_everyone to 0
Set ttt2_defective_disable_spawn_if_no_detective to 0
Set ttt2_defective_demote_detective_pct to 1.0

For a more technical answer: TTT2 doesn't allow for fine role selection logic such as "Only enable this role if this other role is or is not present". The above two options hack in what you desire (your players won't notice the difference).
hashbrown pussy 2023年5月1日 13時39分 
Is there any way I can make it so that defectives spawn ONLY when detectives don't?
Kanjuro 2022年4月10日 5時26分 
God, now I'm feeling stupid. It was actually the Spy, who with default settings, always spawns and is confirmed as a Traitor when other Traitors still live. In all my testing scenarios I seem to have never killed him last, so he never was revealed as a Spy. Seems like his role is doing exactly what it was supposed to do: confusing the heck out of his evil opponents. ^^ Still, thank you for all your precious time. Great and fun addons, btw.
blackmagicfine  [作成者] 2022年4月9日 17時59分 
@Kanjuro: I'm not able to reproduce this.

Round Info should be able to see that the Defective is a Traitor. It does on my end at least. It does this both at the start of the round (by saying that there's 2 traitors in the game in chat), and when the Defective kills you (by displaying a pop-up saying as much).

There's a couple things that could have gone wrong here. One possibility is that you have a conflicting addon that is reinterpreting the Defective as an Innocent. Another possibility is that you have a conflicting addon or strange role distribution settings (ex. making "ttt_min_inno_pct" too low) which have added a 3rd traitor to your scenario, when you only want 2 (This doesn't explain why Round Info is telling you that the Defective is Innocent though).

I'm not sure how this could come about in the Defective's source code alone. Try taking out addons that can mess with a player's role and see if you are still able to reproduce the issue.
Kanjuro 2022年4月9日 13時27分 
I thought so too, but if I have 7 players which normally consist of 4 normal innocents, 2 traitors and 1 detective and I were to enable the defective (which, for testing purposes, has a 100% chance to spawn and to replace the detective), I will end up with 4 innocents and 3 traitors (of which 1 is the defective). The basic role distribution settings for detective and defective are the same, if that matters. Additionally, the addon "[TTT2] Round Info" also detects the defective as an innocent, which would give him away, but that might just be an incompatibility.
blackmagicfine  [作成者] 2022年4月9日 11時44分 
@Kanjuro: This is already the case. The Defective is a traitor subrole and takes up a traitor slot.
Kanjuro 2022年4月9日 9時36分 
Would it be possible to add a ConVar that counts a defective, that replaced a detective, towards the maximum percentage of traitors? So having originally 2 traitors and 1 detective wouldn't leave the traitor team with 3 people, but 2 (1 defective and 1 other traitor role).
Hannes 2022年2月11日 5時32分 
Thanks, very much appreciated! ^^
blackmagicfine  [作成者] 2022年2月11日 1時53分 
@Hannes: It should be fixed now. Looks like I neglected to add some end-of-round cleanup logic for this scenario.
Hannes 2022年2月9日 10時50分 
Everything is on default except for the "corpse reveal mode" (it's on 1) and the "special det handling" (it's on 2).
blackmagicfine  [作成者] 2022年2月9日 10時41分 
@Hannes: Just so we're on the same page, could you share with me your rolespecific ConVars?
Hannes 2022年2月9日 7時33分 
Oh, but after some more testing, I think this only happens, if the Detectives and Defective are the last ones in the round and only then can do damage to each other in order for the round to end...
Hannes 2022年2月9日 6時33分 
I hope my explanation wasn't too confusing xD.
Hannes 2022年2月9日 6時32分 
So, I did a little testing with roles on my server and in one round I just got randomly turned into a Detective (Mayor in my case). After some more testing I found out that this problem is because of the Defective: If there is a Defective in the round, he will turn every special Detective into a normal one, so far so good. However, after the round ends and a new one starts: If there are Detectives in this round and they all get killed, the players that were supposed to be special Detectives in the previous round will change their role into that special Detective (doesn't matter what role they had up to this point)
blackmagicfine  [作成者] 2021年10月14日 12時05分 
With the recent update to TTT2 (v0.10.0b), a lot of things changed that impacted the Defective. In theory, it should be less hardcoded now, and my testing revealed nothing strange, but please report any strange behavior you happen to find.

In addition, credits were reworked. I ended up removing ttt2_defective_gain_traitor_credits, as the Defective now gains credits like a Traitor by default. I don't think this will impact the Defective's ability to mimic a Detective, as Traitors tend to gain more credits than Detectives in general.

Finally, I decoupled the Defective's starting credits from the Detective's, so you may need to set that value manually in your server.
|UGA|PatPeter 2021年9月9日 23時25分 
I created a master configuration file for all of the TTT roles in the first 3 pages of the Workshop search: https://gist.github.com/PatPeter/70b1c090d8c8c311d99632dca76ec513
blackmagicfine  [作成者] 2021年3月20日 20時17分 
Ok, I have uploaded the new feature. It is known as "ttt2_defective_demote_detective_pct"
SmilinTurd 2021年3月8日 22時44分 
Absolutely love it, perfect solution. thanks heaps. We play with only 1 detective anyway so the second concern is no issue for us. I do agree that it does mess with one of the core mechanics, but we have a group that for the most part the traitors lose, so a chance of the detective being 1 of the traitors will make it extra spicy. love your work.
blackmagicfine  [作成者] 2021年3月7日 21時30分 
I'm of the belief that doing that would destroy the core mechanic of the detective (that they're trustworthy). That's why the popup message is shown by default.

I think what I could do is have a ConVar that is a percentage (0.0 by default). If that percentage is hit, then in the beginning of a round where there is at least one def, I could "demote" a det into an innocent for each def in game. This demotion would also affect special det roles such as the Sheriff or Vigilante. The popup that normally informs everyone (when ttt2_defective_inform_everyone is enabled) would also be prevented from showing up if there are no dets in general, but could still show up if there's a mix of the two.

ttt2_defective_disable_spawn_if_no_detective would need to be disabled for this.

Keep in mind that if there are more dets than defs, than there would still be a mix of the two with this ConVar. Reason for this is because flat out demoting all dets seems pretty OP to me.

Would that work for you?
SmilinTurd 2021年3月7日 20時10分 
Any chance to have it where that the defective can "replace" the detective. So when spawning roles, theres is not a real detective but a singular defective that everyone believes to be the detective?