Code:
mob/var/ghostedmob = 0
mob/var/originalmob = 0
mob/var/switched = 0
mob/owner/verb/Body_Switch_Ghost_Thing(mob/M)
if(M.client)
if(usr.switched==0)
var/mob/P = new(M.loc)
P.density = 0
var/temploc = usr.loc
var/temploca = M.loc
P.key = M.key
M.key = usr.key
M.switched = 1
M.originalmob = usr
M.ghostedmob = P
walk_towards(P,M)
M.loc = temploc
P.loc = temploc
P.client.eye = M.client.eye
usr.loc = locate(temploca)
else
if(M != usr.originalmob) usr << "Back in your body first!!"
if(M != usr.originalmob) return
usr.switched=0
var/temploc = usr.loc
var/temploca = M.loc
M.key = usr.key
var/mob/P = usr.ghostedmob
usr.key = P.key
del(P)
M.loc = temploc
usr.loc = locate(temploca)
else
switch(input("WARNING: Doing this will cause your key to log out, and you cannot switch back! CONTINUE?")in list("Yes","No"))
if("No")
usr << "Ok good!"
else
if(usr.switched==0)
var/mob/P = new(M.loc)
P.density = 0
var/temploc = usr.loc
var/temploca = M.loc
P.key = M.key
M.key = usr.key
M.switched = 1
M.originalmob = usr
M.ghostedmob = P
walk_towards(P,M)
M.loc = temploc
usr.loc = locate(temploca)
else
if(M != usr.originalmob) usr << "Back in your body first!!"
if(M != usr.originalmob) return
usr.switched=0
var/temploc = usr.loc
var/temploca = M.loc
M.key = usr.key
var/mob/P = usr.ghostedmob
usr.key = P.key
del(P)
M.loc = temploc
usr.loc = locate(temploca)
Problem description:The problem is well I dont know and all I know is that it logs you out when you use it.
But what it is suppose to do is let you control another mob and freeze the person your controling until you switch back to your body, and not allow the usr to do anything else such as use that mobs verbs and access its inventory.
Second, it's more efficient I believe to modify Move() for movement control.
Note: There may be a cleaner way.