|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Level Change & Saving Data?
[Re: Roxas]
#278768
07/15/09 14:23
07/15/09 14:23
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
If you write the functions the right way, with many parameters, this shouldn't be all that hard. For example, I'd write my function something like this: void saveQuestStatus(int questNumber, int levelNumber, int questStatus)
and then write another function which retreaves exactly that data from the file: void loadQuestStatus(int questNumber, int levelNumber)
that should make the level switching much more comfortable.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: Level Change & Saving Data?
[Re: Roxas]
#278806
07/15/09 17:08
07/15/09 17:08
|
Joined: Apr 2008
Posts: 144 Germany | Niedersachsen (Lower...
Roxas
OP
Member
|
OP
Member
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
|
well I've got a lot more to save then just 3 variables. ^^
function store_data()
{
data = file_open_write("temp");
file_var_write(data, npc001.talked_to);
file_var_write(data, npc002.talked_to);
file_close(data);
}
function restore_data()
{
data = file_open_read("temp");
npc001.talked_to = file_var_read(data);
npc002.talked_to = file_var_read(data);
file_close(data);
}
thats how it looks like, and i wanted to add every variable that is needed for the level change, such as hp, mp, items etc. works fine for me though. but i wonder how to save the game, if i would save the whole game like this everyone could just save the game and change the values for example potions: 10000 o rsomething. is there a way to encrypt the file or something? cheers Roxas
|
|
|
Re: Level Change & Saving Data?
[Re: Widi]
#278997
07/16/09 10:58
07/16/09 10:58
|
Joined: Apr 2008
Posts: 144 Germany | Niedersachsen (Lower...
Roxas
OP
Member
|
OP
Member
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
|
the level change works fine ^^
I meant saving the game. close the engine, rerun the engine and load the save_state via game_load. then the character seams to call his own action two times.
when i change levels I freeze the whole game. load a new level and unfreeze it. between the freeze and unfreeze I save and restore game data which is important for the gameflow via a temp file and my functions i posted earlier.
now I made a savepoint like in games like Final Fantasy. you approach it and save your game.
when i load the game the character appears on the position where i saved the game and all works fine, except of the characters animations, movement and gravity. its all doubled
so i use for saving temporary data the file_var... commands and for saving the whole game i wanted to use game_save and game_load, and those two game commands r messing up
cheers Roxas
Last edited by Roxas; 07/16/09 10:59.
|
|
|
|