HI PixCrushers.
I have a BarkOnIdle script. The NPC barks random calls to barks like: "Get me out of this oven!!". The BarkOnIdle selects conversation nodes set to 'random'. Once out the NPC follows player, and cracks jokes.
I tried to keep the jokes in the same conversation, using a boolean to defeat access to them, but they are still being selected from the BarkOnIdle random anyway. Not sure if this is intended behaviour?
In any case. It would seem cleaner to switch the NPC conversation from within my scripts to new conversation (the one with jokes). I was trying to work out how to do this?
I've passed a reference to the BarkOnIdle in the code in question
[SerializeField] BarkOnIdle barkOnIdle;
I'm looking for something like
barkOnIdle.conversation = DialogueManager.getConversation("NPCJOKES");
Thanks!
....
Script change of conversation
Re: Script change of conversation
Hi,
BarkOnIdle will obey the Conditions you've set on dialogue entry nodes. It's possible that the "Get me out of the oven" nodes' Conditions are still evaluating as true for some reason. At runtime, you can use the Watches tab to check the values that would affect the Conditions.
If you temporarily set the Dialogue Manager's Debug Level to Info, then when the NPC decides what lines to bark it will report the result of evaluating each node's Conditions. For example, in the Dialogue System's DemoScene1, the Enemy NPCs bark randomly from 3 nodes. If Debug Level is set to Info, then the Console will log this:
The "(True)" at the end means that the Conditions evaluated to true, so it's adding the node as a possible random choice. If the Conditions evaluate to false, the log will look something like this:
I recommend using variables (or actor fields) and Conditions if possible because the data is included in saved games. Otherwise, if you manually change the BarkOnIdle component's conversation field, you'll need to remember to change it again when the player saves the game and loads that saved game.
However, if you want to get BarkOnIdle's conversation field, it's just a string that specifies the conversation title. Set it like this:
BarkOnIdle will obey the Conditions you've set on dialogue entry nodes. It's possible that the "Get me out of the oven" nodes' Conditions are still evaluating as true for some reason. At runtime, you can use the Watches tab to check the values that would affect the Conditions.
If you temporarily set the Dialogue Manager's Debug Level to Info, then when the NPC decides what lines to bark it will report the result of evaluating each node's Conditions. For example, in the Dialogue System's DemoScene1, the Enemy NPCs bark randomly from 3 nodes. If Debug Level is set to Info, then the Console will log this:
Code: Select all
Dialogue System: Add Link (Enemy): ID=6:1 'Die!' (True)
Dialogue System: Add Link (Enemy): ID=6:2 'You're going down!' (True)
Dialogue System: Add Link (Enemy): ID=6:3 'He's mine!' (True)
Code: Select all
Dialogue System: Block On False Link (Enemy): ID=6:3 'He's mine!' (False)
However, if you want to get BarkOnIdle's conversation field, it's just a string that specifies the conversation title. Set it like this:
Code: Select all
barkOnIdle.conversation = "NPCJOKES";
-
- Posts: 6
- Joined: Wed May 29, 2019 6:14 am
Re: Script change of conversation
Thanks, Tony
Re: Script change of conversation
You're welcome! If still gives you trouble after the suggestions above, just let me know.