Welcome to guide #5!
Today we’ll be making a role system to add to your games!
You can use this to make among us games, or any other ideas you can come up with!
This system is more efficient than other role granters.
Materials list
Property x3 (30 memory)
Counter x2 (50 memory)
Relay x2 (40 memory)
Trigger x1 (540 memory)
Lifecycle x1 (50 memory)
Popup x1 (50 memory)
Let’s get started!
Step 1: Properties
These are the settings for the properties.
Step 2: Counters
These are the settings for the counters.
Counter 1
Counter 2
Step 3: Trigger Loop
Setup your lifecycle like this:
Setup one of your relays like this:
Now wire that relay to the trigger:
Here are the settings for the trigger:
These settings can be found in the availability section.
Now for my favorite part…
CODE!
Add a new block in the trigger and make this:
Here’s what to put for the if condition:
[1]
Step 4: Ending the Loop
Wire counter 2 to the second relay like this:
Here are the settings for that relay:
Now the role system is done! But how will the player know what role they got? Let’s add a display!
Get the popup and give it these settings:
Now make a new block that activates when receiving on the channel all roles given. Set it up like this:
The great part about this role granter is that it’s customizable. You can add as many roles and as many people per role as you want! I made a system with 2 special roles and 1 person per role. The rest of the players are “normies”. Here’s how to change it!
How to change the number of roles
The number of roles is controlled by counter 2. Change the target to be however many special roles you want plus 1. I have 2 special roles, so I set the target to 3.
But if you wanted 5 roles, you would set it to 6.
Then you have to add on to the popup code to display the roles. You can do that by clicking the gear on the if check and adding on the same number of else ifs as roles you have.
How to change the amount of people per role
The amount of people per role is controlled by counter 1. Just set the target to be how many people you want per role. I set mine to 1.
But if you want 3, set the target to 3.
That was quite a lot, wasn’t it? How does this even work?
How it works
First, we have our lifecycle start the loop by broadcasting give role. The relay receives this and activates for 1 random player. This activates the trigger for that player which adds their name to a property, sets their role, and increases counter 1. Then it broadcasts give role which the relay receives again. It does the same thing as last time, but what if the random player we sent it to last time receives it again? We can prevent this by checking the property we stored the players name in to see if we’ve already given them a role using the in [text] find first occurrence of [text]
block. Now when we want to change the role we’re granting, when counter 1 meets its target, we broadcast an increase to counter 2 and reset counter 1. When counter 2 meets its target, we send a message to everyone using another relay that disables the trigger ending the loop and reveals your role.
Limitations
Can’t set a unique amount of people per role for every role.
Won’t stop loop if there’s not enough players.
Could break if 2 people with the same name enter the game.
And that’s it! Congratulations, you made a role granter! Hopefully you enjoyed this guide and will find it useful!
If you have any questions, reply to this and someone will be happy to help!
Have fun building! -@Fulcrum-19
- Amazing!
- It’s ok…
- Needs more pictures.
- Needs more text.
- Bad.
- 1/10
- 2/10
- 3/10
- 4/10
- 5/10
- 6/10
- 7/10
- 8/10
- 9/10
- 10/10
You found the easter egg! this is my first time doing this. I’m going to add one of these in every guide I make!
What you should do: reply to this telling me how much you like (or hate) this guide and put an egg emoji at the bottom of your reply! ↩︎