Page 1 of 1

Ink Integration UI

Posted: Sun Jul 05, 2020 1:39 am
by Golden_Gecko
Hi, Tony:

I am using the 'VN Template Standard Dialogue UI' and the Ink integration for my project. I would like to control my portraits inside Ink. Adding [pic=2] in Ink will change the portrait for the conversant, but it has no effect when used on a line said by the actor. Ideally, I would be able to use something like '# SetPortrait(Bob, BobAngry)' to change the portrait for all further frames until changed again. Should this work? I have tried using tags such as # Actor=Boromir or # Conversant=Elrond as shown in the documentation, however, this does not appear to have any effect on my scene (but doesn't show up in the text), which makes me think the 'SetPortrait' command will not work either. I have tried this with the 'Actor Names Precede Lines' box checked and unchecked. I also can't find a way to name my alternate sprites as I saw in one of your other forum responses. They just appear numerically in the inspector (which is where I added the alternative portrait sprites). I feel I'm missing something fundamental with this Integration. Do you have any suggestions for me?

Thanks!

- James

Re: Ink Integration UI

Posted: Sun Jul 05, 2020 8:35 am
by Tony Li
Hi James,

Portraits can come from two sources:

1. If you assign them to the actor in the dialogue database, they're given a number (1, 2, 3, etc.).

2. Otherwise you can add them to a Resources folder and reference them by name (e.g., "BobAngry").


SetPortrait() is a sequencer command. It tells an actor to use a specific portrait. To tell it to use a numbered portrait:

SetPortrait(Bob, pic=2)

To tell it to use a portrait in a Resources folder:

SetPortrait(Bob, BobAngry)

Normally, if you're working entirely in the Dialogue System's Dialogue Editor and not using Ink, you'd specify sequencer commands in the node's Sequence field:
  • Dialogue Text: "Grr, that makes me angry."
  • Sequence: SetPortrait(Bob, BobAngry)
Since you're working in Ink, you'll use the Sequence() external function instead. Something like:

Code: Select all

Bob: Grr, that makes me angry. {Sequence( "SetPortrait(Bob, BobAngry)" )}
Note that I used the "Actor Names Precede Line" format to specify which actor is speaking the line. To confirm which actor is speaking each line, set the Dialogue Manager's Other Settings > Debug Level to Info. This will log a lot of helpful info to the Console window. This line indicates which GameObjects are being associated with the conversation's primary actor and conversant:

Dialogue System: Starting conversation 'Your Ink Story' with actor=XXX and conversant=YYY

This line indicates which actor is speaking each line:

Dialogue System XXX says 'Something.'

Re: Ink Integration UI

Posted: Sun Jul 05, 2020 5:29 pm
by Golden_Gecko
Thanks for your quick reply, Tony.

That was helpful.

I should have specified above that the issue I am having is specifically with changing the Player’s portrait. Changing the NPC’s character can be done by declaring an image for the actor (even though I would expect that to change the Player’s Image.

My scene is simple at the moment and has a cube with a ‘Dialogue Systems ink Trigger (script)’ attached to it with an ‘on start’ trigger. I have elements assigned to the ‘Conversation Actor’ slot and the Conversation Conversant’ slot.
I have the following written in Ink:

Tina: Max! # Actor=Maria
Player: ... # Actor=Tina #Conversant = Tina
Tina: Hay, Wake up! {Sequence( "SetPortrait(Tina,pic=2)" )}
Player: ... {Sequence( "SetPortrait(Max,pic=2 )" )}
Tina: Max! Wake up! # Actor=Maria

The result in unity are as follows (Only the dialogue shows in unity, but I have left the rest in for reference) :

Tina: Max! # Actor=Tina
• The NPC conversant image changes to that of Tina
Player: ... # Actor=Maria #Conversant = Tina
• The NPC conversant image changes to that of Maria. The player (Actor) image remains the same
Tina: Hay, Wake up! {Sequence( "SetPortrait(Tina,pic=2)" )}
• The Conversant image changes to that of Tina, Picture 2
Player: ... {Sequence( "SetPortrait(Player,pic=2 )" )}
• Nothing appears to happen

So I can only get the conversant portrait to change, and I do that by specifying an Actor image.



Another related issue I’m having is that whenever the Player actor is specified to say some text, the player's text will display as a choice rather than as text. This is even true when a choice is made first and the game is printing the text (you have to choose twice). Is there a way to prevent text from appearing as choices unless they are specified as so in ink?


Thanks Tony!

Re: Ink Integration UI

Posted: Sun Jul 05, 2020 5:39 pm
by Tony Li
Hi,

Inspect the Dialogue Manager GameObject. Tick Subtitle Settings > Show PC Subtitle During Line and UNtick Input Settings > Always Force Response Menu.

That may get you at least partly to where you want it to work.

Re: Ink Integration UI

Posted: Wed Jul 08, 2020 6:44 pm
by Golden_Gecko
Thanks, Tony!

I seem to have everything working at the moment.

Just FYI: The documentation says that the integration automatically adds the lines below to the top of the ink files, however, I had to add these manually or else Unity would just use the Ink fallback functions. Just thought you would like to know. Cheers!

EXTERNAL ShowAlert(x) // ShowAlert("message"): Shows an alert message.
EXTERNAL Sequence(x) // Sequence("sequence"): Plays sequencer commands in string x.
EXTERNAL CurrentQuestState(x) // CurrentQuestState("quest"): Returns the current quest state.
EXTERNAL CurrentQuestEntryState(x,y) // CurrentQuestEntryState("quest", entry#): Returns the current quest entry state.
EXTERNAL SetQuestState(x,y) // SetQuestState("quest", "inactive|active|success|failure"): Sets a quest state.
EXTERNAL SetQuestEntryState(x,y,z) // SetQuestEntryState("quest", entry#, "inactive|active|success|failure"): Sets a quest entry state.
EXTERNAL GetBoolVariable(x) // Returns the bool value of Dialogue System variable x.
EXTERNAL GetIntVariable(x) // Returns the int value of Dialogue System variable x.
EXTERNAL GetStringVariable(x) // Returns the string value of Dialogue System variable x.
EXTERNAL SetBoolVariable(x,y) // Sets Dialogue System variable x to value of bool y.
EXTERNAL SetIntVariable(x,y) // Sets Dialogue System variable x to value of int y.
EXTERNAL SetStringVariable(x,y) // Sets Dialogue System variable x to value of string y.

Re: Ink Integration UI

Posted: Wed Jul 08, 2020 6:48 pm
by Tony Li
Thanks! I'll check the docs and fix them.