Hi,
I bumped into interesting but troublesome issue. My setup:
1) I have a scene called "Logic" where I hold the Player (named as "Pilot")
2) I have a scene called "Enemies" where I hold the NPC (named as "Geologist")
3) I have a Player in the Logic scene, having a Proximity Selector and Dialogue Actor components
4) I have an NPC in the Enemies scene, having a Dialogue Actor, Dialogue Trigger and Usable components
5) I am passing the Player Transformation via FSM Playmaker script, using "Set Property" and passing the Player's Transform as the "Conversation Conversant" to the NPC's Dialogue Trigger. I am getting this Transform to show up nicely in the inspector (see screenshot)
So, the problem. When I trigger the NPC dialogue with the Use-button, the dialogue starts correctly, but here comes the weird issue: I have the "Conversation Actor" set to be the NPC/Geologist's Dialogue Actor's Transform, and "Conversation Conversant" set to Player Actor's Transform, which I get from another scene with PlayMaker. All looks good, the NPC's Dialogue Actor gets both transforms correctly as the photo shows.
Then, I have set the "Stop Conversation if too far", with value 5 (meters, tried with other numbers too). But what ever I do, the conversation doesn't stop if I walk away from it, much further than 5 meters. The ONLY way so far I have figured out to get it working, is to swap the "Conversation Conversant" and "Conversation Actor" in the NPC's Dialogue Actor. I mean, literally just swap their places: put the Player as the Actor and NPC as the Conversant. Then the "Stop Conversation if too far" starts working. But this is a new issue, because then the dialogue comes from wrong Dialogue Actors, i.e. the Player starts to talk NPC's dialogue and vice versa. All the dialogue is automated/imported from CSV so I wouldn't want to start rearranging anything / make a quick fix; I would need to get it working as in the screenshot. NPC being the Actor and Player being the conversant, but the "Stop if too far" still working. I didn't really find good information how that function should work...Am I doing something incorrectly?
I can repeat this issue. Somehow I'm suspecting, that the Transform I get from cross-scene has to be placed in the ACTOR transform, and not to the CONVERSANT transform. I just don't know why it would matter. Could you help?
Cheers!
Lauri
"Stop Conversation if too far" problem with cross-scene transformations passed with FSM PlayMaker
Re: "Stop Conversation if too far" problem with cross-scene transformations passed with FSM PlayMaker
Hi Lauri,
As you've noticed, the Dialogue System Trigger's "Stop Conversation If Too Far" option monitors the distance between the Conversation Actor and the Dialogue System Trigger itself. (I'll clarify this in the next update's documentation.)
If you want to monitor the distance between any two conversation participants, add this script to one of them:
MonitorConversationDistance.cs
As you've noticed, the Dialogue System Trigger's "Stop Conversation If Too Far" option monitors the distance between the Conversation Actor and the Dialogue System Trigger itself. (I'll clarify this in the next update's documentation.)
If you want to monitor the distance between any two conversation participants, add this script to one of them:
MonitorConversationDistance.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class MonitorConversationDistance : MonoBehaviour
{
public float maxConversationDistance = 5;
private Transform otherParticipant = null;
private void OnConversationStart(Transform other)
{
otherParticipant = other;
}
private void OnConversationEnd(Transform other)
{
otherParticipant = null;
}
private void Update()
{
if (otherParticipant != null && Vector3.Distance(transform.position, otherParticipant.position) > maxConversationDistance)
{
DialogueManager.StopConversation();
}
}
}
Re: "Stop Conversation if too far" problem with cross-scene transformations passed with FSM PlayMaker
Hi Tony,
perfect. This is what I was fighting with and it's now fixed. Great if you can update the manual, at least for me was a bit unclear how the distance measuring works. Thanks a lot!
Cheers,
Lauri
perfect. This is what I was fighting with and it's now fixed. Great if you can update the manual, at least for me was a bit unclear how the distance measuring works. Thanks a lot!
Cheers,
Lauri
Re: "Stop Conversation if too far" problem with cross-scene transformations passed with FSM PlayMaker
Glad to help! I've already staged that additional info in the documentation for the next release.
Re: "Stop Conversation if too far" problem with cross-scene transformations passed with FSM PlayMaker
Great, thanks for updating the documentation, always beneficial.
Still, I am wondering a problem related to my same setup. I started thinking why I even need to pass any transforms of the characters, as there is the "Stop Conversation on Trigger Exit" feature in Dialogue Manager. So I tried to do this:
I have a DialogueSystemTrigger using OnTriggerEnter to trigger a conversation, and it triggers the conversation nicely with my player, who is located in another scene in Unity (loaded additive when Play mode). And everything works without passing any transforms etc. between scenes. BUT when I tick the Stop Conversation On Trigger Exit, nothing happens. The conversation goes on even when running outside of the NPCs trigger.
So why OnTriggerEnter triggers the conversation, but OnTriggerExit selection doesn't do anything? What Am I missing?
Screenshot of my setup attached:
Still, I am wondering a problem related to my same setup. I started thinking why I even need to pass any transforms of the characters, as there is the "Stop Conversation on Trigger Exit" feature in Dialogue Manager. So I tried to do this:
I have a DialogueSystemTrigger using OnTriggerEnter to trigger a conversation, and it triggers the conversation nicely with my player, who is located in another scene in Unity (loaded additive when Play mode). And everything works without passing any transforms etc. between scenes. BUT when I tick the Stop Conversation On Trigger Exit, nothing happens. The conversation goes on even when running outside of the NPCs trigger.
So why OnTriggerEnter triggers the conversation, but OnTriggerExit selection doesn't do anything? What Am I missing?
Screenshot of my setup attached:
Re: "Stop Conversation if too far" problem with cross-scene transformations passed with FSM PlayMaker
...as a further information I made a workaround (for now) with following steps:
1) Added a second Dialogue System Trigger component
2) Marked it to trigger "On Trigger Exit"
3) Registered a new Lua function "StopTalking" (script below)
4) Run this "StopTalking" On the trigger exit.
Seems a bit overkill, as the Dialogue System Trigger has the formal "Stop Conversation On Trigger Exit", but like I wrote on my previous post, that doesn't seem to work for some reason.
My workaround code:
1) Added a second Dialogue System Trigger component
2) Marked it to trigger "On Trigger Exit"
3) Registered a new Lua function "StopTalking" (script below)
4) Run this "StopTalking" On the trigger exit.
Seems a bit overkill, as the Dialogue System Trigger has the formal "Stop Conversation On Trigger Exit", but like I wrote on my previous post, that doesn't seem to work for some reason.
My workaround code:
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class RegisterLuaComponents : MonoBehaviour
{
void OnEnable()
{
Lua.RegisterFunction("StopTalking", this, typeof(RegisterLuaComponents).GetMethod("StopTalking"));
}
void OnDisable()
{
Lua.UnregisterFunction("StopTalking");
}
public void StopTalking()
{
PixelCrushers.DialogueSystem.DialogueManager.StopConversation();
}
}
Re: "Stop Conversation if too far" problem with cross-scene transformations passed with FSM PlayMaker
Hi,
The Dialogue System Trigger's Stop Conversation On Trigger Exit has these requirements:
Dialogue System: Starting conversation 'Title' with actor=X and conversant=Y
The GameObject X or Y must exit the Dialogue System Trigger's trigger collider for Stop Conversation On Trigger Exit to work.
The Dialogue System Trigger's Stop Conversation On Trigger Exit has these requirements:
- The GameObject that is exiting the Dialogue System Trigger's trigger collider must be either of the GameObjects involved in the conversation (actor or conversant).
- At least 0.2 seconds must have passed since the conversation started. (If you're pausing the game during conversations, no time will have passed, so it will not pass this requirement.)
Dialogue System: Starting conversation 'Title' with actor=X and conversant=Y
The GameObject X or Y must exit the Dialogue System Trigger's trigger collider for Stop Conversation On Trigger Exit to work.