Kill Count Quest UI update

Hello everybody, i’m new here and i’m just learning things.
I Ended two courses, rpg dialogue & quests and shops & abilities. Then I made quest kill count like in this topic Tracking kills for Quests? - Unity Courses / Ask - and it works perfectly, but the problem that i want to update quest ui status in tooltip like 0/2 1/2 and 2/2 and don’t know how to do it, i tryied to find some information here, but didn’t find anything. Help me please and sorry if it’s too easy to implement and i didnt get it

If you’re looking for the granular

Kill 7 Skeletons (3/7)

It can be a bit tricky. We need a different way to display the objectives, so that objectives with related counters append the (x/y) at the end.

I think the most straightforward approach is to modify the Objective class inside of Quest

        public class Objective
            public string reference;
            public string description;
            public bool usesCondition = false;
            public Condition completionCondition;
            public bool hasCounter;
            public string token;
            public int required;
            public string GetDescription()
                if (!hasCounter) return description;
                AchievementCounter counter = GameObject.FindWithTag("Player").GetComponent<AchievementCounter>();
                if (counter)
                    return $"{description} ({counter.GetCounterValue(token)}/{required})";

Set the appropriate values for hasCounter, token, and required.
Now in the QuestListUI, when listing the objective, instead of assigning the description, assign GetDescription() instead, which will properly disambiguate between a straight condition and a counter style condition.

1 Like

It turned out to be not as difficult as I thought
Thank you very much, you are my savior!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms