Save/load function

Get help using Construct 2

Post » Wed Nov 13, 2013 3:23 pm

Hello everyone,

I have a webstorage save system on my game to save the global variables. But now, I'm trying to use the load/save function in order to include a lot of collectable bonus that keep their stat without a global.

Everything works pretty fine but I still have some issues that disturb me:

-The played music is saved by that function. So when I load the samegame I have the music (and the sounds) that were playing at that time. It's like a quickload. I can't find a way to avoid that. Even a 'stop' music doesn't work.
-Same with the post FX. I have global variables to check if it's fullscreen or not. But when I change the option on the main menu and load the game, he keeps the global as it was before (even if I load the webstorage data AFTER the Load function)

So my question is : Is there a way to block some data (globals; sounds) during a SAVE function, like the objects with the 'NOSAVE' behavior.

Thanx
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Wed Nov 13, 2013 4:48 pm

It doesn't work if you stop all sounds and music before the initial save takes place?
B
46
S
16
G
79
Posts: 2,171
Reputation: 46,859

Post » Wed Nov 13, 2013 7:06 pm

@plinkie Well I save the game when the character overlap an object like a checkpoint. So I can't cut all the sounds; the player is still playing.
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Wed Nov 13, 2013 7:17 pm

Maybe stop the sounds in a "load complete"-event.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Wed Nov 13, 2013 7:37 pm

@mindfaQ Good idea. But no... it doesn't stop anything. :(
I also don't understand something:
1)I play and catch some bonus. Then I save.
2) I close and relaunch the game. The music continues(not as expected) and the bonus are disappeared (as expected).
3) I close again and relaunch : The music starts from the beginning and the bonus are back !!!!!!!!!! WHAT THE HELL ?

It's like if my full save was deleted after 2 launches.KaMiZoTo2013-11-13 19:37:56
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Wed Nov 13, 2013 8:39 pm

I've just done this very easily. All you need is : -
On Load Complete
Cond: If any audio is playing > Stop All

Essentially what the guy above me was saying to do as well.plinkie2013-11-13 20:40:21
B
46
S
16
G
79
Posts: 2,171
Reputation: 46,859

Post » Wed Nov 13, 2013 8:59 pm

It doesn't seem to work on my project because I load the savegame on a 'loading layout' and then go to the layout written in a global.
Adding this stopall function on the loading layout eventsheet or the game eventsheet give the same result : music and sounds still playing.
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Wed Nov 13, 2013 9:11 pm

The audio plugin has settings for what audio is saved and loaded.
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,681

Post » Wed Nov 13, 2013 9:18 pm

I don't understand the crazy load game method. Link to a demo of the game so I can see how it saves/loads please.
B
46
S
16
G
79
Posts: 2,171
Reputation: 46,859

Post » Wed Nov 13, 2013 9:21 pm

@Ashley Thank you! That's what I was looking for. Is there a way to tell a Global variable not to be saved ?
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Next

Return to How do I....?

Who is online

Users browsing this forum: dand, Google [Bot], mickclarke and 29 guests