Adding audio event to AI NPC¶
Overview¶
In this tutorial, you learn to allow your configured AI APC to make a specific sound when triggered using the Add audio event to AI NPC assembler. For example, you can have her emit a sound of laughter when her favor score reaches 60%.
Prerequisites¶
-
YAHAHA Studio version 0.3.66 or later
-
An AI NPC, created using the Create an AI NPC assembler and placed in the scene
Set up the assembler¶
-
Find a desired audio clip to play on the AI NPC by going to Collections by YAHAHA>AI Game Jam>Audio in Asset Library and add it to your assets. In our case, we added a laughing sound clip named Female Laugh 02.
-
Find the Add audio event to AI NPC assembler from Asset Library and open it in the scene.
-
In the assembler setup window, populate its basic settings:
a Set the AI NPC to play audio: Select your AI NPC in the scene to trigger the audio event. In our example, we select the AI NPC we created, Mio.b Select the audio file to play: Choose the desired audio clip to play when triggered. We choose the added audio clip from the first step for a laughing sound.c Select the trigger event: Choose one of the following events as a trigger:- Emotion 1-10 represents the AI NPC's favor score, ranging from 10% to 100%. It reflects the NPC's contentment level, with 10 being the least content and 100 being the most content.
- Chat Win indicates that the player wins the chat interaction with the AI NPC.
- Chat Lose indicates when the player loses the chat interaction with the AI NPC.
d Set the trigger event name: Enter a name for the triggered event. For example, if you set the trigger event to Emotion 6 and the event to Laugh, when the NPC's favor score hits 60%, the trigger event fires and the NPC will play a laughing sound. It can anything as long as it is consistent with other trigger-related components. For example, we simply put Emo6. -
Click Assemble to start assembling this assembler. Once done, you can modify their properties in the Properties window.
Edit event-related properties¶
To edit the audio settings, go to the NPC's Properties window by clicking the More button and modify them in the Audio player pane. For more information on audio, see Audio player.
To update trigger event settings, you can modify them in the AiGameEventRelay pane. For more information on this component, see AiGameEventRelay.