Tip:
Highlight text to annotate it
X
Hello and welcome to my second scripting tutorial!
We're going to create our first dialogue. I want to integrate that in a small quest.
We've got our Hans from the last tutorial,
who will spawn in this house, and he's going to ask the player, if we can help him,
because he wants to have a date with Emma. and Emma will sit in hier and
then you can talk to her about the request. Okay, before we can start making a dialogue,
I recommend to search the voicetags of the dialogue npcs.
A voicetag is an identifier of a npc or a speaker,
to connect him with something that is said.
E.g. I can say, that the voicetag
of Hans shall say 'Can you help me?'.
To get the voicetag, we need the script of the npc. By the way, I've added a script
for Emma like in the first tutorial. To get the voicetag of our Hans,
double-click on the entity template and then we get this window,
that you already know. We increase the size of the properties at the bottom right
and there are different tabs and one of them is named 'Voice tags'.
Click on that. We already got some voicetags
but none is connected to an appearance. You could now say,
I want to use the voicetag 'CITIZEN POOR FLOTSAM 01'. For that
you click on the appropriate appearance (that is None) and choose one.
Then your appearance is connected with this voice tag.
But now we've a special npc that is Hans.
And I don't want to use the voicetag 'CITIZEN POOR FLOTSAM 01' for Hans,
because I will forget it over and over
and I will look it up each time.
I take a different way, I' going to create my own voicetag.
Now use with the asset browser to
\globals\scenes. There some arrays and one is scene_voice_tags.
Double-click and now we get many voicetags.
I already created some, your's should start at ADAM PANGRATT.
Now you can create your own voicetags.
I always create new voicetags at the beginnig, I've already created one for Emma.
Right-click -> Insert Row and then you get the first line
and now I insert the voicetag 'Hans'. That could also be a larger notation
like 'Hans our main npc', but I think Hans should be enaugh.
You have to fill in the gender,
although I don't if it has an effect, but CD Project always filled it in.
Also very important is the ID, you've to fill it in always and it must
be unique. So no voicetag may use its ID twice. But I've never chked
wheater I have a interference with the originals.
The id contains four letters and I've never had a collision
with the originals. So I type in HANS as the ID, because it got
four letters and that fits pretty good.
There are also the two columns 'pitch' and template. CD Project never used template,
so I've no idea what that is for. Pitch is changing the pitch.
I think it's a declaration in procent
If you choose one over 100, the pitch speech files will be higher,
like the speaker had taken helium. If the value if below 100,
the voice will be deeper.
So, no we've created our voicetag, save. Now we can close the window.
Now I create new voice tag at be beginning -
that's important! Well, maybe not very important, if you don't use other voicetags
but I've already set a voicetag and the first tag that comes does serve.
Okay, now the voicetag for Hans is missing, so I have to
reopen the file. Now I've reopend the file,
let's get back to the voicetags and now I can also choose HANS. Well, I've created
a new element with 'Insert before', then I select the voicetag HANS and the proper
appearance for that. Save and now HANS wil be use as voicetag.
However, now you can't use CITIZEN POOR FLOTSAM 01 as voicetag anymore,
it just won't work. I could also delete it now,
but I don't like to delete things. :) Save. Now, let's create the dialogue.
I've created a new folder for the quest: date_with_emma.
I've already prepared a dialogue for Emma, but that one is really simple
and I'm going to show you how to create a dialogue with Hans and then you will
understand, how the dialogue from Emma works. Right-click -> Create -> Scene script.
Scenes are dialogues in the redkit. I name it dia_with_hans, very simple.
Double-click and this scene editor will open.
That consists of three main parts that are interesting. At the bottom, there
are the elements, you may know them from the startup-script. You can order them
to control the dialogue's behaviour. It begins throw the Input
and the dialogue will always end, if you get throw the Output.
If I mark one of these elements,
on the top left will be the properties of that element
and on the top right there will be the dialogue itself and its texts.
Okay, now I get to the new dialogue. I've two possibilities to create it -
on the top left there is "Add section", there you can insert a new part of the dialogue, einen links oben ist "Add aection", da kann man einen neuen "Teildialog", also eine Sektion,
called section. Or you can on the bottom right-click into this gray-brown field and do
"Add section", it's the same thing. Now I do it and then something change in the
top right corner. Now you've to give that section a name. It's the begin
of my dialogue, so I will name it Start.
I confirm that with [Return] and then I can begin the dialogue texts.
What is supposed to happen..? First, I have to enter the voicetag of the speaker
The player's voicetag is always Gerald, you can change that as well, but
it's a bit tricky, so I pass that actualy most of the time. Now Gerald shall say...
Oh, I've to write it in English. ^^ "Can I help you?"
And then Hans says... Ah, you can see now, if I would have taken the voicetag 'CITIZEN POOR
FLOTSAM 01', I'd have to search it forever
and then maybe I scroll over it, I don't have to do that now, because we have
the short HANS Voicetag, for this reason I made the voicetag.
Now we can also see exactly, which npc is talking and we don't have to consider,
who is this CITIZEN POOR FLOTSAM 01. Alright, Hans will say: "Can you ask
Emma for a date?" Really simple, you can elaborate the way you want of course.
And now it would be cool,
if the player had a choice. For that you can right-click on the
section's name, "Add Element" and then you can insert different things,
but you will choose the choice most of the time. So, at the end of this section you'll get
choice, you can insert different options for the player.
"Yes, I can do that" or "No, I won't". Well, really simple and now at the bottom
the start element changed. Maybe you can't see your start element at the moment.
That happens relative often, I'm surprised that it worked immediately.
In that case, click into the gray-brown windows and scroll out.
I happens often, I'll show you that, that the dialogue is created anywhere
and then you've just these two elements and you must scroll out and
search and move your dialoge. So, with the left mouse button you can
move this block and scroll in again.
Alright, by now I connect the input with the start, then if the dialogue starts,
the controlflow will flow out of the start into the input. Then these two dialogue lines
will be executed and the player gets this choice.
Well, now I've to create two more sections, on the one hand "Yes", you can really name them
like you want. "Yes, I will" or "No, I won't". Then Hans will be offended and says:
"*** off" and then you've to go.
Now I place these boxes, so that I can connect them in a proper way.
And now you see, you can read them from left to right
like a book. It begins in the input
and flows from the left to the right. It's a bit stupid, when it flows back.
That isn't figured that well,
but you don't have that anyway. Okay. Now I've two possibilities to
end this dialogue. I could connect this "No" with this output,
but I don't do that, because if I end this dialogue
I want two different consequences.
Either you can talk to Emma and ask her for a date or just not.
And you can achieve that on different ways, I create now just two different
output boxes. I select one, I mark it now, and name it "Ask for a date".
Okay, confirm with [Return]. And now I create an other output,
on the bottom in this gray-brown right-click and then output.
I name that one "No date". And then the "No" flows in this output.
Now I can easily comprehend, which option the player took. You'll see that
later on, when I'm going to test this dialogue.
Always save. Saving larger dialogues may last really long,
sometimes I wait for my big dialogues 10-20 seconds until they're saved
and unfortunately you can't do anything in that time.
Unfortunately, the dialogue isn't finished at all. You see, on the top there are
different tabs: Scene script, Starting Conditions, Actors definitions und Dialogset settings.
Now we've to define Hans a additional dialogue partner. I think it's a bit unnessessary,
you already have shown off a voicetag, why do I have to define an actor now?
But it's the way it is. Now right-click -> Add Element.
For once you don't have to add all the gray fields,
just fill them in. HANS is the voicetag. Actor tag, the actor's tag, we've set
that last time, it's hans. We've to set the actor template
with the visual from the npc, the entity template. We've to mark that in the asset browser
and we inser that with the green arrow.
And now it should work. I never used starting conditions,
so you also won't need it now. In the dialogset settings you can check
everything. Sometimes it's recommandable to set a pivot element. That's for
the alignment of the camera, on which npc the camera should be orientated. For that reason
I choose Gerald as the pivot element. Save.
We could also adjust the camera, but I won't do that in this tutorial.
Okay, now I've finished this dialogue.
But it needs to be called. I could do that with the startup script
but I recommend to do it in a clean way.
We've a quest for that, so we're really going to create a quest for that. Let's go into
the "date_with_emma" quest folder, right-click -> Create -> Quest.
How do we call it? Well, "date_with_emma". Double-click and we get into this window,
you know that one from the last tutorial. In the beginning we need complexity management,
start and end. You've done that last time.
Now we've to insert our dialogue and we can do that with
right-click -> Scenes. There are four options for dialogues, but you'll always
use the interaction dialog or the scene.
The difference: The scene always starts immediately and in an interaction dialogue
you've to speak to the npc. I want that, so I'm going to
take the interaction dialog. Then you've to fill in the properties,
at first the actor tags. Something I've forgot:
You don't have to define Gerald as an actor. He'll always be in the dialogue.
For that reason I've just to insert hans.
And the scene, I haven't marked it in the asset browser,
so we select it again and insert it with the green arrow.
Now it also got updated. By the way, if it doesn't get updated, you can
do right-click -> Update to new version.
Okay, now let's say, if I begin this quest I connect it with the interaction dialogue
and then you can talk to Hans and then his dialogue will begin.
Now we can also see, there are two endings
out of this dialogue and I can treat them as I wnat to.
If you get "No date", the quest will be ended. Though if I get "Ask for a date",
then I get another dialogue, that one from Emma.
I've prepared that one already. It is dia_with_emma and
that one is really easy,
she just agrees to the date. Okay, now I connect that with Emma
And when you've talked to her, the quest ends as well.
I just suppose, you don't have to run back zu Hans. You can do all that
but now I just won't for the tutorial.
Okay, save. Now remember the last time:
This quest won't be executed by itself. So, I create an entity template
for this quest (remember the last time): I name it "date_with_emma_entity".
Double-click. Now I do that really fast, just to remind you.
Right-click, you need CQuestComponent. Now you fill in the quest.
Save and that's all. Now you've to insert this entity template
into this startup_layer (just drag it in) and then your quest will be started at once.
And now the best part (or maybe not, if your quest is a bit more complicated)
the testing.
Alright, let's get to Hans and hopefully everything works fine.
I see the display name, that looks good.
Can I help you? Can you ask Emma for a date with me?
Now I've the choice, "No I won't" then we could do nothing, so I take
"Yes I can do that" or "Yes I will". Now you can go to Emma. Ah, now you can see
that I didn't give Emma a displayname, perhaps that's also interesting to see.
Now Gerald asks her, if she wants
to go on a date with Hans and, "Yeah, why not".
Well, I'll show you briefly: We've had an interaction dialogue.
I'm going to change that qucik.
Now I delete the interaction dialogue and create a scene. Now I chooce the dialogue
with hans again in the Asset Browser, click on the green arrow and everything works,
I don't even have to name an actor, for whatever reason.
Okay, now there's also the update. Connect with start and create all
the other connections. Let's save.
Now, when I start the game, the dialogue will start at once.
And now I can choose "No, I won't", then he tells me to "*** off".
Hopefully he moves, yeah, he walks to his hut, very good.
And now I can't talk to Emma neighter.
Alright, that were our first two simple dialogues or your first simple dialogue.
That isn't that much now, I'm going to show you in the next tutorial
how to get more complex dialogues.
At least you have choices and you can connect your elements.
Now you miss e.g. iterations in dialogues. But you get that next time.
I hope you had some fun, you've learnt something and we see us next time. :)