Page 1 of 2

Problems with getting player input and name change

Posted: Thu Aug 24, 2023 2:31 pm
by LilGames
Hi Tony,
I followed instructions here for getting player input :
https://www.pixelcrushers.com/phpbb/vie ... hp?p=23993

... but it's not working out. The input field appears but if I click the full-screen next button, it just skips ahead. How do I force it to wait for input? (aka: disable the next button for that node only?)
conversation-input.png
conversation-input.png (15.23 KiB) Viewed 667 times
There was also a different way to set up the input where I put the sequence commands into the previous node, but then the text input would appear right away while the text typewriter'd in.

While I'm here, I might as well ask my NEXT question now: I want the input text entered to then replace the Player's Display Name.

Re: Problems with getting player input

Posted: Thu Aug 24, 2023 2:44 pm
by Tony Li
Hi,

Set that node's Sequence to:

Code: Select all

SetContinueMode(false);
TextInput(Text Field UI, Name:, Conversant)
And set the next node's Sequence to:

Code: Select all

{{default}}; SetContinueMode(original)
This will disable the continue button while waiting for TextInput, and the next node will enable the continue button.

Re: Problems with getting player input

Posted: Thu Aug 24, 2023 4:13 pm
by LilGames
Thanks, that sent me down a good path. I changed the script to alter a variable instead and then set the Actor Display Name to that variable. However now the Portrait name stays as the old value UNTIL that conversation is ended and restarted. It's like the Conversant name is cached. Is there a way to update it while in the conversation?

I tried this but the second line doesnt work:

Code: Select all

Actor["Player"].Display_Name = Variable["playerName"];
Conversant = Variable["playerName"]
Tried this too:

Code: Select all

Variable["Conversant"] = Variable["playerName"]
Oh maybe it's the textfield that's set once only on starting the conversation?

Re: Problems with getting player input

Posted: Thu Aug 24, 2023 5:48 pm
by LilGames
I also tried this, but it didn't work:

Code: Select all

ChangeActorName("Player", Variable["playerName"])
(Variation of example found in DiscoverName package conversation)

Re: Problems with getting player input

Posted: Thu Aug 24, 2023 8:01 pm
by Tony Li
ChangeActorName() should do it.

Are there any errors or warnings in the Console window?

Are you sure Variable["playerName"] contains the correct value?

Re: Problems with getting player input

Posted: Fri Aug 25, 2023 5:52 pm
by LilGames
Yes, "playerName" gets the correct value because I can see it in subsequent conversation nodes if I add [var=playerName]. Also the Actor name IS changed internally, as that is displayed correctly in conversation nodes, if I use [var=Conversant].

HOWEVER what is not instantly reflected, like in your Mephistophles demo, is the Portrait name for the conversant. It stays with the original Actor name UNTIL I trigger another conversation after the previous one has finished. The portrait name is not automatically updating.

Re: Problems with getting player input

Posted: Fri Aug 25, 2023 10:08 pm
by Tony Li
In version 2.2.39 and earlier, the portrait name change takes effect the next time the actor shows a subtitle. If your player only shows response menus and not subtitles, it the portrait name won't change.

This patch, which will also be in 2.2.40, changes ChangeActorName() so it updates the portrait name immediately:

DS_ChangeActorNamePatch_2023-08-25.unitypackage

Re: Problems with getting player input

Posted: Sun Aug 27, 2023 5:54 pm
by LilGames
Thank you!

Re: Problems with getting player input

Posted: Sun Aug 27, 2023 8:23 pm
by Tony Li
Glad to help!

Re: Problems with getting player input

Posted: Mon Aug 28, 2023 11:58 am
by LilGames
I'm sorry, there's actually a dependency missing:

Code: Select all

Assets\Plugins\Pixel Crushers\Dialogue System\Scripts\Manager\DialogueSystemController.cs(381,60): error CS0117: 'GameObjectUtility' does not contain a definition for 'FindObjectsByType'