ID:269797
Oct 14 2005, 8:55 am
|
|
How do I have the game pick one player out of the players in the game and then change a var of theirs and possibly send that person a message? Do I have to generate a list of the players I want the game to pick out of?
|
In response to KingSerpent
|
|
The top half helps, but the bottom half wasn't really what I wanted. I want the GAME to pick a person randomly without the PLAYERS knowing about it and change a var of the person and send that person a message telling them that they've been selected.
|
Or, if you want the game to do everything automatically (I think you did anyway) you'd do something like this:
var/list/players=new() // Make a new list for players. :-) |
In response to KingSerpent
|
|
Thanks, KingSerpent, I was not very familiar with lists.
|
In response to Justin Knight
|
|
Yar, lists are a wonderful thing in DM.
|
Now, use for() to loop through every player in the game, and also use if(M.client) to check to see if they truly are a player, unless you want non-players to show up in the list as well, like so:
Next, to access the list and allow the player that activated the verb to choose someone in the world, or however you wanted it done, use input(). (Only if you intend to let one player choose another) Like so:
Next, loop through all the people in the world and find the one matching the player var. Like so:
Hope this helps. :-)