Loading Game sets all saved attributes to 1?
TwilightHunter
Member Posts: 146
Hey fellas, I pray you do not get annoyed at a save/load game question xD
Anyway, for testing this feature I added, this is what I'm doing.
When the player is in the first stage I have an actor:
When s key is pressed, Save Attribute game.playerhealth, etc. I have quite a few attributes to save. I also have an actor that saves the scene number. So I have an attribute called game.WhichScene.
When "I" is pressed, it saves that attribute. (So if in scene 1, switch WhichScene to 1, then I press I to save it)
So now, when I click on the title screen, and click load game, it loads the scene correctly, but all of the health and stuff is at 1...? Any idea why this is? I'm new with this feature (never mind GS in general :P ) so any help would be hot!
Thanks fellas!
Anyway, for testing this feature I added, this is what I'm doing.
When the player is in the first stage I have an actor:
When s key is pressed, Save Attribute game.playerhealth, etc. I have quite a few attributes to save. I also have an actor that saves the scene number. So I have an attribute called game.WhichScene.
When "I" is pressed, it saves that attribute. (So if in scene 1, switch WhichScene to 1, then I press I to save it)
So now, when I click on the title screen, and click load game, it loads the scene correctly, but all of the health and stuff is at 1...? Any idea why this is? I'm new with this feature (never mind GS in general :P ) so any help would be hot!
Thanks fellas!
Comments
Example:
game.health=5
Save atribute game.health key: 12345
This has saved the value of 5 to a key of 12345
This saved value can then be loaded into any attribute you like using the load attribute behaviour. If you want it back in game.health then you will need:
load attribute 12345 to game.health
Hope that makes sense.
It saves the value to the key, so each save is overwriting the next. It does not save to the attribute name but to the key.
That's why you could load it to any attribute.
Example:
If I wanted to load the save I did above to a different attribute I could:
load attribute 12345 game.displaybox1
Now game.displaybox1 has the value of 5
Had to use a different key. ehem... may have been obvious to you.. ehem... wish I knew that at first... Thanks man! I wouldn't have figured it out if you hadn't posted. I had given up for the night xD
I just use the same name as the attribute for the key, then I don't get confused.
eg: save attribute game.health key: health
playerhealth: php
ROFL
anyway it worked. Thanks again