Original Discord Post by 665kkl | 2024-08-26 15:48:39
Images:
Reply by k3kalinix | 2024-08-26 15:50:39
Hello <@807630326666362931>,
<@679221735458996224> could you please assist?
Reply by 665kkl | 2024-08-26 15:51:19
This is the video. The error at the beginning is a NullReferenceException: Object reference not set to an instance of an object. The error that appears later occurs when I press the action key.
Attachments:
Reply by starboy_24 | 2024-08-27 05:59:15
Hey <@807630326666362931> , this is acknowledged by us already and will be fixed in the next release.
Replying to starboy_24’s Message
Reply by starboy_24 | 2024-08-27 05:59:15
Hey <@807630326666362931> , this is acknowledged by us already and will be fixed in the next release.
Reply by 665kkl | 2024-08-27 07:11:13
Will that affect the usage?
Reply by 665kkl | 2024-08-27 07:11:32
Is there any way to call a trigger? Also, if I want the trigger to initiate a conversation, how should the function be written, or what variables should I check?
Reply by 665kkl | 2024-08-27 07:11:43
Thank you!
Reply by k3kalinix | 2024-08-27 13:52:20
Hello <@807630326666362931> ,
Did you make any changes to the current Convai scripts?
Reply by 665kkl | 2024-08-27 15:22:49
I tried writing a function myself to call the trigger, and in the second picture, the photos send back the conversation between the user and the NPC, turning it into a dialogue. Previously, I also attempted to directly call InvokeSelectedTrigger within the NarrativeDesignTrigger class by passing in the trigger name.
Images:
Replying to 665kkl’s Message
Reply by 665kkl | 2024-08-27 07:11:13
Will that affect the usage?
Reply by starboy_24 | 2024-08-27 15:57:47
No, just when you invoke the trigger (by any unity runtime), it would call it on the appropriate NPC, which has the trigger assigned. Won’t give any error, there are quite a few changes in doing so, you can wait till release, or if you want to do it yourself, you can reference the correct NPC
Replying to starboy_24’s Message
Reply by starboy_24 | 2024-08-27 15:57:47
No, just when you invoke the trigger (by any unity runtime), it would call it on the appropriate NPC, which has the trigger assigned. Won’t give any error, there are quite a few changes in doing so, you can wait till release, or if you want to do it yourself, you can reference the correct NPC
Reply by 665kkl | 2024-08-27 16:09:00
So currently, can triggers only be called using collision, or is there another method? Or can I directly pass the trigger name when calling, like in my function? Also, could you tell me where the variable that confirms the connection status is? I’d like to use it. Thank you!
Replying to 665kkl’s Message
Reply by 665kkl | 2024-08-27 16:09:00
So currently, can triggers only be called using collision, or is there another method? Or can I directly pass the trigger name when calling, like in my function? Also, could you tell me where the variable that confirms the connection status is? I’d like to use it. Thank you!
Reply by starboy_24 | 2024-08-27 16:15:26
You can use the npc to invoke it, like _currentnpc.invoketrigger but it would require exact name. Our design right now is scene specific as it makes more sense to narration to flow that way, but you can call it otherwise.
Reply by starboy_24 | 2024-08-27 16:16:22
I can’t understand which connection or variable you want?
Replying to starboy_24’s Message
Reply by starboy_24 | 2024-08-27 16:16:22
I can’t understand which connection or variable you want?
Reply by 665kkl | 2024-08-27 16:24:12
Sorry, I made a mistake. I don’t need that variable to check the connection status. So, does the trigger have a similar usage? This is what I used before in Inworld. Or, as you mentioned, using _currentnpc.invoketrigger. Do you have a more specific example? Thanks!
Images:
Reply by hiimabiel | 2024-08-27 16:35:05
Hi, I’m just reading all this because I’m trying to do exactly the same!
Reply by hiimabiel | 2024-08-27 16:40:10
<@807630326666362931> I also noticed that in the demo of NPC to NPC the characters start talking to one another without the player needing to talk first. Reading the scripts that control them could be useful.
Reply by k3kalinix | 2024-08-27 16:47:15
Hello <@807630326666362931>, <@328311427980984322>
Please import “InitializeConversation.cs”
Then open NarrativeDesignTrigger, replace the InvokeSelectedTrigger method with this one.
public void InvokeSelectedTrigger()
{
if (convaiNPC != null && availableTriggers != null && selectedTriggerIndex >= 0 && selectedTriggerIndex < availableTriggers.Count)
{
string selectedTriggerName = availableTriggers[selectedTriggerIndex];
ConvaiNPCManager.Instance.SetActiveConvaiNPC(convaiNPC,false);
convaiNPC.TriggerEvent(selectedTriggerName);
Debug.Log($"Triggered {selectedTriggerName} on {convaiNPC.name}");
}
}
Finally, the SetActiveConvaiNPC method of ConvaiNPCManager.cs is replaced with this one.
public void SetActiveConvaiNPC(ConvaiNPC newActiveNPC, bool updateLastHitNPC = true)
{
if (activeConvaiNPC != newActiveNPC)
{
if (activeConvaiNPC != null)
// Deactivate the previous NPC
activeConvaiNPC.isCharacterActive = false;
activeConvaiNPC = newActiveNPC;
if(updateLastHitNPC)
_lastHitNpc = newActiveNPC;
if (newActiveNPC != null)
{
// Activate the new NPC
newActiveNPC.isCharacterActive = true;
Debug.Log($"Active NPC changed to {newActiveNPC.gameObject.name}");
}
OnActiveNPCChanged?.Invoke(newActiveNPC);
}
}
Attachments:
Reply by hiimabiel | 2024-08-27 18:23:51
Hello <@1023671043287699568> thank you so much for the answer and the code! I’ve been adding everything and testing it. It works until this point:
Reply by hiimabiel | 2024-08-27 18:25:16
There seems to be an error with the return client.GetResponse(options);
method under the ConvaiGRPCAPI.cs script. I’m trying to make my NPC have a monologue and then react to when the player talks to him