Hi
I am trying to achieve this:
Have a way to fire off a think-bubble above a given characters head with a comment during and after conversations.
I'm doing this by using Bark UI and a registered function that fires it off.
The function takes 3 parameters.
My problem is that since my registered function can only be activated from the script field, I cannot control the timing of it.
Which I want to. I want to be able to do 2 things:
Fire ThinkBubble above "speaker X" containing text "XXXXX" at "X" seconds after sequence end.
and
Fire ThinkBubble above "speaker X" containing text "XXXXX" at "X" seconds into sequence.
So, I want to be able to fire it both in the middle of a sequence and at the end of conversations/sequences.
I have everything working except the timing bit.
As I understand it, you cannot send messages between the sequence field and the script field - but I see no other way to achieve what I want.
I cannot run my function from the sequence field via sendmessage as I cannot make it work with only a single string parameter.
I cannot use a custom sequencer command as I need to reference objects and other functions outside the Dialogue Manager.
I cannot just use the script field as I see no way to time it precisely with the sequencer (Currently, I have a delay parameter in the function, but this is very awkward to use as I need to manually adjust and test it for every node I use it with).
Time custom script with sequence
Re: Time custom script with sequence
Sequencer commands are a good way to go. Your custom sequencer command can reference two properties:
Because sequencer commands use a simplified syntax without "quotes" surrounding strings, it's not always possible to pass an arbitrary string as a parameter. However, you can set the string in the Script field.
For example, say that during a conversation you want to fire a ThinkBubble above the node's speaker, containing text "This works, right?" at the 3-second mark. So you set the Script and Sequence fields to:
---
Alternatively, you can set up the entire conversation using an interactive sequence editor such as Unity Timeline or SLATE. That's probably more hassle than you want, though.
- speaker: The GameObject that's speaking the line (usually the dialogue entry node's Actor). Or, in the case of a Dialogue System Trigger > Actions > Play Sequence, the GameObject that's assigned to the Play Sequence action.
- listener: The GameObject that's being addressed (usually the dialogue entry node's Conversant).
Because sequencer commands use a simplified syntax without "quotes" surrounding strings, it's not always possible to pass an arbitrary string as a parameter. However, you can set the string in the Script field.
For example, say that during a conversation you want to fire a ThinkBubble above the node's speaker, containing text "This works, right?" at the 3-second mark. So you set the Script and Sequence fields to:
- Script: Variable["ThinkText"] = "This works, right?"
- Sequence: {{default}}; ThinkBubble(speaker)@3
SequencerCommandThinkBubble.cs
Code: Select all
// (Omitted things like using statements for brevity.)
// Syntax: ThinkBubble(actor)
// - where actor is 'speaker', 'listener', or a GameObject name. Defaults to 'speaker' if omitted.
public class SequencerCommandThinkBubble : SequencerCommand
{
void Awake()
{
Transform thinker = GetSubject(0, speaker); // First parameter is thinker name, or 'speaker' if omitted.
string text = DialogueLua.GetVariable("ThinkText");
DialogueManager.BarkString(thinker, text);
Stop();
}
}
Alternatively, you can set up the entire conversation using an interactive sequence editor such as Unity Timeline or SLATE. That's probably more hassle than you want, though.
Re: Time custom script with sequence
Hi
That is a brilliantly simple and effective way to do this.
Setting the text as a variable in the script field and then firing from the sequencer, that is perfect.
A little embarrassed that I didn't think of this myself
That is a brilliantly simple and effective way to do this.
Setting the text as a variable in the script field and then firing from the sequencer, that is perfect.
A little embarrassed that I didn't think of this myself
Re: Time custom script with sequence
Glad to help!