I'd like to have AI take over when a player quits in the middle of a game. I tried creating a new mob, then setting it's key to that of the player who is quitting, in hopes his mob will then be a clientless mob (with all variables, possessions, etc. intact) that will now be AI, while the new mob that the person took over can gracefully leave.
I got a ton of run-time errors/glitches when I tried this approach though. The code is shown below. Is there a demo/tutorial that would help with this, or does anyone have any advice on the matter? Thanks.
var/mob/player/spectator = new(src.loc,0)
spectator.key = src.key // make the switch!
src.name = "[src.name]_AI"
spectator.name = spectator.key
world << "[src.name] takes over."