ID:2335329
 
Code:


Problem description:

Hey all,

I was trying to figure out a way to make it so when my key logs into my game, it will automatically create a character of a specified race, and spawn to specified coordinates. Namely for specific bug testing and map testing.

Thanks for any and all help that can be provided!
You could simply place a mob of that type on the map where you want it and set its 'key' variable to your key.

The default action when logging in is to connect to any mob with your key, of course you'd have to account for this in any places where you override said default action.
Ahoy Chewyy! Your post reminded me of an article I wrote a long time ago. You might find it useful: id:43124

The concept behind the article is the difference between code that defines something, and code that does something. To solve your problem you'll need a little of both, and knowing where to put each is key.

The most basic solution to your problem is to define an object type just for your key (define something) and then give it instructions in its New() proc (does something). That might look something like this:
mob/player/Chewyy
key = "Chewyy"
Login()
. = ..()
Move(locate("Chewyy_spawn_point"))


When a client logs into a BYOND game, the game looks through the code to see if there's a type of mob with that key. If it finds a type, then it creates one and logs the player into it. The Login() proc is called (run) whenever a client connects to a mob, so that's where we put the code that makes it move to your spawn point. The final part is that you'll need to edit a turf on your map so it has the tag "Chewyy_spawn_point", so the locate() proc can find it.