Page 1 of 1

Trigger a function within a conversation that knows what the interacting gameobjects are

Posted: Thu Jan 07, 2021 3:06 pm
by niskander
Hi all, I just started using this system and I need to do something pretty basic but I can't find any examples for it. Please let me know if I'm missing anything. Here's what I want to do:

When a player selects a certain node in the conversation, I want to trigger a function that knows what the interacting game objects are (actor and conversant).
I've seen how to trigger a C# function from conversation nodes, but I don't see a way of passing the interacting game objects to that function.
I guess I could pass unique IDs and try to get the objects that way, but that seems inefficient and unnecessary since the conversation already knows who the conversant and actor are.

For context: I'm trying to make a simple interaction where a player can interact with an item and choose whether to inspect, take, or leave. (Players and items are spawned dynamically).

Re: Trigger a function within a conversation that knows what the interacting gameobjects are

Posted: Thu Jan 07, 2021 4:35 pm
by Tony Li
Hi,

Your C# method can check DialogueManager.currentActor and currentConversant. Those will correspond to the conversation actor and conversant. Example:

Code: Select all

public void TakeCurrentConversant()
{
    YourInventorySystem.PickUpItem(DialogueManager.currentConversant);
}
You can also check the current dialogue entry's speaker and listener using DialogueManager.currentConversationState.subtitle.speakerInfo and listenerInfo.

Re: Trigger a function within a conversation that knows what the interacting gameobjects are

Posted: Thu Jan 07, 2021 5:30 pm
by niskander
Thanks a lot for the response, that will do!

Re: Trigger a function within a conversation that knows what the interacting gameobjects are

Posted: Thu Jan 07, 2021 7:35 pm
by Tony Li
Happy to help!