ID:176101
 
ok i have a randomly generated map so i cant use the normal send them to a certain location so i had to make it random.
The problem is. It doesnt randomly place the people when they die. It sends them to a set one. If you know whats wrong please tell me. Here is the code.

mob
proc
DeathCheck()
if(src.life == 0)
alert(src,"Sorry you died")
var/obj/corpse/O = new/obj/corpse(src.loc)
new/obj/corpse(O.loc)
var/list/N = new/list()
for(var/turf/room/T in world)
N += T
var/turf/T = pick(N)
src.loc = T.loc
src.life = src.maxlife
world << "[src] has just died"
src.melee = 0
src.bio = 10


if(peopleingame == 0)
alert(src,"You have won this melee congratulations!")
src.wins += 1
world << "

[src] has just won this melee!

"
else
if(src.melee == 1)
alert(src,"You lost better luck next time!")
src.losses += 1
else
src.deaths += 1
else
src.life -= 1



This is the part that randomly places them:
var/list/N = new/list()
for(var/turf/room/T in world)
N += T
var/turf/T = pick(N)
src.loc = T.loc
src.life = src.maxlife
Thank you for your time!
It's hard to see, but here's the problem:

var/turf/T = pick(N)
src.loc = T.loc

Since T is a turf, T.loc is an area. So you're setting src.loc to an area, and that sends you to the first turf in the area. If you just set src.loc=T, it will work.

Lummox JR
In response to Lummox JR
ok thank you i will see if that works :-).
In response to Jinjo21
Well for the most part it works. But there are two more problems. I have randomly generated maps for this game. The one problem is i cant save it. The second problem is when i use that relocate thing it takes me to an area where i cant move off of the map. :-\