ID:268926
 
Im trying to create a missile based projectile that sends an object to any mob within say 5 tiles, but, instead of bringing up a list, I want it to just randomly pick one of the possible targets.

How do I do this? Ive looked at the missile proc in the help files, and I understand how it works and such, But I just can't get it right.
First, make a list of all the 'hittable things'.
Then, do a x = rand(1, list.len) and go after list[x].
Something like:
verb/Fireball()
var
mob/list/moblist = list()
mob/M
x

// Get all mob's in usr's view.
for(M in view())
moblist += M

// Next, call missle on one of them:
missile(/obj/fireball, usr, list[rand(1, list.len)].loc)