Murder Mystery game

in the murder mystery game im making, im having a hard time. in the game, there are innocents, 1 detective, and one murderer, but that’s the issue im having, idk how to make it so that it randomly chooses a murderer and a detective and the rest of the people are innocents.

This is a single player game? If so, I think you can just make everyone “innocent” to begin with, and use a Once trigger to randomly select one Murderer, and then select one detective from the remaining innocents.

yes, it is, but how would i make it so that like, if one person was chosen to be a detective, but they get chosen again to be a murderer, how would i keep that from happening? @grazer

You can use switches.


There are probably lots of ways to do this, but here are my thoughts:
You have players 1-8 (just say, it could be any number). First, you pick a random number 1-8 to be the murderer. Then you pick a number 1-8 to be the detective. But before setting that player as detective, check to see if the number picked for detective is the same as the number picked for murderer. If it is, pick a random number again. Repeat until the number for detective is NOT EQUAL TO the number for murderer.

yeah i got every single word you said LOL, but could u send a screenshot? @johnpost

I’ll try to show an example

@johnpost okay (at least 20 characters)

I’ve been busy, I’ll try to make one today

@johnpost okay (at least 20 characters)

Here is some code with annotations that follows what I said earlier

1 Like

@johnpost where is this going to go? in the character, or the parent object?

You could set it up to go anywhere, but I would probably do it in a separate object for picking players. Just use global variables or a save block or something to set each player to the correct number (and therefore role)

@johnpost could u give a screenshot for that 2 plz? thanks in advance!

I don’t exactly know what you are asking for. The code I gave before is an example of a random number picker that chooses 2 numbers, and makes sure the 2 numbers are different. Where the code goes and what happens from there will depend on how you want your game to work.

i got it nvm (at least 20 characters)

1 Like