Page 1 of 1

Sequencer Command in code

Posted: Wed Nov 07, 2018 7:08 pm
by nathanj
Hi Tony,

I've been looking around on the site but I can't find an answer to this.

I'm trying to have the player LookAt() the NPC when a conversation is started. I could run the command from the sequencer in the dialogue node but since this is a generic camera controller script I would like to have it assigned automatically so I don't need to add it in at every conversation.
I'm trying:

public void OnConversationStart (Transform actor)
{
DialogueManager.PlaySequence(""LookAt(listener))
}

but I get a message saying: "taget is null". Could you tell me how I could feel the transform position of the NPC into that command? Also, this script is on a game object that is a child of the NPC I am trying to get.

Thanks,
Nathan

Re: Sequencer Command in code

Posted: Wed Nov 07, 2018 7:33 pm
by Tony Li
Hi Nathan,

The Dialogue System calls OnConversationStart on both primary participants (actor and conversant), passing it the transform of the other participant. You could bypass the sequencer command and do this:

Code: Select all

void OnConversationStart(Transform other)
{
    transform.LookAt(other);
}
Or you could use the sequencer command like this:

Code: Select all

void OnConversationStart(Transform other)
{
    DialogueManager.PlaySequence("LookAt(listener)", this.transform, other);
}
The second parameter (this.transform) is the "speaker", and the third parameter (other) is the "listener".

Re: Sequencer Command in code

Posted: Wed Nov 07, 2018 7:41 pm
by nathanj
The second worked for me!

Thanks again for the speedy response