mob
Login()
var/turf/Start/T
usr.icon='Orc.dmi'
for(T in world)
if(!T.occupied)
T.occupied=1
usr.loc=locate(/turf/Start)
new/obj/Deck(usr)
It creates tow decks because I put two starts in the world, but I don't know why it is finding it twice, please help. I wan't it top log them into the first unoccupied turf names start and create only one deck.
[EDIT]
Would return 0 after new/obj/Deck(usr) work?
ID:261247
Nov 12 2001, 2:44 pm
|
|
for(T in world) will repeat the loop twice. Since you do nothing to stop the loop from repeating, it will always loops twice.
Also, this line:
usr.loc=locate(/turf/Start)
will move the player to the first turf, no matter what T is. It might be best to use
usr.loc = T
return 0 would make the loop stop. It would be better to use break, then you could test after the loop to be certain the player found a start square. If not, they could be moved to an audience area or something.
mob
Login()
var/turf/Start/T
usr.icon='Orc.dmi'
for(T in world)
if(!T.occupied)
T.occupied=1
usr.loc = T
new/obj/Deck(usr)
break
if(!T) // both start areas were occupied
// make them an audience member or delete them, whatever you like