Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Using script to get a list of Objectives

I would like to use scripting to get the full list of Objectives titles or descriptions. But when I use AC.KickStarter.runtimeObjectives.name it gives something like PersistentEngine.

What is the correct script to get an array or list of the Objectives? Or more specific incompleted Objectives?

Thanks.

Comments

  • edited February 22

    KickStarter.runtimeObjectives refers to the RuntimeObjectives component - which is where Objective data is stored, not the Objectives directly themselves. See the front page of the Scripting Guide for details.

    See the link above for a full list of available functions. To get an array of Active (i.e. started, but not Completed or Failed) Objectives, you can use the GetObjectives function:

    ObjectiveInstance[] activeObjectiveInstances = KickStarter.runtimeObjectives.GetObjectives (ObjectiveStateType.Active);
    

    (You can place using AC; at the top of the script to avoid having to start everything with "AC.")

    This will return an array of the ObjectiveInstance class. This has a reference to the original Objective class, which has functions to get the title and description in a given language:

    foreach (ObjectiveInstance activeObjectiveInstance in activeObjectiveInstances)
    {
        Objective activeObjective = activeObjectiveInstance.Objective;
        int currentLanguage = Options.GetLanguage ();
    
        string title = activeObjective.GetTitle (currentLanguage);
        string description = activeObjective.GetDescription (currentLanguage);
    }
    
  • Thank you.

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.
Do NOT follow this link or you will be banned from the site!