Garry's Mod

Garry's Mod

Not enough ratings
[TTT2] Undecided [ROLE]
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: ServerContent
Addon Tags: Fun, Roleplay
File Size
Posted
Updated
1.085 MB
7 Sep, 2021 @ 12:32pm
1 Jan @ 1:56am
11 Change Notes ( view )

Subscribe to download
[TTT2] Undecided [ROLE]

In 1 collection by blackmagicfine
TTT2 Mods For BMF's Server
93 items
Description
What do you mean that you haven't decided what your role is? You can't just sit on the fence when terrorism is involved!

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_undec




The Undecided is a Neutral role who is given 1 minute to "vote" for one of 3 randomly selected roles from a "ballot". They become the role that they vote for (they also get an "I VOTED" sticker, which offers no in-game benefit). If they do not vote within the allotted time, they become a Jester (or an Innocent if the Jester isn't installed) instead. The server owner can configure it so some other bad thing happens instead of becoming a Jester (ex. DEATH).

There is additionally an option to make the ballots re-occurring, such that the player will be constantly changing roles throughout the game. This is disabled by default.

How the Ballot is Generated
The ballot is generated by first separating the roles that the server has installed (and are valid for the current round) into 5 groups:
1. Innocents (excluding detectives)
2. Detectives
3. Traitors
4. Evil (roles with unique teams. Ex. Serial Killer, Jester, Infected, Marker, Doppelganger)
5. Neutral (Anything that doesn't fit the above 4 groups. Ex. Amnesiac, Drunk, Cursed, Medic)

Roles will only be present in the above groups if they could have been selected as starting roles.
Example 1: The Sidekick, Thrall, and Graverobber roles won't be present as they are secondary roles which only appear due to in-game events.
Example 2: The minimum number of players is considered. If 9 players are required for a player to be given the Medic role, but only 6 players are present on the server, then the Medic will not appear on the ballot.

Each group has a ConVar that determines its weight, which is used for random selection. The five weights do not have to add up to 100, but it will save you some headaches if they do. For example, if they add up to 100 and ttt2_undecided_weight_innocent is 35, then there is a 35% chance that an Innocent role will be chosen as a selectable option. These weights apply to each entry of the ballot, meaning that that if the ballot has 3 entries then it is possible for each entry to be an Innocent role.

A role cannot appear on the ballot multiple times.

This role offers support for the following roles that hide their true identity from the player: Shinigami, Wrath, and Lycanthrope. If the server has these roles installed, then they (along with the base Innocent role) will appear as "Innocent*". The player who selects "Innocent*" will probably become a special Innocent, but they can't know for certain. "Innocent*" can appear on the ballot multiple times, but each entry will correspond to a different role that has been obscured.

It is possible for the Undecided role to appear on the ballot. If the Undecided votes for their own role the ballot will be re-rolled and the timer reset.

Naturally, this role works best on servers that have numerous roles installed, but a miminalist server is supported. The ballot generation logic is semi-intelligent, and will adjust itself if one or more of the 5 groups is empty.



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_undecided_enabled [0/1] (default: 1) # the percentage of players that are spawned as this role ttt_undecided_pct [0.0..1.0] (default: 0.13) # the limit of players that spawn as this role each round, this overwrites the percentage ttt_undecided_max [0..n] (default: 1) # the probability each round of this role being spawned at all ttt_undecided_random [0..100] (default: 30) # the amount of players needed for this role to spawn ttt_undecided_min_players: [0..n] (default: 6)

Rolespecific Convars:
# How many possible roles can the Undecided choose between? ttt2_undecided_num_choices [2..n] (default: 3) # How many seconds does the Undecided have to choose their role? ttt2_undecided_ballot_timer [0..n] (default: 60) # How many seconds after the voting period ends does the Undecided receive another ballot (<=0 to only receive one ballot per game)? ttt2_undecided_time_between_ballots [0..n] (default: 0) # If the Undecided fails to vote, what should happen to them? ttt2_undecided_no_vote_punishment_mode [0..3] (default: 3) # 0: D E A T H P E N A L T Y # 1: They get randomly assigned a role from the list of choices that they had. # 2: They become a regular old Innocent # 3: They become a Jester # What is the weight of the possibiilty for an innocent subrole (including base innocent) from being presented to the Undecided? ttt2_undecided_weight_innocent [0..n] (default: 35) # What is the weight of the possibiilty for a detective subrole (including base detective) from being presented to the Undecided? ttt2_undecided_weight_detective [0..n] (default: 5) # What is the weight of the possibiilty for a traitor subrole (including base traitor) from being presented to the Undecided? ttt2_undecided_weight_traitor [0..n] (default: 15) # What is the weight of the possibiilty for a role that has a team which isn't INNOCENT, TRAITOR, or NONE from being presented to the Undecided? ttt2_undecided_weight_evil [0..n] (default: 25) # What is the weight of the possibiilty for a role that has no discernable team (ex. Amnesiac, Drunk) from being presented to the Undecided? ttt2_undecided_weight_neutral [0..n] (default: 20) # Can the Undecided vote to be an Undecided? ttt2_undecided_can_vote_for_self [0/1] (default: 1) # For a role to appear on the ballot, it must be: ttt2_undecided_role_enable_mode [0..2] (default: 0) # 0: Enabled on the server # 1: Disabled on the server (The ballot will consist of roles no one else can have) # 2: Either enabled or disabled on the server

--
Credits:
BlackMagicFine: creator of this role addon
Smuggles: designer of the role icon
Mineotopia: designer of the role thumbnail
17 Comments
blackmagicfine  [author] 1 Jan @ 2:01am 
@pawel99uk: Done. You can set "ttt2_undecided_role_enable_mode" to 1 so that it only picks disabled roles, or 2 so that it can any role regardless of whether it was enabled or disabled. I also took the liberty of extending ttt2_undecided_can_vote_for_self such that it overrides the added ConVar (in short: if this ConVar is true, then the Undecided will be able to vote for themselves even if ttt2_undecided_role_enable_mode is set to 1, and subsequently get a new ballot)
pawel99uk 30 Dec, 2023 @ 7:00am 
can you add a new convar for the role to allow it to only picked disabled roles or enabled and disabled roles on a server
Cpt.Haxray 29 Sep, 2021 @ 1:07pm 
Cheers. If its a a bad addon that's gonna be a pain to sort out, but thanks for the change regardless.
blackmagicfine  [author] 29 Sep, 2021 @ 12:50pm 
@Cpt.Haxray: ROLE_NONE showed up? I have no idea how that could possibly happen. You're certain that this player actually became the None role, not only according to the client but the server as well?

If you were to set num_choices to 99 on a server filled with many bots, the ballot will list out all roles that could possibly be chosen. Random chance won't play a factor here, as num_choices will exceed the amount of roles that you have installed on the server, and the ballot will end up just having all of the valid roles for the server's player count.

I have never seen ROLE_NONE appear on such a list, because I have a check early on that explicitly prevents its appearance. It is possible that your server has a bad addon or data corruption.

I went ahead and added an additional safety check for the Undecided. If a client somehow manages to vote for None or Sidekick or whatever invalid role, they'll now get an error message in the top right and the ballot will be regenerated.
Cpt.Haxray 28 Sep, 2021 @ 11:37pm 
Also, we increased the timer of the between Ballots to 180 seconds.
Cpt.Haxray 28 Sep, 2021 @ 11:37pm 
Quick bug report:
One player managed to see the None role appear on the Undecided's vote menu. I'm not sure as to why it showed up, and it only happened once. They were able to select it and were spawned in as the None role normally used only for Preparing.
blackmagicfine  [author] 27 Sep, 2021 @ 4:51pm 
@Cpt.Haxray: I believe that you can increase past the maximum just by manually typing in a number. The slider is more of a suggestion TBH. Example: I've set num_choices to 99 in the past for debugging purposes.

But also, let me know what number for ttt2_undecided_time_between_ballots you end up using. I can increase the slider length to include that number.
Cpt.Haxray 27 Sep, 2021 @ 1:26pm 
Yo, sorry for not responding. The convar works great and people are loving it. I do have one request though, would it be possible to increase the Maximum amount of time before it can trigger again? A lot of people feel that even when set at the current max that it happens a bit too often. Maybe im dumb and its just the slider lying to me in the menu and it can be increased, but it would be great to have the ability to make it longer.
|UGA|PatPeter 11 Sep, 2021 @ 10:21am 
Awesome, thanks for being so quick to fix it! I'll have my players try it out again.
blackmagicfine  [author] 10 Sep, 2021 @ 8:39pm 
@Cpt.Haxray: I have fulfilled your request. Set ttt2_undecided_time_between_ballots to some value greater to 0 to make ballots appear at regular time intervals. I would personally suggest some time between 90-120 seconds so that the player isn't hyper-focused on the voting aspect of the game. I also suggest using a value of 1 for ttt2_undecided_no_vote_punishment_mode, which makes the player get a randomly assigned role from the ballot if they fail to vote.