Save/load attribute problem! Pls help!

Greetings,
So i have a problem with save load attributes. I have 3 attributes that need to be saved, one for unlocked levels, one for pottery counting and one for treasure box counting. I have all three loads at the beginning of the game (intro scene ). The pottery and treasure save are in rules that save the attribute every time the actor is touched By the hero, so for example pottery count + 1 then save attribute potterycount to key "potterycount save" it works fine EXCEPT that when I exit the game and take it out of memory to "restart" the game, I get the last saved count for pottery and treasures, but if I start the game again it restarts saving treasures/pottery from 0 and erases my previous save. How do I get it to just continue adding onto the previous count? Or maybe it can't do that?

As well my unlock levels do not save. I have an integer attribute set for 2 which means the first two levels are open and during the game I have an actor that when touched by the player it should add +1 to that attribute unlocking the next level. It does this for 7 stages and saves the attribute on each stage as I assume that for each +1 it should save onto that initial 2 so by the end the count for all states unlocked should be 9, then saved and loaded next time, however this does not happen, I reset the game and my levels are all relocked, what am I doing wrong?

Thank you very much!

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    By 'start the game again' do you mean starting from the beginning of the game again, like at level 1 when you last finished level 3? Are you using a reset behavior? The reset behavior will reset everything so it's best to setup your own reset code and only returning the attributes you would like to go to their default value.
  • nowherejaynowherejay Member, PRO Posts: 85
    hello! by restarting the game, i close the game with the home button, then double click the home button and then take it out of memory on the iPad. when it starts again nothing is saved even though i know all my save loads are correct. its frustrating!
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    Why not use a table? constrain all your level attribute, pottery attribute & treasure attributes from the table. update the table and save it while your game runs or after a level has been completed. By doing that you will get back the last known values of those attribute even when you exit and rerun the game again.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Yes I agree, tables is a better way of saving.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Only thing I can think of is make sure you are NOT using the expression editor to input the key name. Just type it into the box
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited December 2012

    @sugawara

    Hi, good points from the other guys. To add, a couple of suggestions:

    A more usual situation than the one you have is to have two buttons on your menu/intro card. One is new Game or similar, and this just takes you to your first scene, where you start fresh. the other button, marked Continue, or continue Game, whatever, is where you put all of your Load Attribute behaviours, ending with loading the Saved Attribute behaviour for the scene to go to.

    Next to say, a more watertight way of saving and loading scenes, from what I can see from your description, instead of using the integer attribute to save the amount of unlocked scenes, use this to indicate the last scene played, i.e the one to go to if continue is pressed. (You'll still need attributes to indicate which of your scenes is locked/unlocked of course, but by the sound of it, you'd need one boolean attribute for each of the scenes...)

    So to carry on talking about the Rules in the Continue button, at the end, you need to put:

    When YourInt = 1
    Change Scene Go to Scene 1

    When YourInt = 2
    Change Scene Go to Scene 2

    etc

    This is the only way at the moment of changing a scene based on a variable, because the Change Scene value can't be changed/amended via the expression editor.

    Finally to say, the Save and Load Attribute behaviours don't work in GSC on the Mac (at least, they never used to); to see/check them working, you need to play the game on the viewer on the device, or be runing an ad hoc.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.