Hi there!
I'm adding details to the bark on idle, and I would like to know:
A. How can I hide the current bark? For instance, I want the farmer Npc to conceal the ongoing bark line the moment he gets attacked.
B. How to switch a bark line? For example, the soldier Npc might be saying something cheerful when he's happy, but when he witnesses someone getting killed, he will stop the "Happy Bark" and switch to the "Anxious Bark." Here is my current code, but it's not working.
C. How do you set the duration of a bark? For instance, I want the bark UI to appear for only 3 seconds.
Thanks!
How can I hide the current bark?
Re: How can I hide the current bark?
Hi,
You could set a custom field in the actor and then check that field in the conversation. For example, say you've added a custom Boolean field named "IsInBattle". Set the Conditions of the <Idle> group node to:
and do the same for the <In Combat> group node except check if it's true. Then some example C# code:
If you want to vary the duration for each bark, set Bark Duration to a low, minimum value and tick Wait Until Sequence Ends. Then set the Sequence field for each bark, such as this to delay for 2.5 seconds: Delay(2.5)
Call the bark UI's Hide() method. Example:
Code: Select all
public void OnAttacked()
{
GetComponentInChildren<IBarkUI>().Hide();
}
That code should work, but another option is to set the Conditions fields of your bark conversation so choose the right barks:ds2497 wrote: ↑Sat Jul 22, 2023 1:25 amB. How to switch a bark line? For example, the soldier Npc might be saying something cheerful when he's happy, but when he witnesses someone getting killed, he will stop the "Happy Bark" and switch to the "Anxious Bark." Here is my current code, but it's not working.
You could set a custom field in the actor and then check that field in the conversation. For example, say you've added a custom Boolean field named "IsInBattle". Set the Conditions of the <Idle> group node to:
Code: Select all
Actor["Your_Character"].IsInBattle == false
Code: Select all
public void OnAttacked()
{
GetComponentInChildren<IBarkUI>().Hide();
DialogueLua.SetActorField("Your Character", "IsInBattle", true);
}
Inspect the bark UI and set its Duration to 3.
If you want to vary the duration for each bark, set Bark Duration to a low, minimum value and tick Wait Until Sequence Ends. Then set the Sequence field for each bark, such as this to delay for 2.5 seconds: Delay(2.5)
Re: How can I hide the current bark?
Thank you for your assistance!
I had the "Wait for Continue" option checked, which caused some features to not work as expected. It took me a while to resolve the issue, but everything is functioning correctly now. Thanks again!
I had the "Wait for Continue" option checked, which caused some features to not work as expected. It took me a while to resolve the issue, but everything is functioning correctly now. Thanks again!
Re: How can I hide the current bark?
Glad you got it working!