I recently purchased an asset and had a question, so I wrote a post.
I wonder if it is right to add a Selector and Usable to each NPC if it is possible to talk between NPCs.
Selector And Usable
Re: Selector And Usable
Hi,
Only add one Selector -- typically on the player.
Add a Usable to every NPC that the player can select with the Selector.
Yes, it's possible to talk between NPCs. Assign the NPCs as the conversation's Actor and Conversant:
(Use Menu > Conversation Properties to access the conversation's Actor and Conversant dropdowns.)
In the Dialogue System Triger, assign the NPC1 and NPC2 GameObjects if present in the scene. In the example below, the Dialogue System Trigger is configured to play the conversation when the player enters the trigger collider:
Only add one Selector -- typically on the player.
Add a Usable to every NPC that the player can select with the Selector.
Yes, it's possible to talk between NPCs. Assign the NPCs as the conversation's Actor and Conversant:
(Use Menu > Conversation Properties to access the conversation's Actor and Conversant dropdowns.)
In the Dialogue System Triger, assign the NPC1 and NPC2 GameObjects if present in the scene. In the example below, the Dialogue System Trigger is configured to play the conversation when the player enters the trigger collider:
Re: Selector And Usable
Thank you for your kind reply.
I have another question.
1. Is it possible to dynamically set the NPC object that initiates a conversation when talking between NPCs as a script in-game?
2. I want to give a condition on which text to output as a script during conversation. Is there any document I can refer to?
I have another question.
1. Is it possible to dynamically set the NPC object that initiates a conversation when talking between NPCs as a script in-game?
2. I want to give a condition on which text to output as a script during conversation. Is there any document I can refer to?
Re: Selector And Usable
Thank you for your kind reply.
I have another question.
1. Is it possible to dynamically set the NPC object that initiates a conversation when talking between NPCs as a script in-game?
2. I want to give a condition on which text to output as a script during conversation. Is there any document I can refer to?
I have another question.
1. Is it possible to dynamically set the NPC object that initiates a conversation when talking between NPCs as a script in-game?
2. I want to give a condition on which text to output as a script during conversation. Is there any document I can refer to?
Re: Selector And Usable
Hi,
1. Register your C# script method with Lua. (See: Registering Functions) Then use the [lua(code)] markup tag. Example:
Yes, you can specify the conversation actor and conversant GameObjects in DialogueManager.StartConversation(). I recommend adding Dialogue Actor components to these GameObjects and setting their Actor dropdowns. Helpful info: Character GameObject Assignments (recommended to read).
If I understand correctly, here are two ways to use a script to show dialogue text:
1. Register your C# script method with Lua. (See: Registering Functions) Then use the [lua(code)] markup tag. Example:
- Dialogue Text: "Good morning, listeners! The weather is going to be [lua(GetWeatherReport())] today."
Code: Select all
void OnConversationLine(Subtitle subtitle)
{
// Replace the string "{weather}" with the value of the GetWeatherReport() method:
subtitle.formattedText.text = subtitle.formattedText.text.Replace("{weather}", GetWeatherReport());
}