How to Change and Store Player Name And Call it in text

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SKaru
Posts: 2
Joined: Sun Dec 25, 2022 7:27 am

How to Change and Store Player Name And Call it in text

Post by SKaru »

Hello, sorry for asking this as I feel like this is a rather simple question. I'm trying to create a visual novel and it seems like i'm getting stuck right at the start. I've watched the tutorials and googled around for an answer, but I can't find anything solid to implement in my code. I'm trying to give the player an opportunity at the start of the game to enter in a name (I'm using a text input sequence within a line of dialogue)
textinput.PNG
textinput.PNG (21.65 KiB) Viewed 187 times
This is what my dialogue entry for this line looks like, with the text input sequence and the script.
I'm unsure if how I have it currently formatted is working or not since I can't see what the player name is in runtime. In addition to this, I'm hoping that I can call the player name in the following message and have it change depending on what the user inputs, but I don't know how to go about doing that. And will I need to save this input name to some secondary script or variable to make it persistent or will this keep it permanently updated? If anyone could provide insight I would greatly appreciate it, sorry for the nooby question, but thanks for your time.
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to Change and Store Player Name And Call it in text

Post by Tony Li »

Hi,

Please see: How To: Read Input From Player During Conversations

This will store the player's name in the Dialogue System's Actor[] table. The Actor[] table is included in saved games if you use the save system.
SKaru
Posts: 2
Joined: Sun Dec 25, 2022 7:27 am

Re: How to Change and Store Player Name And Call it in text

Post by SKaru »

Hello, thank you very much for your reply, I really appreciate it. I tried following the advice in the link however I was still running into issues where the PlayerName variable wasn't saving for some reason even upon text entry. I compared all of the settings between my file and the example scene listed in the link but for some reason mine wasn't working and the example scene was. I'll look into it a bit more but since I'm right at the start I'll probably restart and test until I can get it working.

One issue i'm having though still is:
error when trying to change name.PNG
error when trying to change name.PNG (7.21 KiB) Viewed 181 times

I got this when trying to use this example code that was given:
example code given.PNG
example code given.PNG (11.97 KiB) Viewed 181 times
if you have any idea why I'm receiving this error any assistance would be greatly appreciated. Sorry for bothering you, but thank you very much for your assistance. I hope you're having a great holiday season.
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to Change and Store Player Name And Call it in text

Post by Tony Li »

Hi,

Regarding the ChangeActorName() warning, that was a typo in the HOWTO article. I just fixed it. ChangeActorName() should be in the Script field.
Post Reply