I am having trouble with this picking procedure. It doesn't seem to work. Could anybody find out what is wrong?
proc/Pick()
var/pick = howmanypeople / 3
pick = round(pick)
while(pick --)
for(var/mob/M in peopleplaying)
M = pick(M)
M.thing = 1
peopleplaying -= M
var/list/peopleplaying = list()
var/howmanypeople = 0
Thanks.
PS: Try to help me as early as possible. =/
ID:261793
Jul 5 2003, 2:26 pm
|
|
var/pick = round(howmanypeople/3) //can do the rounding right here
while(pick --)
var/mob/M=pick(peopleplaying) //pick a mob from the list
M.thing = 1
peopleplaying -= M
var/list/peopleplaying = list()
var/howmanypeople = 0
That should work okay, you can use pick([list]) to choose things directly from the list at random (which is what I think you want to do). Using a for() loop would automatically choose the first 1/3 of the mobs it comes across. I also stuck the rounding directly into var/pick, not really a huge thing, but cuts down on excess code a little bit.