ID:973014
|
|
How do I save stuff that happens in the world, like a treasure box being already opened, or an obstacle removed, after I close the world and re-open it?
|
Sep 10 2012, 9:54 am
Best response
|
|
Savefiles
|
Oh my gosh, sorry, I haven't been able to work on my game in such a long time cause I've been swamped with school.
So I just started to work on this today, and I'm really confused on how this works, this is what I have so far, and it doesn't even work. world I get an error that says, error: world: cannot change constant value I'll be available all day, so if anyone can help, any is welcome! |
You will need to save particular objects within the world, and load them. The entire world cannot be saved/loaded like that. So you'd save the particular treasure boxes you were interested in.
|
Oh okay I see, even if my way did work, it would probably cause crazy lag and be memory expensive, lol.
Right, so I should go about making particular objects savable so that it loads itself how it was right? How should I go about differentiating them since some of them are going to be the same obj type? I could use like ++ to their file names or something, but what if I add more maps with that same obj type? Will it throw the save files outa whack? Is this way of going about that even effective? |
If you want to keep track of which treasure boxes were opened, you need a separate value to read for each one. You could save this as a list, as long as you read and write the list in the same order every time (which I don't think is reliable when you use for(treasure_box in world)). Or you could have separate buffers for each one. They could be named using their coordinates in an embedded statement:
S["treasurebox[box.x][box.y][box.z]"] I'm not that great with savefiles though so maybe someone has a better idea :) |