TTT2
TTT2 copied to clipboard
Spawn in with "No Role" when playing TTT2 solo
This might be entirely user error, but I've noticed that when doing my usual method of playing TTT alone (ttt_debug_preventwin 1), usually to test addons and maps, no longer functions properly. When beginning a new game, I am given the "NO ROLE" role, which is entirely grey except the white words denoting the lack of role. If I then try to force my role, by using (ttt_force_traitor), while I do gain the role, I have 1/0 credits and cannot do anything relating to my role's shop. I have no addons that could possibly conflict and cause this, and to make sure, I turned off everything except the TTT2 addon itself, the "Murder" addon, which I assumed was required for running TTT, and a single map with which to test. I have no idea if I've just fucked up something or this is a legitimate issue, but I'll have to disable the TTT2 addon when playing alone, which is quite annoying. I also can't find any mention of this anywhere else on the internet, so any resources to solve this would be greatly appreciated. Screenshots are contained.
{The detective shop, added to prove that likely all roles with a shop interface will suffer this issue.}
{The traitor role, with 1/0 credits, making me unable to purchase any T items.}
{The "NO ROLE" role, with no buy menu nor description.}
{The Innocent role, unsurprisingly, works fine due to having no buy interface.}
Apologies if this goes against a formatting convention or is already in a list of known bugs, I wasn't able to find an example of how to submit or documentation of this bug.
Yes it is know that you don't have a role when playing alone. I considered this to not be a problem.
Did you try setting the min player count from 2 to 1? This might fix it
Apologies, forgot to mention I did set the minimum player count I'm pretty sure. The main problem is meant to be that the traitor and detective credits break. If this is not considered an issue, feel free to close the thread.
It is an issue, yes. I'll keep it open. But it might be a while until we fix it. For now, just spawn a bot. Use bot_zombie 1
to prevent the bots from walking into their death
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
https://github.com/TTT-2/TTT2/blob/22c05a5963f6f7fcf7a318eb88ea1c83d38f57d2/gamemodes/terrortown/entities/entities/ttt_logic_role.lua#L60 looks like this is where the No Role is assigned
i think the easiest solution would be to add a command, like -test innocent 1000 -test [role] [credits]
• this command will first check if the user is the only one in the server • and if the user spams this command (like types it more than 3 times in 3 seconds), then it will do something bad to them to prevent DoSing the server
this way any solo player can test stuff on a server, and we dont have to go through and rewrite too much stuff
i think the drawback would be that the mod then has to check every single message to see if any match this... but for source mods, i think it can be made into a console command that any user can try
also, idk if Source automatically cleans user input, or if each mod would have to do that
looks like this is where the No Role is assigned
No, that is a check for which role you have in the ttt_logic_role
scripted entity, that you can place in ttt maps for stuff like traitor testers
it has nothing to do with role assignments at round start
i think the easiest solution would be to add a command, like -test innocent 1000 -test [role] [credits]
Also this is a thing alrready, for example to become traitor with 50 credits, enter ttt_force_traitor;ttt_cheat_credits 50
~~there is just a command missing to force the innocent role~~
actually there is one, i just missed it, it's called ttt_force_terror
the role assignment happens here: https://github.com/TTT-2/TTT2/blob/04f800d78b32a0174d830d62cf8395f1cfcd8d40/gamemodes/terrortown/gamemode/server/sv_roleselection.lua#L822-L928
and the line in question that causes the behaviour complained about in this issue is https://github.com/TTT-2/TTT2/blob/04f800d78b32a0174d830d62cf8395f1cfcd8d40/gamemodes/terrortown/gamemode/server/sv_roleselection.lua#L831
this line is not present in the original ttt version of this function: https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/terrortown/gamemode/init.lua#L845-L949
This alone wouldn't be a problem, but ttt2 also changes the line ROLE_NONE = ROLE_INNOCENT
to https://github.com/TTT-2/TTT2/blob/2f2a698f4782eb7ac005c9fe300709535cf0c9ac/gamemodes/terrortown/gamemode/shared/sh_init.lua#L96
Therefore the no_role role will not fallback to innocent anymore.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.