Player position during the conversation

Announcements, support questions, and discussion for the Dialogue System.
raingame98
Posts: 25
Joined: Thu Dec 28, 2017 6:06 am

Player position during the conversation

Post by raingame98 »

Hey, Tony!

I want my Player to go to some position before the conversation starts. So, I have a NPC who has a ConversationTrigger component. And I can't just set that Conversation should start OnTriggerEnter, because my PC is not on the position. At the beginning my player should go to some point, and then conversation must start. How do I need to resolve this problem? Thank you! Sorry for my English.
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player position during the conversation

Post by Tony Li »

Hi!

Do you want to immediately teleport the PC to the position? Or make the PC walk there?

To immediately teleport the PC, use a MoveTo() sequencer command in the first dialogue entry node.

For example, let's say your NPC is named Adam. You want the PC to teleport to a position one unit in front of Adam. To do this, add an child GameObject to Adam named "In Front Of Adam". Position it one unit in front of Adam, and facing Adam. Assuming the first dialogue entry node is spoken by the NPC, set its Sequence to:

Code: Select all

MoveTo(In Front Of Adam,listener); {{default}}
If you need to make the PC walk to the NPC, it's more complicated. It depends on how your PC is configured to walk. If this is what you require, please let me know how the PC normally moves.
raingame98
Posts: 25
Joined: Thu Dec 28, 2017 6:06 am

Re: Player position during the conversation

Post by raingame98 »

Tony Li wrote: Thu Apr 26, 2018 8:38 am Hi!

Do you want to immediately teleport the PC to the position? Or make the PC walk there?

To immediately teleport the PC, use a MoveTo() sequencer command in the first dialogue entry node.

For example, let's say your NPC is named Adam. You want the PC to teleport to a position one unit in front of Adam. To do this, add an child GameObject to Adam named "In Front Of Adam". Position it one unit in front of Adam, and facing Adam. Assuming the first dialogue entry node is spoken by the NPC, set its Sequence to:

Code: Select all

MoveTo(In Front Of Adam,listener); {{default}}
If you need to make the PC walk to the NPC, it's more complicated. It depends on how your PC is configured to walk. If this is what you require, please let me know how the PC normally moves.
I tried to start conversation by using DialogueManager.StartConversation("ConversationName"); But it doesn't consider conversation's conditions.. :( Any ideas with this way?

PC (2D) moves by transform.Translate(). And there are a lot of computing and raycasting. I don't use any defalut character controllers. My PC moves like ->

There are several tutorials about 2D Character Controller, most thing I took from there.

Best.
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player position during the conversation

Post by Tony Li »

Hi,

Use DialogueManager.StartConversation("ConversationName", playerTransform, npcTransform)

This associates the conversation with the correct GameObjects.
raingame98
Posts: 25
Joined: Thu Dec 28, 2017 6:06 am

Re: Player position during the conversation

Post by raingame98 »

Tony Li wrote: Thu Apr 26, 2018 10:40 am Hi,

Use DialogueManager.StartConversation("ConversationName", playerTransform, npcTransform)

This associates the conversation with the correct GameObjects.
Doesn't work :(

http://prntscr.com/jao7rw
http://prntscr.com/jao8d7
http://prntscr.com/jao8hk
raingame98
Posts: 25
Joined: Thu Dec 28, 2017 6:06 am

Re: Player position during the conversation

Post by raingame98 »

Tony Li wrote: Thu Apr 26, 2018 10:40 am Hi,

Use DialogueManager.StartConversation("ConversationName", playerTransform, npcTransform)

This associates the conversation with the correct GameObjects.
To resolve this problem, I think to write my own "ConversationTrigger". But then, I need Enum of Conversations, Quests, Variables and others in the inspector. Is it possible? For example Spine and FMOD studio let me get Enum of events in animation of Spine and FMOD events: http://prntscr.com/jaoikd
So if it is possible, I can write my own ConversationTrigger and set all conditions and start the conversation when and how I want. But it would be very good, if I just could call method StartConversation and all conditions would be considered.

Now if I call this method, I see the text in Conditions Field: "Last Check: None". When ConversationTrigger start for example by OnTriggerEnter: "Last Check: (true || false)". Applying playerTransform and NpcTransform doesn't help (
raingame98
Posts: 25
Joined: Thu Dec 28, 2017 6:06 am

Re: Player position during the conversation

Post by raingame98 »

Tony Li wrote: Thu Apr 26, 2018 10:40 am Hi,

Use DialogueManager.StartConversation("ConversationName", playerTransform, npcTransform)

This associates the conversation with the correct GameObjects.
I found information about CustomProperties. I am gonna try it. But I still hope to make StartConversation(conversation, PCtrans, NPCtrans) work.
raingame98
Posts: 25
Joined: Thu Dec 28, 2017 6:06 am

Re: Player position during the conversation

Post by raingame98 »

Tony Li wrote: Thu Apr 26, 2018 10:40 am Hi,

Use DialogueManager.StartConversation("ConversationName", playerTransform, npcTransform)

This associates the conversation with the correct GameObjects.
Tried like this: http://prntscr.com/jaopku
Called StartConversation, but the Conversation still does not consider its conditions
raingame98
Posts: 25
Joined: Thu Dec 28, 2017 6:06 am

Re: Player position during the conversation

Post by raingame98 »

I'm still trying to make a custom editor to start conversation. I've made LuaConditionProperty and trying to check conditions (http://prntscr.com/jareen), but I get exception: http://prntscr.com/jarfv0
I can't understand what's wrong.

The interesting thing is - with Variable field there is no any exception. I thought that there is a ConditionWizard (like LuaConditionWizard), but there isn't.
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player position during the conversation

Post by Tony Li »

Hi,

Here are a few notes that should get it working:

1. Conditions are not observed on the START node.

2. The error message "Invoke function call on non function value" means the the Dialogue System did not find a quest named "FirstMeet". Is it perhaps named "First Meet" (with a space) or "firstMeet" or something like that? It's also possible, depending on how your scene is set up, that the quest database isn't fully loaded yet. If this is the case, you can wait until the end of the frame:

Code: Select all

IEnumerator Start()
{
    yield return new WaitForEndOfFrame();
    if (Lua.IsTrue(luaCode)) StartConversation("foo");
}
3.. You can add a Condition variable to your script:

Code: Select all

public class ConversationInstance : MonoBehaviour
{
    public string conversation;
    public Transform actor;
    public Transform conversant;
    public Condition condition;
    
    void Start()
    {
        if (condition.IsTrue(actor)) DialogueManager.StartConversation(conversation, actor, conversant);
    }
}
If you don't want the full Condition, you can use the tag [LuaConditionWizard] to get the Lua wizard:

Code: Select all

[LuaConditionWizard]
public string luaCodel
Post Reply