Animating HUD when a quest changes

Announcements, support questions, and discussion for Quest Machine.
Post Reply
SysOp
Posts: 10
Joined: Thu May 09, 2024 7:52 pm

Animating HUD when a quest changes

Post by SysOp »

Hello!

Sorry for bother, I've been trying to do this for the last couple of hours with no luck.

Basically what I want to do is to make the HUD have an animation when a quest changes, or a quest is added. It's simple, like quest description fades out, new quest description fades in.

I tried this example, with no luck. Also tried a new sub-class with this example and doesn't work either (the body text doesn't change)

Ideally I would like to hook the moment a quest is changed, so I can do my animations there. My problem is that, while I can access the quests, I cannot change its contents via code. For example, if I have a quest and press X:

Code: Select all

 if (Input.GetKeyDown(KeyCode.X))
        {
            Quest trackedQuest = QuestMachine.GetQuestJournal().questList.Find(quest => quest.showInTrackHUD);

            print(trackedQuest);

            var quest_content = trackedQuest.GetContentList(QuestContentCategory.HUD);

            print(quest_content);

            var content = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
            content.bodyText = new StringField("Now go find the chest.");
            quest_content.Add(content);

            QuestMachineMessages.RefreshUIs(this);
        }
... the quest body should change, right? But remains the same:

Image

I am using a subclass of UnityUIQuestHUD. Ideally, I would like to do my animations there.

I am doing something wrong? Thanks so much!
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animating HUD when a quest changes

Post by Tony Li »

Hi,

I just added an example scene to the Quest HUD Text Animation post.
SysOp
Posts: 10
Joined: Thu May 09, 2024 7:52 pm

Re: Animating HUD when a quest changes

Post by SysOp »

Seems like I was way off track! That did it, thank you so much!
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animating HUD when a quest changes

Post by Tony Li »

Glad to help!
Post Reply