Setting up portraits in a character creator (visual novel)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lostmushroom
Posts: 208
Joined: Mon Jul 01, 2019 1:21 pm

Setting up portraits in a character creator (visual novel)

Post by lostmushroom »

Hey Tony. I'm wondering what is the best way to approach custom player portraits for a VN.

Currently, I've set up my character creator so that the player can scroll through 5 different options for their portrait. I also have a script which sets an int "SelectedPortrait" to 1-5 depending on the portrait selected.

I'm foreseeing some issues when it comes to setting the portraits in dialogue and making sure the correct one shows up. It will also get more complicated when wanting to show different variations - Player_1_Happy, Player_1_Sad, etc.

I know this doesn't work because I just tried it, but is anything along these lines possible using the sequence field? You can probably see what I'm trying to do here.

Sequence: SetPortrait(Player, Player_["SelectedPortrait"]_Happy);

Thanks!
User avatar
Tony Li
Posts: 23151
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting up portraits in a character creator (visual novel)

Post by Tony Li »

Hi,

That's very close. Try:

Code: Select all

SetPortrait(Player, Player_[var=SelectedPortrait]_Happy);
Then put files in Resources folder such as:

Player_Ann_Neutral
Player_Ann_Happy
Player_Ann_Sad
Player_Bob_Neutral
Player_Bob_Happy
Player_Bob_Sad
etc.

Set SelectedPortrait in C# code:

Code: Select all

DialogueLua.SetVariable("SelectedPortrait", "Ann");
Or in Lua (e.g., Script field):

Code: Select all

Variable["SelectedPortrait"] = "Ann";

---

Or, if you prefer to put the portraits in subfolders, you can use (under Resources):

Ann/Player_Neutral
Ann/Player_Happy
Ann/Player_Sad
Bob/Player_Neutral
Bob/Player_Happy
Bob/Player_Sad

And use the sequencer command:

Code: Select all

SetPortrait(Player, [var=SelectedPortrait]/Player_Happy);
lostmushroom
Posts: 208
Joined: Mon Jul 01, 2019 1:21 pm

Re: Setting up portraits in a character creator (visual novel)

Post by lostmushroom »

Hey Tony, thanks! That's working correctly now.

Do you have any advice on the best way to set up the character with the VN template? What I'm aiming for is to have a few lines of narration, then the character creator will open.

The character creator is a UI panel. I tried added a Scene Event to one of the dialogue nodes to open it, which works when playing from the Gameplay Scene, but not from the Start scene - the object is missing. Is there a better way to do this?
User avatar
Tony Li
Posts: 23151
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting up portraits in a character creator (visual novel)

Post by Tony Li »

Hi,

This thread discusses a similar topic. In that thread, the conversation opens an item selection window and waits for the player to select an item. Then the conversation continues and checks what item the player selected.

You can do a similar thing where you use a sequencer command to open the character creation window. When it's done, the character creation window can send a sequencer message to tell the conversation to continue.
lostmushroom
Posts: 208
Joined: Mon Jul 01, 2019 1:21 pm

Re: Setting up portraits in a character creator (visual novel)

Post by lostmushroom »

Hey Tony, thanks! This looks like it will be useful.
User avatar
Tony Li
Posts: 23151
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting up portraits in a character creator (visual novel)

Post by Tony Li »

Glad to help!
Post Reply