Plugin Request : Save/Load Persistant obj

Post your completed addons to share with the community

Post » Mon Nov 18, 2013 10:12 am

Hello everyone,

I'm not sure if it is possible but I was wondering if someone can do a plugin that load&save the stats (position, variables, destroyed or not...Etc) of objects with the Persistant behavior and only those objects.

This can help me to easely keep tracks of any persistant objects of my game (bonus, moving blocks, door stat..Etc) and I can use a webstorage for all the globals.

I'm trying to avoid using the save/load feature. (for many reasons)

Thanx!
B
73
S
21
G
12
Posts: 314
Reputation: 12,148

Post » Mon Nov 18, 2013 2:22 pm

Rex made this SaveLoadStatus plugin here.

Its a more modern version of the instance bank that uses the new inbuilt save load features. It doesn't like loading object on different layout than it was saved though, see my workaround later on in the thread if you need to do that.

B
14
S
5
G
1
Posts: 60
Reputation: 1,052

Post » Mon Nov 18, 2013 3:50 pm

@tlarkworthy Thank you for the link. I'm trying to understand the logic of the plugin but I don't get it, even with the example.

As I'm not a programmer at all, I have a lot of difficulties to understand those plugins. Sorry about that. I like when things are simple! But it's not always the case. ^^

I don't know if it can do that : save the stat of sprites in a family and then load it.
     -SaveStat Family "one"
     -LoadStat Family "One"

If a object has been destroyed, it is not recreated.
If a block has been moved, it keeps its new position.
If the door has his variable "Open=1", it keeps it.
B
73
S
21
G
12
Posts: 314
Reputation: 12,148

Post » Tue Nov 26, 2013 9:39 pm

In the build R151, there is a new thing :

d"New common expression 'AsJSON' and common action 'Set from JSON'. These allow you to take advantage of the savegame system to save and load individual instance states without having to save or load the entire game, as well as other useful things like setting one object's state to another's."

Can it be used to do what I'm looking for in that post ? If yes, how to use it?

Thank you
B
73
S
21
G
12
Posts: 314
Reputation: 12,148

Post » Wed Nov 27, 2013 1:15 pm

Why do you want to avoid the built-in savegame system? It also saves and loads persistent objects.
Scirra Founder
B
403
S
238
G
89
Posts: 24,654
Reputation: 196,155

Post » Wed Nov 27, 2013 2:06 pm

Hello @Ashley,

I want to avoid the built-in savegame system because it seems to take a picture of the memory, like the save/load stats of emulators.

It saves everything, objects without the NOSAVE behavior, the music and where it plays, the sounds playing while saving, all the globals..Etc.

So after trying it, I bumped into some issues :

-My main menus options are overwritten when I load my savegame
-The music and sounds are playing where they stopped (I find a trick to avoid that but I would prefer not to)
-When I add or modify elements on my game and load a savegame, those elements are not shown or not modified. (That's a real issue for testing or patching the game)
-Probably other issues I've not yet discovered.

All I want to do is to save and restore the stat of the persistant elements. That's all. And deal with Webstorage for everything else but I don't know if it is possible.

Perhaps I don't understand how the load/save feature works but I feel like there's a lack of controls anyway.

By the way, I'm also interested into a 'reset Persistant objects' because the only way to go back to main menu and start a new adventure is to close the app. (otherwise, all the persistant obj keep their stat)

Sorry if it is confused but I have a non programmer eye.KaMiZoTo2013-11-27 14:08:01
B
73
S
21
G
12
Posts: 314
Reputation: 12,148

Post » Wed Nov 27, 2013 2:17 pm

There are workarounds to all of that. Try using WebStorage to store menu options, and using the Audio object's new property (in the latest beta) to choose what is saved and loaded (e.g. you can choose not to save or load any audio, or just sound effects and not music, etc). Also if you add a new object, isn't it still there after loading a game? I thought I coded it so if a new object is added since making a savegame, it treats it as if it has the no-save behavior.
Scirra Founder
B
403
S
238
G
89
Posts: 24,654
Reputation: 196,155

Post » Wed Nov 27, 2013 2:37 pm

@Ashley

I already use Webstorage to store menu options. It is stored into a global variable. But when I save the game, I have no choice but saving that global too. So when I go back to the menu, change, for exemple, the fullscreen to OFF, when I load the game it overwrite it to ON.

When I add an instance of a persistant objet, for example more bonuses, they don't appear if I load the savegame.
B
73
S
21
G
12
Posts: 314
Reputation: 12,148

Post » Wed May 10, 2017 12:51 pm

@KaMiZoTo

sorry for old topic !

are you solve your problem with save/load ?
B
10
S
3
Posts: 180
Reputation: 1,212


Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests