Page 1 of 1

Changing text speed for piece of text in a node + text in node based on variable value

Posted: Mon Dec 05, 2022 10:23 am
by TomGTD
Hi!

I figured I'd slam two questions into this post instead of posting twice, I hope that's okay.

1. Is it possible to change the text/subtitle speed within a node? Sort of in the same way you can use [em#] to change colour of pieces of text within the node. E.g. if I want someone to give out a long sigh and I want the text "sigh" to play slower than the rest of the text to emphasis it.

2. Can I change a piece of text in a node based on variable values?E.g. Based on relationship with an NPC, I want to change how they adress the Player. E.g. Npc and Player are strangers = Npc adresses Player with Title. Npc and Player are friends = Npc adresses Player by their name.
I'd prefer not to use multiple nodes for it but rather just change the text in the node by some Lua command.

Thank you in advance!

Re: Changing text speed for piece of text in a node + text in node based on variable value

Posted: Mon Dec 05, 2022 11:50 am
by Tony Li
TomGTD wrote: Mon Dec 05, 2022 10:23 am1. Is it possible to change the text/subtitle speed within a node? Sort of in the same way you can use [em#] to change colour of pieces of text within the node. E.g. if I want someone to give out a long sigh and I want the text "sigh" to play slower than the rest of the text to emphasis it.
Here are two ways to control the typewriter speed in the middle of typing a subtitle:

1. Use RPG Maker-style codes in the text such as \. to delay or \> ... \< to show text instantly.

2. Use a bit of scripting such as in the example scene in this post.
TomGTD wrote: Mon Dec 05, 2022 10:23 am2. Can I change a piece of text in a node based on variable values?E.g. Based on relationship with an NPC, I want to change how they adress the Player. E.g. Npc and Player are strangers = Npc adresses Player with Title. Npc and Player are friends = Npc adresses Player by their name.
I'd prefer not to use multiple nodes for it but rather just change the text in the node by some Lua command.
Yes, absolutely. To show the value of a variable, use the [var=variable] markup tag. This is commonly used with the TextInput() sequencer command to ask for the player's name and use that name later, as in this post.) To show the value of any arbitrary C# method, register it with Lua and use the [lua(code)] markup tag. You can also change the text in a script that has an OnConversationLine method.

Re: Changing text speed for piece of text in a node + text in node based on variable value

Posted: Wed Dec 07, 2022 3:32 am
by TomGTD
Thank you.

For the secone one I think maybe I didn't explain well enough, or I misunderstood your reply.
We're using [var=Actor] to display the Player's name but what we want in this case is that the NPC dialogue writes out either the [var=Actor] or a predetermined Title like "Conductor", all based on another variable we call FriendshipPoints that tracks how close friends the NPC and Player are.

So in this instance, a node that says for example "Good morning, ---.", in which we'd like the --- to be replaced with either [var=Actor] or Conductor based on if their friendship is, let's say, above 5 for them to call the Player by their name.

Thank you for your fast replies always!

Re: Changing text speed for piece of text in a node + text in node based on variable value

Posted: Wed Dec 07, 2022 9:21 am
by Tony Li
I recommend using the actor's Display Name for that. Actor fields, such as Display Name, are included in saved games. When the player gains enough friendship points, you can change the Conductor actor's Display Name from "Conductor" to "My good friend Bob the Conductor" or something. In conversations, Variable["Actor"] or Variable["Conversant"] (and thus the [var=Conversant] tag) will be set to the Display Name. Variable["ConversantIndex"] will still be "Conductor" (the sanitized value of the Name field) if you need to access other fields in the actor. (Typically, the conversation's actor is the player and the conversant is the NPC.) (I don't know why I went so parenthesis-crazy in this (paragraph).) :-)
  • Dialogue Text: "Good morning, [var=Conversant]." (Will show conversant's Display Name.)
Alternatively, if you don't want to use Display Name, you can write a C# method that checks friendship points, and register it with Lua. Then use a [lua(code)] tag, such as:
  • Dialogue Text: "Good morning, [lua(GetConversantName())]."

Re: Changing text speed for piece of text in a node + text in node based on variable value

Posted: Wed Dec 07, 2022 10:08 am
by TomGTD
Thank you.

Would this work with random text as well? E.g. if an NPC is tired and I want to write out a Sigh in that case, but not if they're not tired.

Thanks for all the help.

Re: Changing text speed for piece of text in a node + text in node based on variable value

Posted: Wed Dec 07, 2022 12:46 pm
by Tony Li
Hi,

Yes, you could use [lua(code)] tags for that, including the Conditional() Lua function. Example:
  • Dialogue Text: "[lua(Conditional(IsTired(), "*sigh* "))]What can I do for you?"