Forum rules - please read before posting.

Add more data to objetives

edited March 28 in Technical Q&A

Hello, I’m currently working on implementing an objective user interface. In addition to displaying quest details, I’d like to include information about the quest giver’s name and location. Is there a way to expand the data from objectives so that I can incorporate it into the UI?

Comments

  • Welcome to the community, @mohut.

    Currently, this would require the use of scripting - to store such data in a separate component, that then links to the Objective via its ID number.

    For example:

    using UnityEngine;
    using AC;
    
    public class AdditionalObjectiveData : MonoBehaviour
    {
    
        public int objectiveID;
        public string giverName;
        public string location;
    
    }
    

    There are a few ways you can then expand this to integrate into your UI. The easiest way is to just read the currently-selected Objective, and update Global String variables with its values if the ID matches. These variables can then be displayed in the UI using tokens:

    void Update ()
    {
        if (KickStarter.runtimeObjectives.SelectedObjective != null && KickStarter.runtimeObjectives.SelectedObjective.ObjectiveID == objectiveID)
        {
            GlobalVariables.GetVariable ("Giver name").TextValue = giverName;
            GlobalVariables.GetVariable ("Location").TextValue = location;
        }
    }
    
  • Thank you very much. This works perfectly :smiley:

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.