[Solved] Pronoun choice via button click?

All about user interface, be it customizing built-in UIs or adding new ones.
Post Reply
justloveme94
Posts: 25
Joined: 18 Feb 2021 14:26

[Solved] Pronoun choice via button click?

Post by justloveme94 »

Hello all! I apologize if this is the wrong area of the forums. I was currently trying to set up a system where the player could choose their desired pronouns:

She/Her/Hers
He/His/Him
They/Their/Them

I was able to set up a custom prefab with the desired labeled buttons above but was stuck on figuring the best way to go at it from there. Similarly to the player's name, I would just have the desired variable read in the dialogue. For example, Third Person Subjective, Third Person Possessive, Honorific, etc. would change accordingly in the dialogue. I'm pretty sure I'm going to have to create a C# script. I found a similar coded using another application called Fungus. https://github.com/zelgadis/fungus-gendered-terms

Last edited by justloveme94 on 05 Dec 2021 05:55, edited 1 time in total.
idaot
support
Posts: 262
Joined: 01 Aug 2020 08:25

Re: Pronoun choice via button click?

Post by idaot »

You can define and set multiple custom variables values to correspond with the choice taken. Then you can inject the variable value into the naniscript, like {possessivePronoun} becomes his, her or their as an example.

Here is the guide on custom variables: https://naninovel.com/guide/custom-vari ... -variables
If the labeled buttons are found on a UI you can use PlayScript to set the variables by using @set: https://naninovel.com/guide/user-interf ... ity-event

justloveme94
Posts: 25
Joined: 18 Feb 2021 14:26

Re: Pronoun choice via button click?

Post by justloveme94 »

I was looking at the guide regarding the button action but when I place the playscript on the button but it only comes up as monoscript under the function. Secondly, how do I reference the variable I am trying to change? If a player pressed the He/Him, His Button, what would the PlayScript look like? @ThirdPossSubject = he;

justloveme94
Posts: 25
Joined: 18 Feb 2021 14:26

Re: Pronoun choice via button click?

Post by justloveme94 »

I finally figured it out so I will post my solution in case anyone else needs help. Also if anyone finds a more elegant solution...

  1. First create your button...
    PronounFemaleButton
  2. Drag the PlayScript under the NaniNovel scripts to your button
  3. Under On Click( )
    Drag your button and use the drop down to select PlayScript.Play(String)
  4. Under PlayScript component on your button, insert the following:
    @set ThirdPersonPoss="Hers"
    @set ThirdPersonSubject="She"
    @set ThirdPersonObject="Her"
    @set ThirdPersonReflection="Herself"
    @set ThirdPersonPossLower="hers"
    @set ThirdPersonSubjectLower="she"
    @set ThirdPersonObjectLower="her"
    @set ThirdPersonReflectionLower="herself"
    @set Honorific="Ma'am"
  5. Make sure you have added all these new variables under Custom Variables Resources with " "
  6. Make sure your character's dialogue is set to receive the variables
    Ex. I think {ThirdPersonSubjectLower} is a great person.
  7. Repeat for the other type of pronouns
Post Reply