Page 1 of 1

How to open quest journal by script? (Solved, partly)

Posted: Tue Oct 08, 2019 3:06 pm
by nicmar
I suspect this is something very basic, but I can't really find it in the docs. How can I open the quest journal with a script?

I'm using rewired, and I imported the 3rd party support for it, so I have the "InputDeviceManagerRewired.cs" attached to a gameobject.

I have an action called "Quest Journal" which I can trigger, and from another script, I can detect that the keyboard shortcut for it works.

I also have the "Quest Input Device Manager" prefab. Here I wasn't sure what to do, but I added "Quest Journal" under "Key buttons to check", and in "On Use Keyboard" I added UnityUIQuestJournal.Show().

Yet nothing happens. If I can show it by code instead, I can just hook it up to another place where I read Rewired inputs. But do I need to make a reference or is there a static method I can use?

All this work, and then I finally tried making a reference to the questJournal in my player, and bind this to happen when the rewired input is pressed:

Code: Select all

	questJournal.questJournalUI.Show(questJournal);
Is that the proper way to do it? Can I remove all of the other stuff? Since I will have support for joypads too, it would be interesting to know if I can still control it myself, or if I have any use of the "Quest Input Device Manager" prefab. Is it documented somewhere? :)

Re: How to open quest journal by script? (Solved, partly)

Posted: Tue Oct 08, 2019 4:37 pm
by Tony Li
Hi,

To open and close the quest journal, call the QuestJournal component's ShowJournalUI(), HideJournalUI(), or ToggleJournalUI() methods.

If you don't already have a reference to the quest journal, use the static method QuestMachine.GetQuestJournal().

Example:

Code: Select all

QuestMachine.GetQuestJournal().ToggleJournalUI();

Re: How to open quest journal by script? (Solved, partly)

Posted: Tue Oct 08, 2019 5:01 pm
by nicmar
Thanks, it all worked very well, and I don't need to have an inspector assigned reference anymore. :)