Is it better to use BoxColliders or Custom Scripts with Dialogue System

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
AvalonGames
Posts: 10
Joined: Wed Apr 27, 2022 11:01 pm

Is it better to use BoxColliders or Custom Scripts with Dialogue System

Post by AvalonGames »

Hey,

So I've been playing around with the Dialogue System, and I understand that the Triggers provided such as (onTriggerEnter, OnUse etc.) make triggering the dialogue easy and intuitive.

I was wondering if it was beneficial to write my own Custom Collider, for example for my game, instead of using BoxCollider2d I have my own logic in place that finds the nearest gameObj
pic1.png
pic1.png (49.18 KiB) Viewed 184 times
The reason for this is because I found in previous projects BoxColliders can be pretty limiting and I wanted to find a new solution.

In the script I would play the bark or conversation, by calling the StartConversation() or BarkString() function
pic1.png
pic1.png (23.72 KiB) Viewed 184 times
Doing these simple operations seem easy enough. Looking forward though, I realized I might need to account for multiple variables such as LuaConditions, QuestConditions etc.

Sorry for the long explanation, I guess my questions are:

1. )Is there an easy way to check if conditions are passed or failed that I can reference in a script?
2.)Is it just better to use a BoxCollider since it seems there's a lot of dependencies in the Dialogue System that requires the component?

Cheers
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Is it better to use BoxColliders or Custom Scripts with Dialogue System

Post by Tony Li »

Hi,

Nothing in the Dialogue System specifically requires a BoxCollider or BoxCollider2D. The Proximity Selector component and Dialogue System Trigger components that are set to OnTrigger/CollisionEnter/Exit require some kind of collider, of course, but that's because they rely on collisions.

You could add a Dialogue System Trigger to a GameObject (e.g., NPC), set it to OnUse, and set up Conditions and Actions. Then your custom interaction system can use it. Example:

Code: Select all

private void Interact(GameObject player)
{
    foreach (var ds in GetComponent<DialogueSystemTrigger>())
    {
        ds.OnUse(player.transform);
    }
}
AvalonGames
Posts: 10
Joined: Wed Apr 27, 2022 11:01 pm

Re: Is it better to use BoxColliders or Custom Scripts with Dialogue System

Post by AvalonGames »

Man, it's beyond me how you can read through my question and come up with the perfect response.

Thanks man, I appreciate! OnUse really coming in clutch haha :)
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Is it better to use BoxColliders or Custom Scripts with Dialogue System

Post by Tony Li »

Glad to help!
Post Reply