Stencyl 3.4.0 is now out. Get it now!

How do I take attributes from one scene to the next?

SillyGlassBoy

  • Posts: 7
Basically I'm trying to create a character creation system but I don't know how to have the animations carry on from one scene to the next.
I want it so if the player selects their character to have blue eyes during the first scene, when they enter the next scene to actually play the game their character has  blue eyes.

The only thing I can think to do is set up multiple identical scenes for every possible avatar customization option and having the options the player chose during character creation lead you to the scene with the avatar matching the players customization choices.
But that's stupid, overly complex and there obviously has to be a better solution.

NobodyX

  • *
  • Posts: 1196
“If you wind up with a boring, miserable life because you listened to your mom, your dad, your teacher, your priest, or some guy on TV telling you how to do your shit, then YOU DESERVE IT.”
― Frank Zappa

NickamonPoppytail

  • *
  • Posts: 325
You could have animations for every possible character creation option (if there aren't too many, otherwise this is impractical) and then use different game attributes for things like eye colour or whatever else you have planned for the character creation system.

fillergames

  • Posts: 732
This can easily be done with lists. This here shows basic retaining of the last used animation and position on a scene transition.


SillyGlassBoy

  • Posts: 7
So I've been struggling to get this to work and I still have no idea what I'm doing.

I'll explain what I'm doing and maybe someone can correct me? On the scene, I'm setting a number attribute to equal something. So for example setting a number attribute to equal 4.

Then I have another actor, that when clicked on the [save game and then...] block is triggered, which should save all attributes, and then the I have the [reload and fade out block...] after to reload the scene.

Then I have it set so when the scene is created it triggers the  [load save file and then...] block which should load my number = 4 attribute?

But nothing is happening, the scene just starts off as if the attribute hasn't been set yet? Am I doing something wrong or is that just not how you save/load attributes?

I appreciate the responses given so far but I honestly don't have a clue how to get this working, surely it can't really be that difficult? It seems like something you'd need to use constantly when coding.

JeffreyDriver

  • Posts: 1248
You don't need to save and load the game between scenes. The save/load blocks are to save and load the game so that the player can pickup where they left off.

Are you using the purple (global) attributes?

SillyGlassBoy

  • Posts: 7
You don't need to save and load the game between scenes. The save/load blocks are to save and load the game so that the player can pickup where they left off.

Are you using the purple (global) attributes?

No? Are you saying all I need to do is create the attributes as the purple ones instead?

JeffreyDriver

  • Posts: 1248
Yes. The blue attributes are local, so they work within a scene or actor. Purple attributes are global so the values carry on from scene to scene.

NickamonPoppytail

  • *
  • Posts: 325
Another tip from me is for beginners, because I have made this mistake many times. Know the difference between attributes and game attributes. For those who don't know, attributes are temporary statistics that only exist when an actor type, scene etc. exists. Game attributes stay around for the entire game, and can be used at any time.

When creating an attribute/game attribute, think of how long you need this attribute to exist. If it's something that's going to be in one scene or only when an actor is around, use an attribute. If you need something like a text attribute that saves your current scene's name as text that will be needed for saving and loading, use a game attribute.

Also, saving and loading only works for game attributes, and don't forget when loading a save file to switch to the scene with the name of the location game attribute.

This is a quote from the Useful Tips thread in Chit-Chat. You'll likely find some good info there, so it might be a good idea to read what some people have said.