I want to know how to use the trigger function.
I want to know how to use the trigger function.
[img]2.png[/img] [img]1.png[/img]
1. I want to know how to use the trigger function.
2. I want to know how ready conversations will run after a certain amount of time during the game.
1. I want to know how to use the trigger function.
2. I want to know how ready conversations will run after a certain amount of time during the game.
- Attachments
-
- 2.png (59.38 KiB) Viewed 1086 times
-
- 1.png (60.29 KiB) Viewed 1086 times
Re: I want to know how to use the trigger function.
Hello,
The dropdown (in your first image) shows the different ways you can configure the Conversation Trigger component to start a conversation. For example, if you set it to OnTriggerEnter then it will start a conversation when Unity's physics system detects a trigger collision. See the NPC named Private Hart in the Feature Demo scene for an example.
The Conversation Trigger will only start the conversation if the Condition section is true or empty. For example, if you only want to start the conversation is a GameObject tagged "Player" enters the trigger, then set Condition > Accepted Tags to "Player".
If you only want to start the conversation if a certain amount of time has passed, this is one way:
1. In the Dialogue Editor window, define a variable. Set its Type to Boolean. Leave its Initial Value at False. Let's say the variable is named "TimePassed".
2. Set the Conversation Trigger's Condition > Lua Conditions to:
3. In your own script, when a certain amount of time has passed, set the variable true:
The dropdown (in your first image) shows the different ways you can configure the Conversation Trigger component to start a conversation. For example, if you set it to OnTriggerEnter then it will start a conversation when Unity's physics system detects a trigger collision. See the NPC named Private Hart in the Feature Demo scene for an example.
The Conversation Trigger will only start the conversation if the Condition section is true or empty. For example, if you only want to start the conversation is a GameObject tagged "Player" enters the trigger, then set Condition > Accepted Tags to "Player".
If you only want to start the conversation if a certain amount of time has passed, this is one way:
1. In the Dialogue Editor window, define a variable. Set its Type to Boolean. Leave its Initial Value at False. Let's say the variable is named "TimePassed".
2. Set the Conversation Trigger's Condition > Lua Conditions to:
Code: Select all
Variable["TimePassed"] == true
Code: Select all
using PixelCrushers.DialogueSystem;
...
DialogueLua.SetVariable("TimePassed", true);
Re: I want to know how to use the trigger function.
I proceeded as described but it is not.
- Attachments
-
- 3.png (37.61 KiB) Viewed 1081 times
Re: I want to know how to use the trigger function.
Hi,
Your Conversation Trigger will attempt to run when its GameObject receives an "OnUse" message. Have you configured your scene so it will receive an "OnUse" message? For example, the Selector or ProximitySelector component can be configured to send "OnUse".
When the Conversation Trigger attempts to run, it will check the Condition. If the Variable["TimePassed"] is true, it will start the conversation. It will also display "True" in the Inspector. If the Variable["TimePassed"] is false, it will display "False" in the Inspector.
If you don't see True or False in the Inspector, this means the Conversation Trigger did not receive an "OnUse" message.
Your Conversation Trigger will attempt to run when its GameObject receives an "OnUse" message. Have you configured your scene so it will receive an "OnUse" message? For example, the Selector or ProximitySelector component can be configured to send "OnUse".
When the Conversation Trigger attempts to run, it will check the Condition. If the Variable["TimePassed"] is true, it will start the conversation. It will also display "True" in the Inspector. If the Variable["TimePassed"] is false, it will display "False" in the Inspector.
If you don't see True or False in the Inspector, this means the Conversation Trigger did not receive an "OnUse" message.
Re: I want to know how to use the trigger function.
When I took the log, I noticed that Timepassed changed from False to true. But I do not know what to set the trigger to.
I hope that the ambassadors that have been prepared will proceed.
I hope that the ambassadors that have been prepared will proceed.
- Attachments
-
- 4.png (20.36 KiB) Viewed 1078 times
Re: I want to know how to use the trigger function.
How do you want the conversation to start?
- When the player uses a Selector to "use" the object? (Set Trigger to OnUse)
- When the scene starts? (Set Trigger to OnStart)
- When a GameObject enters the trigger collider area? (Set Trigger to OnTriggerEnter)
- etc.
Re: I want to know how to use the trigger function.
This is the scene I'm going to make.
1. When you start the game, the characters move around a limited area for about 20 seconds.
2. After 20 seconds, the unconditionally prepared conversation proceeds.
The solution I thought was like this. After a certain amount of time, activate the tricker object in the area and let the player enter the tricker unconditionally. Another way to resolve this is to continue with the inquiry.
1. When you start the game, the characters move around a limited area for about 20 seconds.
2. After 20 seconds, the unconditionally prepared conversation proceeds.
The solution I thought was like this. After a certain amount of time, activate the tricker object in the area and let the player enter the tricker unconditionally. Another way to resolve this is to continue with the inquiry.
Re: I want to know how to use the trigger function.
In this case, you don't need a Condition or a "TimePassed" variable. I recommend setting up a Conversation Trigger with OnUse. Then add a script like this to the same GameObject:
DelayedConversationStart.cs
DelayedConversationStart.cs
Code: Select all
using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;
public class DelayedConversationStart : MonoBehaviour {
public float delay = 20f;
IEnumerator Start() {
yield return new WaitForSeconds(delay);
GetComponent<ConversationTrigger>().OnUse();
}
}
Re: I want to know how to use the trigger function.
Thanks a lot ^ ^ Thanks for your help. We will contact you again if you have any further questions.