So me and my friend have been working on a trouble in terrorist town kinda game and we need help with a very stupid thing. So basically there is a system we made where it gives all player the innocent role and then randomly picks one player from the innocents removes the innocent role and gives them traitor. But it doesn’t work, the roles also change the players health. The problem is once we start the game for the first time in a new instance it works fine 50% of the time but after that it was like the health didn’t change, when the health did change something like the subtitle would break. Can you try and help figure out what’s wrong (sorry for the very long description)
#Need help with role & hp selector
19 messages · Page 1 of 1 (latest)
Create an event definition called DefinePlayerTeams, add a player port to it called Traitor
When you want to define teams:
Have a single player pick a random player from Get All Players, now, send the event DefinePlayerTeams to All with the random player as the traitor input
When the event is received, remove roles Innocent and Traitor from the local player
Now, if the traitor is local add role traitor, else add role innocent
I am “his friend”. Where in the circuit line would I add “set health” and “set max health”? After If Player Is Local? Or something else?
Where do you need to set health?
how is health supposed to be given?
If the health is purely dependent on innocent/traitor, it should be pretty fuckin' obvious where it goes
Now, if the traitor is local add role traitor, else add role innocent
I brain farted, an hour later and I am surprised I even asked that to be honest lmao
Also, does it really matter which one person selects the traitor?
You should use room authority, but it doesnt really matter, aslong as its one player
You should try an make game-start system for game rules run on the authority player always, this way you can detect if the authority changes and reset the game if they leave during start
This way players wont be trapped in the purgatory of "Game starting" between "Ready to start" and "Game Started" when you press start
If you have an int variable called Game State, and treat:
0 as ready to start (no active game, players in lobby)
1 as pre game start (map preparations, generation, players still in lobby)
2 as game starting (players have spawned in, they cant do anything yet)
3 as game started (players are spawned in, they can now play the game)
4 as game ended (a winner/draw has been declared, players have returned to lobby)
5 as game error (Error happened during states 1, or 4, which would have caused the game to be unplayable due)
You now have 5 states for the game to be in
If the room authority leaves during states 1, or 4, set the game state to 5
Player should always be able to start the game in game state 5, as if it were game state 0
There should not be any errors because of authority leaving in states 0, 2, or 3, because all of that data should be run locally, like tag physics, or a combat system
k
so, it's not setting health for anyone not room authority
yeah because you are using cringe gamerules
use custom game rules
what
make your own health
how lmao