ID:175974
 
Hi, it's me, Muska. I have found that possibly the hardest and most vital part of a game is saving. I have tried the various Libraries and none of them suit me. Is there a way to save that only uses a few lines of code? I;ve seen the various New F/savefile etc. but i dont know how they work. If you can help me thank you.

Muska
Muska wrote:
Hi, it's me, Muska. I have found that possibly the hardest and most vital part of a game is saving. I have tried the various Libraries and none of them suit me. Is there a way to save that only uses a few lines of code? I;ve seen the various New F/savefile etc. but i dont know how they work. If you can help me thank you.

Muska

I don't use savefiles that often, nor am I very successful when it comes to me making them.. But I'll give it a shot.
proc/SaveMob(mob/M as mob)
var/savefile/F = new("[M.key].sav")
F["x"] << M.x // For some reason Write() doesn't save location.
F["y"] << M.y // To store information in a savefile, do it in the following format: Savefilename["what to store as"] << information
F["z"] << M.z
M.Write(F)
proc/LoadMob(mob/M as mob)
if(fexists("[M.key].sav"))
var/savefile/F = new("[M.key].sav")
var/new_x,new_y,new_z
F["x"] >> new_x
F["y"] >> new_y
F["z"] >> new_z
M.Read(F)
M.Move(locate(new_x,new_y,new_z))


Hope that helps you.

~>Volte