Player selection

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Pendergast
Posts: 38
Joined: Sun Oct 18, 2020 1:48 pm

Player selection

Post by Pendergast »

Hi there !

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 !
PENDERGAST / NyxNikita
Artist & Writer
Caroline I. Letuppe
🌿 Instagram: https://instagram.com/nyxnikita
🌿 Site officiel: https://nyxnikita.com
🌿 Boutique: https://shop.nyxnikita.com
🌿 Tous mes liens: https://nyxnikita.carrd.co/
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player selection

Post 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]!"
  • Script: Actor["Player"].Display_Name = Variable["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:

Code: Select all

using PixelCrushers;
using PixelCrushers.DialogueSystem;
...
public void SelectRace(string race)
{
    DialogueLua.SetActorField("Player", "Race", race);
    SaveSystem.LoadScene("Race Scene For " + race);
}
User avatar
Pendergast
Posts: 38
Joined: Sun Oct 18, 2020 1:48 pm

Re: Player selection

Post 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 !
PENDERGAST / NyxNikita
Artist & Writer
Caroline I. Letuppe
🌿 Instagram: https://instagram.com/nyxnikita
🌿 Site officiel: https://nyxnikita.com
🌿 Boutique: https://shop.nyxnikita.com
🌿 Tous mes liens: https://nyxnikita.carrd.co/
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player selection

Post 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.
Define a variable in your database.

I put together an example scene:

DS_CharacterCreationExample2_2021-05-13.unitypackage

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.
User avatar
Pendergast
Posts: 38
Joined: Sun Oct 18, 2020 1:48 pm

Re: Player selection

Post 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 :shock:

Thanks !
PENDERGAST / NyxNikita
Artist & Writer
Caroline I. Letuppe
🌿 Instagram: https://instagram.com/nyxnikita
🌿 Site officiel: https://nyxnikita.com
🌿 Boutique: https://shop.nyxnikita.com
🌿 Tous mes liens: https://nyxnikita.carrd.co/
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player selection

Post 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:

Code: Select all

Actor["Player"].Display_Name = Variable["pcName"]
User avatar
Pendergast
Posts: 38
Joined: Sun Oct 18, 2020 1:48 pm

Re: Player selection

Post by Pendergast »

Hi,

Well, i did, that's the thing :shock: 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 :shock:
PENDERGAST / NyxNikita
Artist & Writer
Caroline I. Letuppe
🌿 Instagram: https://instagram.com/nyxnikita
🌿 Site officiel: https://nyxnikita.com
🌿 Boutique: https://shop.nyxnikita.com
🌿 Tous mes liens: https://nyxnikita.carrd.co/
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player selection

Post 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".
User avatar
Pendergast
Posts: 38
Joined: Sun Oct 18, 2020 1:48 pm

Re: Player selection

Post by Pendergast »

I sent the e-mail with the Unity Package !

Thanks for your help !
PENDERGAST / NyxNikita
Artist & Writer
Caroline I. Letuppe
🌿 Instagram: https://instagram.com/nyxnikita
🌿 Site officiel: https://nyxnikita.com
🌿 Boutique: https://shop.nyxnikita.com
🌿 Tous mes liens: https://nyxnikita.carrd.co/
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player selection

Post by Tony Li »

Thanks. I'll keep an eye out for it. I haven't received it yet.
Post Reply