Hello,
I am trying to start a conversation at trigger enter, and would like to turn into a "Use" type of trigger after the conversation is over. In the past I was doing this by disabling the conversation component and enabling another one, or by entirely adding another invisible game object that would have a different type.
However, I am wondering if there is an easier way of just switching the trigger type within Lua or Sequencer commands. I have not come across such a command yet.
Thank you for any pointers.
Changing Trigger Type Through Sequence Commands
Re: Changing Trigger Type Through Sequence Commands
Hi,
What about using the OnExecute() event like this:
What about using the OnExecute() event like this:
Re: Changing Trigger Type Through Sequence Commands
So OnExecute() is used to call an event for any given game object? If I am using the .enabled function, does it pretty much do the same thing as SetComponent Enabled/Disabled action?
Is there a way to to access the trigger type and change that from trigger enter to use?
Is there a way to to access the trigger type and change that from trigger enter to use?
Re: Changing Trigger Type Through Sequence Commands
Yes. Set Component Enabled/Disabled would have been a better suggestion, which I presume is what you mentioned you were using in your first post.
Not without a little scripting. I went with OnExecute() because I wanted to check if the inspector picked up the trigger type. It's just an enum variable, so I'm surprised the inspector didn't expose it to OnExecute(). Anyway, since I already had the OnExecute() section open, that's why I used it in the screenshot above instead of Set Component Enabled/Disabled.
You could add a small script like this to the same GameObject, and set OnExecute() to call SetTriggerType.SetToOnUse or SetTriggerType.SetToOnTriggerEnter:
SetTriggerType.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
[RequireComponent(typeof(DialogueSystemTrigger))]
public class SetTriggerType : MonoBehaviour
{
public void SetToOnUse()
{
SetTo(DialogueSystemTriggerEvent.OnUse);
}
public void SetToOnTriggerEnter()
{
SetTo(DialogueSystemTriggerEvent.OnUse);
}
public void SetTo(DialogueSystemTriggerEvent trigger)
{
GetComponent<DialogueSystemTrigger>().trigger = trigger;
}
}
Re: Changing Trigger Type Through Sequence Commands
You're welcome!