Calling scene objects and functions in Sequence

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Aldurroth
Posts: 43
Joined: Wed Jul 20, 2022 8:44 pm

Calling scene objects and functions in Sequence

Post by Aldurroth »

Hay there, I have some scripts I need to turn off and on located on my Player that travels from level to level. Using the Sequence commands I need to turn on and off a "cutscene AI" script and a Navmesh Agent component. What command would be used for this?
User avatar
Tony Li
Posts: 22133
Joined: Thu Jul 18, 2013 1:27 pm

Re: Calling scene objects and functions in Sequence

Post by Tony Li »

Hi,

You can do this with the SetEnabled() sequencer command. Example. assuming your player is named "Player":

Code: Select all

SetEnabled(NavMeshAgent, false, Player)
Or, if the player is a dialogue entry node's speaker:

Code: Select all

SetEnabled(NavMeshAgent, false, speaker)
(Use "listener" if the player is the node's listener.)

Or you can add a Dialogue Actor component to your player. Use it to associate it with an actor in your dialogue database such as "Player". Conversations that involve the Player actor as the primary actor or conversant will send OnConversationStart & OnConversation events to the player GameObject. So, in this case, you can add a Dialogue System Events component to the player GameObject to disable and re-enable components as described in the Interaction Tutorial.
Post Reply