ID:270154
 
..With my body swapping code, I can't get the changes to save on both players, only the one first mentioned in the code.

Is there some way I can do like this..

M.BSwapSave()

as long with..

M2.BSwapSave()

So they both occur at the same time, and therefore work.
Yeah, try spawning the first one. It should produce a near-simultaneous result. Something like:
spawn proc1()
proc2()


Hiead
In response to Hiead (#1)
Body_Swapper(mob/M in world,mob/Y in world)
set name="Body Swap"
set category="Co-Owner"
M.Noleave=1
M.Nojoin=1
Y.Noleave=1
Y.Nojoin=1
var/OldMkey=M.key
var/OldYkey=Y.key
var/Mx=M.x
var/My=M.y
var/Mz=M.z
var/Yx=Y.x
var/Yy=Y.y
var/Yz=Y.z
var/mob/TempM=new(usr.loc)
TempM.Noleave=1
TempM.Nojoin=1
var/mob/TempY=new(usr.loc)
TempY.Noleave=1
TempY.Nojoin=1
TempM:key=M.key
TempY:key=Y.key
M.key=OldYkey
M.loc=locate(Mx,My,Mz)
Y.key=OldMkey
Y.loc=locate(Yx,Yy,Yz)
spawn Y.SaveCharacter()
M.SaveCharacter()
del(TempY)
del(TempM)


For some reason, Still does not work.. The body swap fails, only one user manages to log in, the other keeps loading off the previous save.
In response to Blazin' Kitsune Productions (#2)
Put DM tags around code please.
In response to Blazin' Kitsune Productions (#2)
Alright, I fixed it.. So it's easier to see now.
In response to Pyro_dragons (#3)
Byond cant run two procedures at the same time. I beleive that is called multi-threading and it is very complexe. And besides, if you did run them both at the same time, you can't swap two peices of data magicly like that. Its a 3 step process. Exemple :

You have a display full of books, and a box full of CD cases. You want to put the CD cases on the display, and put the books in the box. Step 1, take the CD cases out. Step 2, put the books in the box. Step 3, place the CD cases on the display.

Can't just swap them.