Page 1 of 1

stopping trigger disable

Posted: Mon Jul 08, 2024 1:15 pm
by glen
Hi there, hope all is well.
I have a very simple noob question even though I have been learning this system for a couple years now already. I want to create a trigger event that when i move close to an npc he just says 'get lost'. This works easily by just putting an audio source in the game, putting a collider to it set with a trigger. I put a dialogue system on trigger enter event to enable to audio component and it works fine. The problem is that upon doing it once the Dialogue System seems to disable / destroy the trigger effect.
I want to do it so the sound is played whenever i go near him, not just once. Is there an easy way for this I am overlooking, sorry been away for awhile and might have forgotten something simple. Any help appreciated

edit: I am using invector too by the way, if there is a generic trigger that works better with that? As far as I know they are using dialogue manager triggers any how.

Re: stopping trigger disable

Posted: Mon Jul 08, 2024 3:40 pm
by Tony Li
Hi,

A Dialogue System Trigger set to OnTriggerEnter should run every time the player enters the trigger collider, not just once. Did you configure something in its Actions section to deactivate the GameObject or disable the Dialogue System Trigger? Or, if you're playing "Get lost" with a conversation, does the conversation's dialogue entry deactivate or disable it?

Re: stopping trigger disable

Posted: Mon Jul 08, 2024 4:06 pm
by glen
it only plays once. Only action I have is to enable the audio source. I did read this in the range trigger notes:
''When OnTriggerExit occurs, the GameObjects are deactivated and components disabled. This component is useful to enable components such as Bark On Idle only when the player enters a trigger collider that represents proximity to the barker. You can also configure UnityEvents to run on enter and exit.''
idk if that's whats happening here?
I will try the trigger with a different game object set up and see if i have the same issue
edit: could it be invector messing with the triggers?

Re: stopping trigger disable

Posted: Mon Jul 08, 2024 4:17 pm
by Tony Li
Ah, if it's only enabling the audio source, then it will only play once (i.e., when it's first enabled). Instead:

1. Keep the audio source component enabled.
2. UNtick its Play On Awake checkbox.
3. Configure the Dialogue System Trigger to call the audio source component's Play method (AudioSource.Play).

Re: stopping trigger disable

Posted: Tue Jul 09, 2024 3:03 pm
by glen
I followed your steps.
It works perfectly.
Thank you
you are a legend

Re: stopping trigger disable

Posted: Tue Jul 09, 2024 3:04 pm
by Tony Li
Happy to help!