So, here i am again, with some questions as i am really new to unity, and as i want to work with your awesome asset !
I am trying to do a player selection scene, but i'm a little bit lost about how to proceed, and most importantly, how to make it dialogue system friendly.
Since Dialogue System manage the characters name, is it possible tu let the player choose its name ?
Also, how should i proceed to create a character selection system ?
But, for exemple, what i want to do is to let the player swap few cards from left to right (il the order they want). When they click on a card, it let them choose a character. I don't know how to tell to unity "if the player has clicked on this card, then, he's [character race] and his story begin in the [Race Scene 2].
I am sorry if i'm not enough clear, i am a little bit lost, and i don't know what can i do with dialogue system about it
Thanks !
Re: Player selection
Posted: Sat Feb 20, 2021 1:54 pm
by Tony Li
Hi Caroline,
Pendergast wrote: ↑Sat Feb 20, 2021 1:12 pmSince Dialogue System manage the characters name, is it possible to let the player choose its name ?
Yes. Store the name in the Player actor's "Display Name" field. If you want to ask the player to choose a name in a Dialogue System conversation, you can use the TextInput() sequencer command. If you use TextInput(), it will store the player's input in a variable. In the next dialogue entry node, you can assign that variable value to the actor's Display Name field. Example:
Node 1:
Dialogue Text: "What's your name?"
Sequence: TextInput(Text Field UI, Name:, playerName)
Node 2:
Dialogue Text: "Nice to meet you, [var=playerName]!"
Pendergast wrote: ↑Sat Feb 20, 2021 1:12 pmAlso, how should i proceed to create a character selection system ?
But, for exemple, what i want to do is to let the player swap few cards from left to right (il the order they want). When they click on a card, it let them choose a character. I don't know how to tell to unity "if the player has clicked on this card, then, he's [character race] and his story begin in the [Race Scene 2].
The cards sound like something that you should handle outside of the Dialogue System.
After the player has clicked a card, you can set the race value in a custom field of the Dialogue System's "Player" actor. Example C# code:
using PixelCrushers;
using PixelCrushers.DialogueSystem;
...
public void SelectRace(string race)
{
DialogueLua.SetActorField("Player", "Race", race);
SaveSystem.LoadScene("Race Scene For " + race);
}
Re: Player selection
Posted: Thu May 13, 2021 6:00 pm
by Pendergast
Thank you so much, Tony !
I have a little question and it should be perfect !
When the text input shows up, there's already a "Name" in it. Where can i change the default name ?
Also, i can write into the text input, but whenever i accept the change and call for the variable of the player's name, it displays the "default" name.
Thanks !
Re: Player selection
Posted: Thu May 13, 2021 11:12 pm
by Tony Li
Hi,
Pendergast wrote: ↑Thu May 13, 2021 6:00 pmWhen the text input shows up, there's already a "Name" in it. Where can i change the default name ?
Also, i can write into the text input, but whenever i accept the change and call for the variable of the player's name, it displays the "default" name.
In the example scene's database, I added a variable named "pcName" and set its Initial Value to "Pendergast".
You can examine the conversation's Sequence, Conditions, and Script fields to see how they work. See also the [var=pcName] tag in the conversation's Dialogue Text.
Re: Player selection
Posted: Fri May 14, 2021 9:46 am
by Pendergast
Thanks a lot, Tony !
The default name is working, but even if i change it or select it as my name, it shows something else, i don't understand why.
I recorded to show what happen ; and what i writed in the script and condition fields.
What's weird, is that i don't recall enter "nil" anywhere in my project
Thanks !
Re: Player selection
Posted: Fri May 14, 2021 11:10 am
by Tony Li
Hi,
"nil" means "no value". The player's Display Name field is probably not set to a value.
Please look at the example scene in my previous reply.
The TextInput() sequencer command stores the player's input in a variable named pcName.
The next node's Script field then copies this value to the Player actor's Display Name field, using this code:
Well, i did, that's the thing I opened, i copied and past the line of code, but it doesn't change the fact that it doesn't want to store the variable pcName when entered in the game and i don't know why ! I checked and i use the same variable name everywhere, it's weird
Re: Player selection
Posted: Fri May 14, 2021 11:30 am
by Tony Li
Hi,
Would you please send a copy of your scene and dialogue database to tony (at) pixelcrushers.com? The easiest way is to select both in the Project view. (Ctrl+click to select multiple files.) Then right-click and select "Export package".
Re: Player selection
Posted: Fri May 14, 2021 1:51 pm
by Pendergast
I sent the e-mail with the Unity Package !
Thanks for your help !
Re: Player selection
Posted: Fri May 14, 2021 1:58 pm
by Tony Li
Thanks. I'll keep an eye out for it. I haven't received it yet.