ID:273635
 
So I'm making a pixel movement system, but that isn't relevant. I have code that when I enter an area it causes all the monsters in that area to move randomly. However the move randomly proc is an infinite loop, this causes my player to be completely frozen (however he can still shoot his beam). My questions are: this caused by the infinite loops, (which it probably is sense none of the monsters on my screen start moving) and how can I call these guys to move without incurring an infinite loop. The basic code looks like this:
area/move-randomly
var/activated=0
Entered(atom/a)
if(!istype(a,/player))return

if(activated) return
activated=1
for(var/tmp/monster/M in src)
M.move_randomly()
Use spawn() to call the procedure in a separate thread.
In response to Garthor
wow, I forgot all about spawn. Thx for the help!