Page 1 of 1

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

Posted: Sun Apr 16, 2023 9:53 pm
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 185 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 185 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

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

Posted: Sun Apr 16, 2023 10:33 pm
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);
    }
}

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

Posted: Sun Apr 16, 2023 10:52 pm
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 :)

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

Posted: Mon Apr 17, 2023 8:04 am
by Tony Li
Glad to help!