playMaker

Author Topic: Can i save files with ArrayMaker and load these later?[SOLVED]  (Read 5221 times)

bursari92

  • Playmaker Newbie
  • *
  • Posts: 5
Just two simple questions:

I need a save/load cycle.

Can i save files with ArrayMaker during the game and load these files later, after restarting the game?

if not, can i make this with playerprefs? (hope ArrayMaker works )

Thanks for reply!
« Last Edit: June 06, 2013, 05:13:51 AM by jeanfabre »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Can i save files with ArrayMaker and load these later?
« Reply #1 on: May 30, 2013, 10:11:46 PM »
Hi, Not currently but I have a script which writes the vertex colors of a mesh (so writes an array) to a txt file. This can be used to populate an array using array maker ... I have just learnt some basics of action building so might give converting my script to an action.

What type of variables are you wanting to save/load?

bursari92

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Can i save files with ArrayMaker and load these later?
« Reply #2 on: May 30, 2013, 10:22:30 PM »
thanks for reply :)

Your script can be very useful for me :)

I want to save/load mostly integers, strings and just sometimes rect (to save position).

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can i save files with ArrayMaker and load these later?
« Reply #3 on: May 31, 2013, 02:19:50 AM »
Hi,

 I am currently working with EasySave2 Author to provide a way to save and load arrayMaker stuff. It's almost there :)

bye,

 Jean

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Can i save files with ArrayMaker and load these later?
« Reply #4 on: May 31, 2013, 02:58:58 AM »
Jean ... you're amazing!

tankun

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Can i save files with ArrayMaker and load these later?
« Reply #5 on: May 31, 2013, 07:03:28 AM »
Easy save is a great tool and very easy to use. In my opinion, it will be complete with the arraymaker saving option. Thanks Jean.

bursari92

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Can i save files with ArrayMaker and load these later?
« Reply #6 on: May 31, 2013, 07:40:58 PM »
Thanks Jean you are really amazing :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can i save files with ArrayMaker and load these later?
« Reply #7 on: June 03, 2013, 07:23:44 AM »
Hi,

 Done :) download it at the usual wiki page, it features as an addon, but you need to also update arrayMaker to have everything working properly.

https://hutonggames.fogbugz.com/default.asp?W715


bye,

 Jean

tankun

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Can i save files with ArrayMaker and load these later?
« Reply #8 on: June 03, 2013, 03:57:36 PM »
Thanks a lot Jean. This is amazing really.

I've tested the easy save actions in a game environment.

Hash tables are saving and loading alright but when you load the level (with Load Level action) after loading all the hash tables /arrays and variables, all the hash tables and arrays reset to initial values. There are no problems with loading normal variables with this method though.

I've tried attaching Don't Destroy on Load to Hashtable Proxy objects but then when you load the game there are 2 instances of these game objects (naturally). I think this happens because of the Arraymaker's proxy system which is different from the normal variables.

I thought of creating an initialization system without using Load Level but then I gave up since my game would definitely have more than one level as with most games.

I building up my adventure game system right now so I've only got one level only.

What sort of work-around would you recommend?

Cheers,

Tan

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can i save files with ArrayMaker and load these later?
« Reply #9 on: June 04, 2013, 01:35:11 AM »
Hi,

 Yes, editing data at runtime will always have this behavior if you reload the gameObject, that's to be expected and this is a good thing, and that's why there is don't destroy on load feature.

to work properly with this, you need to do the following:

1: maintain a boolean global variable, for example "My array is up", false by default
2: on the gameObject that host your array, have a fsm that when starting check this "My Array is Up" is true, if it is true, then you destroy yourself right away, if false then you set that flag to true,

this way, each of your levels can have in their hierarchy this game object with this array, and when you load them during your game, they will manage themselves automatically.

Does that make sense?

That's a perfect example of very useful usage of global variables. you must have one global variable per gameObject of this kind of course, so name them properly and distinctly, because the down side of use global var is that every fsm can access it.

bye,

 Jean

tankun

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Can i save files with ArrayMaker and load these later?
« Reply #10 on: June 05, 2013, 02:43:39 AM »
Hi Jean,

I've been trying to figure this out for two days now but I'm stuck.

Your solution works but here is my bind.

When the game loads, game state manager object is lost from the Hash Table actions. It has all reverted to: None (Game Object) now. It seems like when the game loads, all the old game managers are destroyed and replaced by new ones (or vice versa). But in the end the actions cannot find the game managers in the loaded game.

I've done the fsm on the game manager (which holds the main hash table) like in the picture I've attached. I'm probably missing something very simple here.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can i save files with ArrayMaker and load these later?
« Reply #11 on: June 06, 2013, 02:10:35 AM »
Hi,

 You will need to host references to gameObjects differently, like using find for example.

in your case, I think the problem is the following:

-- in the second scene, your object that wants to access your game manager reference the instance in that scene, but since it's loaded, that reference will find out that a game manager exists already and destroy itself.

 so you need to find a different way around this. Like hosting the game manager  reference in a global variable or use the find action when an fsm starts and knows it has to access persistent gameObjects.

 Does that make sense?

 
bye,

 Jean

tankun

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Can i save files with ArrayMaker and load these later?
« Reply #12 on: June 06, 2013, 05:00:03 AM »
Using the Find Game Object action and assigning the game state manager to a variable worked as a charm. Just as I thought; elementary:)

I think this thread should be marked as (SOLVED) now.

Thanks a million Jean.

Croesus

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Can i save files with ArrayMaker and load these later?
« Reply #13 on: February 26, 2022, 01:13:47 PM »
Hi, Not currently but I have a script which writes the vertex colors of a mesh (so writes an array) to a txt file. This can be used to populate an array using array maker ... I have just learnt some basics of action building so might give converting my script to an action.

What type of variables are you wanting to save/load?

Hello friend. Can I use your action? I am trying to save an array's content (string values) to a file and call it back later.

markettounity

  • Playmaker Newbie
  • *
  • Posts: 29
Re: Can i save files with ArrayMaker and load these later?[SOLVED]
« Reply #14 on: February 27, 2022, 12:17:49 PM »
Hi all guys ! maybe you can help me ...

I've created some game objects (not prefabs) and i have them duplicated in the scene ( 100 in tolal ) .

Now , every game object has a variable named "name" and it's a string format.

IN RUNTIME , when i change the name by an input field the variable change on that specify gameobject, and it's save by PLAYERPREFS action as a string .
then i go to the next gameobject and change the name on the variable , but when i restart the game the name is the same for all the game objects ... all have the same "name" string ...

I want that every gameobject have a diffferent string and when i quit and restart the game every gameobject reload his own "name" by playerprefs ...

What's wrong ???

NOTE :
I've installed Array maker and all was ok, but "Easy save 3" failed to install and send me an error ...

Please help me !! thank you ! :D