ID:178322
![]() May 28 2002, 6:42 am
|
|
I'm desperately in need of code that can save the world. Basically, I need code that saves every object on the map, including all their vars and their location. I tried but I'm very unfamiliar with saving. This is extremely essential for my game. Could someone help me or give me a link to an example of this?
|
Ok, thanks, now how would I do a load proc? =P I am completely clueless on how to do save/load =(. And how would I save a mob's location? I've looked at libraries but I always seem to mess it up when I put it in my game (I prefer to put it in directly instead of libraries because sometimes I forget I have that library included, lol.)
|
I thought it was var/mob/S = new pick("/mob/Superman","/mob/Batman","/mob/Justice League")(Villan.x+rand(-10,10),Villan.y+rand(-10,10),Villan. z) . Bleh.
|
Garthor wrote:
Ok, thanks, now how would I do a load proc? =P I am completely clueless on how to do save/load =(. And how would I save a mob's location? I've looked at libraries but I always seem to mess it up when I put it in my game (I prefer to put it in directly instead of libraries because sometimes I forget I have that library included, lol.) Load would pretty much work in the same order. I'm afraid it's hard to be more specific than that, because I'm not sure to what extent the code I posted will work; I've done only a little with savefiles so far. Lummox JR |
No its
proc/Savetheworld() for(var/mob/monkey/T in world) if(T.owner = "Foomer") del(T) world << "[T] has been destroyed for his masters fear of busy women!" else world << "[T] likes busty women!!" |
Your save proc works fine. I tried making a load proc and it doesn't work at all. I seriously need help with this =P
|
Garthor wrote:
Your save proc works fine. I tried making a load proc and it doesn't work at all. I seriously need help with this =P One thought I had, which may or may not work out: proc/LoadWorld() I have no idea how well that will work. Lummox JR [EDIT] F.dirs was changed to F.dir. |
Garthor wrote:
Fantasy Life.dm:80:error:F.dirs:undefined var Doh! Try F.dir instead; I made a typo. Lummox JR |
did this work? I've been working on a world save myself and saving is the easy part, loading seems to be the part that doesn't work...
But before I change my code to fit lummox's example I was wondering if it works |
If you only want to save objs, not turfs, then I'd try this:
For anything you don't want to save, you should override Write(). Overriding mob.Write() is essential if you want to save a player's position.
Lummox JR