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

Announcements, support questions, and discussion for Quest Machine.
Post Reply
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

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

Post 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? :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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();
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

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

Post by nicmar »

Thanks, it all worked very well, and I don't need to have an inspector assigned reference anymore. :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
Post Reply