Forum rules - please read before posting.

Using fixed player profiles

Hi, I'm trying to have three fixed player profiles with fixed name player chooses from in beginning of a new game. Here's a picture Imgur
It seems that the ready made menu example is not so usable, so I need to make a new menu with some added logic.
But the problem here is that since all of the profiles are already made - or if someone wants to use a profile that has already finished the game - how do I check if a profile is in use. Or how should I resolve this?

Comments

  • You can create a Global variable to keep track of a Profile's state e.g. a Boolean named "Is in use" that is set to True once the game begins properly.

    If you then set the variable's Link to field to Options Data, it'll be stored as part of the Profile / Options data in PlayerPrefs, instead of being included in regular save files.

    You can then use a custom script to access the variable's state regardless of whether or not the Profile in question is actually active:

    int profileID = 1; // the ID of the profile
    string optionsSerialized = Options.OptionsFileHandler.LoadOptions (profileID, false);
    OptionsData optionsData = Serializer.DeserializeOptionsData (optionsSerialized);
    System.Collections.Generic.List<GVar> variables = KickStarter.saveSystem.UnloadVariablesData (optionsData.linkedVariables, false, KickStarter.runtimeVariables.globalVars, true);
    foreach (GVar variable in variables)
    {
        if (variable.id == 3) // the ID of the variable
        {
            bool isInUse = variable.BooleanValue;
        }
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.