LolIHateMyself 0 Posted September 9, 2018 So I've been trying to recreate the Gmod gamemode Trouble in Terrorist Town into ArmA 3 (because ArmA's combat engine is way better than Source in my opinion), however I am not a scripting wizard, and I was wondering if I could get some tips on selecting the roles of players (Innocents, Traitors, Detectives) without just displaying to the entire server who is a traitor, or manually hitting a random number generator. As a secondary Objective, I'd like to also know how I can create or find a premade menu interface for Traitors to buy traitor items. If you have any leads like youtube tutorials or some open source scripts it would be greatly appreciated Share this post Link to post Share on other sites
MrSanchez 243 Posted September 9, 2018 Hi, If you have access to the gmod files you could take a look at the lua scripts used for some of the original TTT's components such as the selection system. I think that for the selection part you should let the server do that and once that's done, broadcast the players' roles to them using _unit setVariable ["ttt_role", 2, true] or use remoteExec. The selection logic could be as follows: (pseudoish code) // Many different ways to approach this. // Below defaults everyone to role 0 (innocent) and then sets the role IDs. _innocentPool = allPlayers; { _x setVariable ["TTT_Role", 0, true]; } foreach _innocentPool; // Determine traitors for( int i = 0; i < amountOfTraitors; i++) { _traitor = selectRandom _innocentPool; _traitor setVariable ["TTT_Role", 1, true]; _innocentPool = _innocentPool - [_traitor]; } // Determine detectives for( int i = 0; i < amountOfDetectives; i++) { _detective = selectRandom _innocentPool; _traitor setVariable ["TTT_Role", 2, true]; _innocentPool = _innocentPool - [_traitor]; } { _x call TTT_fnc_initializeRole; // Uses TTT_Role variable } foreach allPlayers; As I commented, many ways to approach this. I'd recommend you write some pseudo code to figure out what you want, how you want it and how to get there :) Kind regards, Sanchez Share this post Link to post Share on other sites
HazJ 1289 Posted September 9, 2018 for( int i = 0; i < amountOfTraitors; i++) { Note: This isn't ArmA syntax. ArmA Syntax: for "_i" from 0 to (count amountOfTraitors) do { // do stuff... }; Share this post Link to post Share on other sites
MrSanchez 243 Posted September 10, 2018 16 hours ago, HazJ said: for( int i = 0; i < amountOfTraitors; i++) { Note: This isn't ArmA syntax. ArmA Syntax: for "_i" from 0 to (count amountOfTraitors) do { // do stuff... }; This is true. For Mr. HateMySelf, note that I tagged the code I provided as pseudoish code. It is not code to be directly copy pasted without adjustments :) Kind regards, Sanchez Share this post Link to post Share on other sites
HazJ 1289 Posted September 10, 2018 Yeah I know. I was just noting further and providing example using the correct syntax. (: 1 Share this post Link to post Share on other sites