How to modify parts of text according to the player's gender?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
TheBullet
Posts: 2
Joined: Mon Aug 22, 2022 6:32 am

How to modify parts of text according to the player's gender?

Post by TheBullet »

I guess this doubt has already been solved in another thread but I have not found it.

For our games we usually use a code similar to this: [Gender: he, she]. If the gender of the player is male then "he" appears, otherwise "she" appears. This allows us to use the same string for both genders.

Is it possible to do something similar using Dialogue System?

I have tried to call to an own function that modifies the text to show in StardardUISubtittlePanel.SetSubtitleTextContent but for some reason that I don't know, I cannot call to our code from the scripts of your asset.

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

Re: How to modify parts of text according to the player's gender?

Post by Tony Li »

Hi,

This post explains one way to do it. This post contains another example.

Alternatively, you can set a Dialogue System variable to the player's gender. For example:

Code: Select all

DialogueLua.SetVariable("playerPronoun", "she");
Then use the [var=variable] tag, such as: "I think [var=playerPronoun] is very nice.".
TheBullet
Posts: 2
Joined: Mon Aug 22, 2022 6:32 am

Re: How to modify parts of text according to the player's gender?

Post by TheBullet »

Thanks! The second example has helped us a lot!
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to modify parts of text according to the player's gender?

Post by Tony Li »

Glad to help!
Post Reply