ID:269265
 
I am trying to make a world where a person can go to an astral plane so to speak. The player has two mobs, one is their physical self, the other is their spirit self. They start as the physical, but by using a verb, they can become their spirit self on another plane(another z on the map), but their physical self stays in place in the real world. When they become their physical self again, their spirit self disappears from the astral plane.

Here's what I did so far...each player has 2 savefiles, one for each mob. When they become a spirit, I save their physical self, and load their spiritual self, which seems to work, but how do I get back to their waiting physical self? Whenever I save the spirit self and load the physical, it starts them at the start square, rather than where they were.

Any ideas on how to better implement a system like this?
heres a way you could do it ("this is just a idea not a system please dont copy it and ask why it dont work! THIS IS UNTESTED")

first some vars
mob
var
physical_x = 0
physical_y = 0
physical_z = 0
spirit_x = 0
spirit_y = 0
spirit_z = 0

these would act as the pointers to where the player was (these only update when a player saves or changes form
mob
var
obj
fakebody = null


then we make a fake form for the player while he/she is not controling the mob
obj
fakebody
density = 1


then a proc to swap the 2 forms
mob
proc
physical_to_spirit()
set category = "jump"
src.verbs -= /mob/proc/physical_to_spirit
src.verbs += /mob/proc/spirit_to_physical
fakebody = new/obj/fakebody
fakebody.icon = src.icon
fakebody.icon_state = src.icon_state
fakebody.name = src.name
physical_x = src.x
physical_y = src.y
physical_z = src.z
//if you have a HUD (stuff on the client screen or overlays remove them here!)
src.loc = locate(0,0,0)
src.icon = 'spirit.dmi'
src.icon_state = "?ugh?"
src.loc = locate(spirit_x,spirit_y,spirit_z)
spirit_to_physical()
set category = "jump"
src.verbs += /mob/proc/physical_to_spirit
src.verbs -= /mob/proc/spirit_to_physical
del(fakebody)
spirit_x = src.x
spirit_y = src.y
spirit_z = src.z
//if you have a HUD reload it here
src.loc = locate(0,0,0)
src.icon = 'body.dmi'
src.icon_state = "?ugh?"
src.loc = locate(physical_x,physical_y,physical_z)


and there we go the basics of what your after (if there are spelling errors code errors or anything else i did warn you NOT TO USE THIS ITS JUST FOR IDEAS ^_^ :)


In response to Zmadpeter
Thanks for the idea! I actually figured it out about 30 min ago. I messed with client.mob and found out that if I stored it in a variable in the client, then it would stay in the physical world! then I just loaded it back up by saying client.mob=client.mobholder

I would have prbly just gone with your system, except the stats for the new mob are completely different.