ID:155221
 
Hello, I'm trying make a system to choose any one player to be the killer, so I dont idea how to make it.
Could you explain better what you exactly want?
In response to Ocean King
I want to know how to select any one player in the game
In response to SoulGamesProductions
Idk if i'm correct, but u can probably make a new list that has all the players in it and assign them a number, then randomly select one from the list using the pick proc Im guessing. I doubt I'm right but it could possibly work?
In response to Chaorace
I think so, but I'm not a great Cooder, I do not know how to do it right
In response to SoulGamesProductions
SoulGamesProductions wrote:
I think so, but I'm not a great Cooder, I do not know how to do it right


I'm not on either, but read the DM guide and use the DM reference(f1) while you're in the dream maker.
In response to SoulGamesProductions
SoulGamesProductions wrote:
I want to know how to select any one player in the game

There are many ways to do this. You have to be more specific.
In response to Albro1
Just select any player online, example:There are 6 people online,one of six chosen.
In response to SoulGamesProductions
There are many ways to do this.
for(var/mob/m)
{
if(m.client)
{
//select
}
}
In response to Albro1
More will select every player Online?
In response to SoulGamesProductions
That code there loops through every human-controlled player online.
In response to Albro1
I do only one of all player online to be selected.
In response to SoulGamesProductions
I'm not a mind reader. I don't know why you want this, what you are applying it to, or what you are searching for. I don't know how you want someone to be picked. At random? Based on stats? What? All I have to go on is your one-sentence descriptions of what you want.
In response to Albro1
I'm trying to do an automated system in which only select a player to be a character, as kira, naruto, the killer...
In response to SoulGamesProductions
var list/l = list()//Populate this list with mobs to pick from

for(var/mob/m)
{
if(m.client)
{
l+=m; //Add all human-controlled mobs to l
}
}

var mob/M = pick(l); //Now pick a mob randomly from l
//Your mob is picked. Do all other stuff.
In response to Albro1
Thank you for your patience with me and help me
In response to Albro1
Just a word of advice: you generally do not want to loop through every mob in the game if you're trying to locate players. Instead, you want to loop through clients:

var/list/possible = list()

for(var/client/C in world)
if(C.mob)
possible += C.mob

// do selection code



This saves you a lot of CPU power if you have a lot of /mobs in the game.