How to randomly assign one player from among the players (multiplayer) to be the "impostor"?

Hello everyone :wave:

I wonder how to make one random player from all the players in the lobby an impostor

I am working on a game that is somewhat similar to the idea of ​​Among Us and what has been hindering the completion of this game is that I cannot set a random player as an impostor among the players so that I can add special features to him like increasing his speed and others

There is action pick random object
Then give them variable called Impostor
And set it to false by default

Now using pick random object you would simply pick one random player and set his Impostor variable to true

Thanks for helping me

But when I put the action “Select Random Object” and select the player, what do I do next? I have a global variable called (ImposterID) but how can I combine it with the randomness and how can I select a random player from the players in the lobby as an impostor?

Sorry but I’m very new to the multiplayer part… so my questions might seem illogical to you ):
Can you please tell me how to do this easier?

Here are the current events of the scene:

and

Problem i am not into multiplayer
I have no idea how it works
I just know what you need to do from logic side

So your player objects are duplicates of same object
And then you simply pick one of them with that pick random object action

OR you have them as being each separate objects
Then in editor you need to put them into the group fro example called Players
And now you use pick random object Players

And i would do it right before game starts i mean when players go from loby to actual game

And now all you need is one condition
Player variable Impostor = TRUE

And under that even you shove in all your logic for what impostor can and should do and what he would see
Maybe he would have different interface?

And your global variable ImposterID makes no sense
Since it is global and it is only 1 var
Then if it is true or false when it is boolean
What it would indicate or influence?

I think you lack a lot of knowledge and you should watch some tutorials before you get into game making

Do not give up on your game
I only say gain some knowledge then go for it

hum…Maybe what you need is a group of Players. Do you have one?
Try creating slightly different ducks (change a color for example) and put all your different characters in a group. (I realise just now : Zero X4 just said the same).

I think this is a little harsh though : one has to know what to look for in a tutorial to really learn I think and now that you’ve helped and given clues, OP can go look by himself!

1 Like

When someone asks questions how to solve some simple logic
Admitting at the same time he is new
For sure he have not enough knowledge to complete a game

Where i did not forbid him from making this mistake
I only gave advice

Next time you quote me better quote whole sentence
So you do not change meaning of it

I think you lack a lot of knowledge and you should watch some tutorials before you get into game making

Do not give up on your game
I only say gain some knowledge then go for it

Nevermind…I didn’t mean to start a pointless argument.
At the least, your wording isn’t really clear : “before you get into game making” and the end of your message(which is a new sentence by the way) seem contradictory but that’s maybe why i’m bad at programming…i’m not the most logical person around.

Well, I hope OP gets his problem fixed.

On one hand i wonder how you came to conclusions that any1 who come here to help care to be harsh or mean to others?

On other hand just because i need to ask you such question kinda explains that you get from my message what you want instead of trying to understand it

While at the same time think why i even wrote what i wrote?

I joined gdevelop over 2 years a go to simply recreate MINIcraft which is game jam game which lead to developing MINEcraft

And someone ported it even to gba

I kinda NOW TODAY have everything i need to recreate this game in gdevelop
BUT some parts would be figuring out rather than knowing how to do
For example i more or less know how to make chunk system and split world into grid yet i never done that
I need to explore that logic before i can move on with it

And that is because i came here with same believe as OP i gonna make a game

I did lack knowledge to even properly create player movement
Tutorials did help
And look where i am now over 2 years later?
Are you able to play my recreation of it?

I can make part of it
But FROM MY OWN EXPERIENCE
When you need to ask questions how to do something so simple
You will fail at more complex logic

And i experienced it 1st hand
And i wish i could save every single fresh dev from realizing same thing as i did and giving up

So my words were only in best interest of OP
What you took out of it indicate you are looking for conflict and not for solution

So stating now you did not want to start pointless argument makes no sense

Anyway i have no harsh feelings but just like in OP case
I am trying to explain something to you and not humiliate you
So take it as me trying to help

I help however i can and how i see fit
If you have any other words to say to OP to motivate him to gain more knowledge go with it i will 100% back you up on it

I have experience but the part about team play made me feel distracted :grinning:

I appreciate your help and I literally feel that it actually makes sense but it just requires my focus

I will try what I understood and let you know the result

I am not diminishing your experience
I simply feel you are in same shiet i was
And nothing will help you more than getting more knowledge
Where main idea is not to just gain knowledge
You need to gain some practice

like imagine you work in pharmacy
You sell medicines
Your knowledge is when my head hurts i ask you for something to cure me
YOU knowing exactly which medicine to sell me is your knowledge

Practice is to know where that medicine is located on 100 shelves in your pharmacy

Well more or less

You get the idea

Good luck

1 Like

So, did you have a chance to work on your project?
If I may help and go the same route as ZeroX4 : I’m not an expert so I may make mistakes but here is how I would approach it :

  • Create 3 other characters.
  • Create a group and add the 4 characters in it.
  • For each Character object, create a variable is_impostor (boolean), False as a default value
  • In you event sheet : select a random object among the group Player, at the beginning of the game.
  • turn the random selected player’s variable is_imposter to True.

Well, let us know what you make of it!

EDIT : Something like that.

image

Look, this is instructive :
image

1 Like

Thank you @Marraw @ZeroX4

Thanks to your help, I was able to set a random player as an impostor

Actually, when @ZeroX4 explained it, I understood it and applied it literally and his explanation made me understand the logic of GDevelop… But what didn’t work properly is that I didn’t notice that I had to set (Trigger once) I was setting it (at the beginning of the scene) and this is a mistake that I didn’t notice until @Marraw shared the explanation with me

But I have an additional problem after setting a random player as an impostor :sweat_smile:

Honestly, I no longer understand if it’s me or if multiplayer affects GDevelop’s logic because this is not the first game I’ve created on GDevelop but it’s the first experience with multiplayer and it’s complicated in terms of variables

Since this is what I’ve done now, it sets a random player as an impostor as I explained to Me:

image

This is my experiment to make sure it randomly assigns a player as an impostor and differentiates between players in this development environment, I made its transparency 20% and it actually works and assigns a random player as an impostor and I can see the transparency applied successfully which means its assignment process is done

image

Currently, the game is supposed to be somewhat similar to Among Us, where the impostor should be able to kill other players, for example, when doing events and actions like the following, it is applied to the impostor, which is normal because I assigned this ability to the impostor, so my question is, how can I assign perks like killing and others to the impostor and make it affect the player Normal

image

That is something i cannot assist you with
I am not into multiplayer and i don’t know anything about it
There is multiplayer help channel on gdevelop discord
Maybe try asking there

1 Like

Hey! Glad you could make it work!
hummm I’m experimenting with multiplayer too and from what I understand the central notion is “ownership”.
Without a bigger view at your events, it’s a bit difficult to guess but maybe try with this as an event and adding your collision event as a subevent under it :

image

You can try narrowing the problem down with viewer conditions : perhaps start by removing the x key pressed condition.

Furthermore, I’m not sure any peer has a right (ownership/authority) to delete any player. So maybe your imposter will have to take ownership of the object it “wants” to kill/delete.
That’s what I can think of now, but you’ll have to test things out!

1 Like

Thank you I will try what you told me
Thank you very much

Don’t worry, what you’ve given me before is enough. Thank you.

1 Like

Hey! I’ve worked a bit on your problem and i came up with a half solution…I’ll post it when I’ll be on my computer!
The player gets deleted on collision but i can’t make it work yet with a Key press évent…

1 Like

I really appreciate your efforts and I am excited to see what you come up with

Here is what I’ve come up with :

but as I said, it’s only a half solution, whenever and wherever I put the key pressed condition, it stops working…
So, for now, when the imposter collides with another player, the latter is deleted.
Maybe someone will be able to help us!

EDIT : the repeat condition is only for debugging purposes! It’s not necessary at all!

EDIT : when I say it stops working, what I mean is : the conditions are all checked OK (I can see the debug messages : “collision registered” and “collision registered : with killer” in the log) but I don’t get past the last conditions…

Ok, I think it works now. I made use of the messages that we can send to the other players :

Well, it looks “long” but there are lots of debug messages. And the code can probably be a bit “refactored” as it doesn’t look really elegant!