ID:155112
 
I'm making a random little game based on a DS game I played and liked, it's more for practice in coding than anything really, but I want to have characters spawn at different locations upon first logging in.

I'm not putting classes into the game, and want to know how to have the game choose random spots on random maps to spawn the players when they first start.

I've looked in the forums, and searched multiple times with pretty much every way I could think of to search what I want without thousands of unrelated posts popping up, and found nothing that worked.

I tried a few, but got errors, and so, as a last resort, I request help.(last resort, 'cause I am trying to learn by myself, as much as possible.)

help(even just tips, and no actual code) would be appreciated, and I can reveal more info as needed.

P.S. I would also like some advice on random auto map creation, I've looked at tuts, and searched the forums several times on this as well, and I will look at the tuts again, but would also appreciate it if someone would help a bit here as well, and it goes with this game's theme, 'cause I was thinking of giving each player his/her own 'world' to mess with, and allow others to come see.
using rand like
usr.loc=locate(rand(1,10),rand(1,10),1)
In response to Hassanjalil
yes, I thought of that not too long after I posted this, but I had been hoping for something a bit more complex so I could try and learn from this question xD

but thanks, I'll use that for now, and wait to see if anyone else'll be willing to help me learn.

*hopes he doesn't sound like one of those moochers that just wait around for people to do the coding for them, 'cause he's not* >.>...anywho, will continue to check until I'm sure this is a dead thread.

EDIT: I just tried to add it in, and it didn't work, the code gave no errors, but when I ran it, it crashed on me, I got to the point of it saying I had logged in, and then it died.

so I would like to know, where do I put this bit of code? under client somewhere or under Login()? and if I do it under Login() does that effect the all players? 'cause I only want this to happen to new players.
In response to JS173
you can try by creating a list such as
var/list/AllLocs=list("City"=locate(1,10,1),"Paradise"=locat e(50,50,1))
then when locating do this
var/Loc=pick(AllLocs)
src.loc=AllLocs[Loc]
then if u want to create teleport it would be better which can be done by
mob/verb/Teleport()
var/Tele=input(src,"Where would you like to Tele?","Teleport")as null|anything in AllLocs
if(!Tele) return
src.loc=AllLocs[Tele]
In response to Hassanjalil
but where would I put the code that randomizes the new player's loc?
Putting it in the client code where the saves are kept, in the part where it decides whether the player is new or not crashes the game, and putting it under Login() effects new and old players alike(or it did with me, every time I logged in to check the code, it sent me to a new loc).

and I'd like to point out, with all due respect for someone helping me, I'm not looking for a teleport, I know, more or less, how to use teletiles to go from map to map, so, while your teleport suggestion is welcome, and I have looked at it to see if I can improve my own map movement and whatnot, it's not what I'm looking for.
In response to JS173
if you have got Save Load System the make it sure
mob/Login()
if(src.Load()) world<<"[src] joined.{Last save file found}"
else
src.loc=locate(rand(1,10),rand(1,10),1)

thats for ur Login()
now for Save Load
mob/proc/Save()
if(fexists("Players/[ckey(src.key)].sav")) fdel("Players/[ckey(src.key)].sav")
var/savefile/F=new("Players/[ckey(src.key)].sav")
mob/proc/Load()
if(fexists("Players/[ckey(src.key)].sav"))
var/savefile/F=new("Players/[ckey(src.key)].sav")
return 1//it will return 1 of save file loads
In response to Hassanjalil
ok, that worked, however, I checked by relogging in my game, and while it works, I get a runtime error when I relog. logging in itself works, no errors to me, but if you reconnect you get a runtime error.

runtime error: bad file
proc name: Load (/mob/Load)
usr: JS173 (/mob)
src: JS173 (/mob)
call stack:
JS173 (/mob): Load(null)
JS173 (/mob): Login()
JS173 (/mob): Load(Players/JS173.sav (/savefile))
JS173 (/client): New()

any ideas? watch it be something real easy >.>...
anyway, while I await a response, I shall attempt to figure it out myself.
In response to JS173
lient
Del()
if(src.mob)
src.mob.SaveProc()
return ..()

mob/verb/Save()
set hidden=1
usr.SaveProc()

mob/var/CanSave=0
mob/proc/SaveProc()
if(!src.CanSave) return
if(fexists("Players/[ckey(src.key)].sav")) fdel("Players/[ckey(src.key)].sav")
var/savefile/F=new("Players/[ckey(src.key)].sav")
F["x"]<<src.x// save X
F["y"]<<src.y//Save Y
F["z"]<<src.z//Save Z
ob/proc/LoadProc()
if(fexists("Players/[ckey(src.key)].sav"))
var/savefile/F=new("Players/[ckey(src.key)].sav")
var/SaveVersion=F["SaveVersion"]
src.loc=locate(F["x"],F["y"],F["z"])//relocate to their saved Location