TTT2 icon indicating copy to clipboard operation
TTT2 copied to clipboard

Spawn in with "No Role" when playing TTT2 solo

Open 7script opened this issue 2 years ago • 9 comments

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.

image {The detective shop, added to prove that likely all roles with a shop interface will suffer this issue.} image {The traitor role, with 1/0 credits, making me unable to purchase any T items.} image {The "NO ROLE" role, with no buy menu nor description.} 20220414201042_1 {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.

7script avatar Apr 14 '22 10:04 7script

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

TimGoll avatar Apr 15 '22 18:04 TimGoll

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.

7script avatar Apr 16 '22 10:04 7script

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

TimGoll avatar Apr 16 '22 10:04 TimGoll

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.

stale[bot] avatar Jun 19 '22 07:06 stale[bot]

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

mognify avatar Nov 18 '22 20:11 mognify

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

schockocraft avatar Jan 09 '23 04:01 schockocraft

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

schockocraft avatar Jan 09 '23 06:01 schockocraft

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.

schockocraft avatar Jan 09 '23 07:01 schockocraft

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.

stale[bot] avatar Feb 11 '24 10:02 stale[bot]