How To Make Quests/Dialogues in UE5 - Narrative 3 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
heard any rumors you guys must know something I have not I heard Rick smells shut up Larry games with cinematic dialogue lip sync photo realistic humans and non-linear quests were basically only available to massive Studios with millions of dollars to spend on their game I spent five years building narrative three to change that and this guide is going to take you from a total beginner with narrative and give you the skills to make any Mission or dialogue you can think of we're going to start with the boring old third person template project enable narrative import some metahumans learn to use the quest and dialogue editors and even record our own facial animations by the end of this tutorial you will know how to make any Quest or dialogue you can dream of this video is 90 minutes long because it covers every single piece of narrative but here's a quest we'll make during the guide in about 15 minutes do you need any help I'm not doing so well there's a wall coming and we don't have any weapons can I help would you will need a sword and a shield to defend the castle you'll learn useful techniques like starting a quest when a given dialogue option is selected or having an NPC's dialogue lines change depending on a condition like whether we currently have a quiz going with them found the weapons sorry I haven't found the weapons yet we'll also show you how to use non-sinematic dialogue we'll use some of that to get our player to say things as he moves through the quest I should bring those weapons back to Rick how's the quest coming along you found the weapons I sure have we'll cover adding your own reward systems or even having a dialogue line show up after you've completed someone's Quest hey could I get a reward for helping you earlier sure thing here you go we'll show you much much more too like adding a custom event for running some code when a dialog line plays or adding custom events to do things like opening a Trader's shop if you ask to see it or making custom conditions so dialogue lines only show up if we have a certain item or a high enough speech level whatever condition you can think of we'll even show you how to use narrative save feature to save the player's quest to dialogue to disk and even how to use narrative's built-in multiplayer functionality if you have a game with multiplayer I'll even show you how to use chat GPT to generate dialogue using AI to follow this tutorial you will need to buy a narrative and I understand it is an expensive plugin for some people and so if you're unsure feel free to check out the free demo we have also check out our Discord there's over a thousand customers in there helping each other out with narrative and we have almost a five star average review on the marketplace but if you're still unsure if narrative ends up not working for your game feel free to email me and I will issue you a refund because I really do stand behind this plugin but with that being said I really hope you try it and let's begin once you do purchase narrative you'll have the open and launcher option so go ahead and click on that and then when that does open up in the epic games launcher just click on install the engine and then click the drop down and select 5.2 because we're going to be using Unreal Engine 5.2 today and then just click install once you've installed narrative we're going to be using Unreal Engine 5.2 today so go ahead and open that up once it opens up go to games and then go to the third person template and then I'm just going to call mine narrative tutorial and then you can click on create all right so here inside of our third person narrative project and we're going to come up to edit plugins and under question dialog you can see narrative three here just make sure that that is enabled so we're going to start off with the dialogue I've made this fold the narrative animated dialogues folder and I'm going to put my first dialogue inside of this so we're going to go to narrative and add our very first dialog and I generally like to use the underscore and then the name of the dialog so in this case I'm going to call it rick because I'm going to call my character red so we'll open up our Rick dialog and it's important to remember dialog blueprints are just like any other blueprint you've ever used the only difference is they also come with this dialogue editor window here kind of like our widget blueprint is just a blueprint but it comes with a UI designer dialogue blueprints just come with a dialogue designer in them as well and so if you go to class defaults you can see all of these speakers there's always a player the player doesn't have to talk but the player is always there but then there's the speakers array and you can add as many different speakers as you like and by default there's just one so far called Rick because that's he gets added by default um and if you go to node color you can change the color which is quite useful if you have a lot of speakers it just helps you tell them apart a bit more easily now another little trick is generally I think it's a good idea to leave the first node empty and I'll explain why later but um generally empty nodes just get skipped over um but I'll explain more later about why you want to leave the root one empty but we'll add another dialog line for Rick and we'll just say hi I am Rick and we'll compile and Save it's going to warn us that we're missing audio that's fine you can actually turn that off too if you like you can go to edit project settings and you can turn the warnings off by going to narrative dialogues editor and just turn off worn missing sound cues and now if we compile you can see it doesn't give us a warning so how do we actually try out that dialogue we've made well to try it out it's really easy we need to actually do a little bit of boring boilerplate stuff but not too difficult we're just going to go to the third person blueprints folder and go to blueprint blueprint class and click on player controller we just have to add a player controller really quickly because the third person project doesn't come with one open up the game mode and then under player controller just select that narrative one I just made and now we'll open up our player controller and generally you want to put your narrative component on your player controller this is because if you get into a car or you know you change your Pawn that you're playing as you want to keep all your quests and stuff valid right they should probably be on the controller so generally speaking you want to put narrative on your player controller and let's go to the event graph and we can actually try this out right away we can try our dialogue out that we made by just dragging narrative in and typing begin dialogue that's all you have to do and then just select your dialogue and this will begin our dialogue now the problem is by default there's obviously no UI on the screen but narrative does actually come with some UI so what I'm going to do is I'm going to add the narrative UI to the screen so just go to create widget you'll only have to do all this once this is just kind of boring setup stuff and select narrative default UI plug in the narrative component and add the UI to the screen like this add to viewport and just hook that up and that's all you have to do very simple compile and save and now if you hit play it should begin our dialogue and you can see it does it says hi I'm brick you'll notice it actually points the camera at our player when Rex talking and that's because there's no Rick in the level right a narrative doesn't know how to point the camera at but we'll fix that in a second so let's go back into our Rick dialog we'll open it back up and I want to just show you how to add options for the player so if an NPC talks like wreck is an NPC the player can say something back to him so if we add a player response we can say how are you wreck compile and save hit play we have the option to say how are you Rick and so again it's just pointing the camera at our player but you'll see when we actually add Rick to the level it's going to change and you can see it says my desktop name there we can change that as well all right so let's actually put a character in the level that represents Rick right because Rex just not even in the level it doesn't really make any sense so we're going to go to third person Blueprints and we're going to add a blueprint class actor and I'm going to call it BP underscore dialogue trigger because it's going to be kind of a trigger when you walk up to it it's going to trigger the dialogue to start so we'll go to components and add a sphere Collision and we'll make it I don't know 150 and we want it so that when the player walks into the sphere it begins the dialogue and to do that we can go down to Collision presets I'm just going to go to overlap only Pawn and then I'm going to go to on component begin overlap I'm going to take the other actor and cast it to a third person character and in fact we don't even need to do that a narrative you can just do get narrative component from Target basically given an actor it'll grab that narrative component for us it does all the heavy lifting and then you can literally just do begin dialogue so it's pretty straightforward you could grab the controller and get the narrative component but this is a nice little helper function and then we'll just hit Rec and that's it really simple the last thing I'm going to do is I'll add a character for rec right so I'm going to go to add skeletal mesh and we will go to the mesh asset and select many and we're just going to go to the rotate tool and make sure that Manny is facing forwards you can see down here the x is the forward Direction so we want them to face that direction and then animation mode asset and then we're just going to do idle so just put a nice little animation on them and that's pretty much it if we compile and save that trigger and then put that in the world and then open our controller back up and just get rid of that begin dialogue and compile and Save when I hit play let's try it out if we walk up to our trigger you can see it begins the dialogue hi I'm Rick I could say how are you Rick and now it actually works the other thing I'll do is I open that dialog trigger up go to the event graph right click on dialogue and make it a variable and then click the little I there and what that'll let you do is if you make any dialogues in the future you'll be able to select the dialogue you actually want to play so let's go back into our Rick dialog and I'll just show you the basics of the dialogue editor it's pretty simple to use so let's add another player response we'll say uh heard any rumors and we'll add another one goodbye and you can see this is really easy to use feel free to explore and add whatever dialogue you want here I'm just going to say hurt any rumors uh I have not I can't think of anything funny for him to say and then how are you Rick we'll just say I'm just swell partner I guess he's a southerner and the next thing we're gonna do is well we could try that out but I want to show you a cool little technique you can do here so if I hold alt and click I can actually disconnect the pins here and I'm going to use another empty node and you'll you'll see here why these empty nodes are quite useful so if we add a line for rec and leave it empty what we can do here we'll just show you this you can actually add something called a backlink and so if I backlink like that if I ask any of these it'll come back here and then I'll be able to choose these options again I'll hook that one up too so let me show you what I mean here this is quite useful because in a game often you want to be able to ask multiple different questions so it says hi I'm Rick how are you Rick I'm just swell partner and you can see I can ask the questions again you'll also notice it says Reuben blade like it says a really ugly name if you're playing a multiplayer game it'll actually say your username it's because I'm playing this in the editor that it gives me that bad name but I do want to show you how to change that if you don't like that what you can do is stop the simulation go to plugins narrative content narrative UI widgets open the default UI up and we're just going to modify it just go into the graph and there's this function get player name you can see it just grabs your username but if you wanted to hard code it like say your character's name was Rubes for example you could just put in groups if you compile and save it will save ribs now if I go up and talk to the other character you can see it says ribs now and this is really good to know you can actually change a lot of the stuff in the UI if you come into the designer you can change the layout of the UI you can change the code completely change how it works if you want you can even copy the code and use it for your own UI if you want to modify it the UI is pretty simple to change especially if you're just changing like colors and things like that you'll notice that narrative knows to aim the camera at this guy it knows that this is Rick that's because when we begin the dialogue it asks for a default NPC Avatar and by default it just plugs in self and narrative knows that there's a skeletal mesh and it knows that the skeletal mission is a hid and it aims at the head and so that's how it's aiming the camera so far things get a little bit trickier when we add multiple speakers so I want to explain how that works if I open up Rick I might add another character if I get a class defaults I can add another character right if I click add to speakers I can add another character called for example Larry and I'm going to give Larry a different color I'm going to make him green and now you can see if I drag out you can add a dialog line for Rick or Larry right you can choose any of your speakers and so um if I say I heard any rumors let's disconnect this one so Rex is I have not let's drag out and we'll add a line for Larry and we'll say I have I heard I heard Rick smells and then we'll add a line for rec we'll be like shut up Larry and then we can add our backlink again I had to mention this because I finished recording this video and I remember I didn't mention this but you can actually use chat GPT to generate dialogue so if I say uh generate a conversation between two characters Rick and Larry so church if it is giving me an absurd but this is so much dialogue so you could tell chat GPT can you make it more short and it will do that for you but let's just copy and paste this so narrative actually supports writing your dialogue in a text file and then you can paste it right in so I'm going to copy this all you have to do is have the character's name and then a colon and then what they're saying so that's the format narrative text and that's how chat GPT actually gives you dialogues if I copy that and paste it in look at that I do have to sort of drag this out a little bit because I think there's so much content here but you can see that you can generally paste these massive bits of dialogue right in from chat GPT it's just brought this right into the editor so you can create a lot of dialogue really quickly if you want to if we compile and save the problem is there's just one character right we need multiple different characters and there's a couple of ways to do that option number one is you can go into the class defaults here and you can select an avatar class and tell it where it should be and narrative will spawn the Avatar in and it will aim the camera at the Avatar that's a little bit more annoying to have to do so let me show you the simpler way I'm going to open that dialogue trigger up and I will literally just copy that skeletal mesh and we'll add another blueprint actor this time I'm going to call this BP underscore dialogue Avatar now we're just going to come in here and we're going to paste that mission so a dialogue Avatar is literally just a mish that's it and if we put one of them in the level here in fact we're going to need two of them because there's Rick and Larry two different characters and one of those I'll open my dialog trigger back up and we can get rid of that mesh we don't need it anymore so the easiest way to do it is if you already have your characters in the level then you can go to tags and add a tag and literally just add the tag wreck and then for the other one I'll add the tag Larry and this is how narrative knows who to aim the camera at right and so if I try this out now this should actually work fine so we'll run up to our dialog trigger hi I'm Rick we say I heard any rumors I have not and then Larry is going to say I have I heard Rick smells shut up Larry and so this is quite an easy way to do it and you can color the characters um differently as well if you go into your dialogue Avatar we'll go to the construction script drag our mission we will create a dynamic material instance and we will promote it to a variable we'll say body mat and then we will sit Victor parameter value and then simply type intent right click on value and we'll rename that to body color and click the little I here compile save and now what you should be able to do is actually click on your characters and you can give them different colors right so I could make one of them red and I can make one of them blue and obviously in a real game you could give them different meshes or different art this is just a really basic example right and so we call this process linking right narrative needs to know which Avatar to aim the camera at and what are the ways of linking the right speaker up to their correct avatars by using these tags but you can also do it by having narratives spawn them in I am going to show you how to do it the other way as well so we'll right click on dialogue Avatar and we'll make a child so we'll say dialogue Avatar underscore Rec and I'm just going to copy that color and just paste it in here so we've got Rick now as his own blueprint and if we come into the dialog click on class defaults and go to rec under speaker Avatar class search for Rick and then select that as his dialog Avatar and now I'm going to copy his location and under speaker Avatar transform I'm going to paste that in same thing for his rotation come in here and we'll set his rotation as well if we compile and save we can now get rid of his character from the level and what narrative will do is it'll spawn it in for us and it will clean it up when the dialog finishes so check us out if I run up to him you can see it spawns his character and points it at him if I end the dialogue it will despawn his character and this is really useful because sometimes you do want dialogues to just be instanced and be managed for you by narrative you don't necessarily want your characters already in the level all the time so there's a couple of different ways to do it all right so I'm going to put Rick back on the level I'm going to undo what I did come back into my dialogue and I'll just clear that right so it's no longer going to spawn on wreck because I don't have a class set for him and it'll use this one instead so I'm going back to the old way of doing it now if either of those options if you don't want it to spawn it and you don't want to use the tags you want to do your own custom way you can always override the link speaker Avatar class and write whatever code you want um but that's a little bit more advanced next up we need to talk about dialogue shots so by default narrative has a camera shot where it points the um the camera at the person talking and you'll notice it also sort of keeps us to the left side of the screen and it keeps the NPCs on the other side of the screen and this is a cinematography role that narrative automatically follows for you but you might want to change the shot this is not necessarily the best shot to use so if we close this and open up our dialogue for example um shut up Larry right and Frick's really mad we can change the dialogue shot for him and you can do that by going to shot and select the speaker shot and then this is the offset right this is the forward and backwards this is left and right so I'm going to put it right in front of his face and don't tilt the camera and we'll compile and save and watch what happens when Rick says shut up Larry the camera is going to be right up in his face right because he's mad and so you can change the dialog shot I'll show you currently Ramirez I have not hired Rick's vows and shut up Larry right so you can change that dialogue shot if you get a class defaults as well under dialogue shots the reason it uses that one out of the box is because it's added in there you can add more shots if you want to randomize it so for example I could add an over-the-shoulder shot and it would use that sometimes as well it'll just randomly select one of those shots so check this out just adds a bit more variation you can see this is an over-the-shoulder shot um if I say I heard any rumors you can see it's kind of randomizing the shots a little bit so that can be a cool effect you can even go into the speaker and you could say every time Rick is speaking I want it to be an over-the-shoulder shot I'll get rid of the over shoulder shot down here we'll compile and save and now it'll use that speaker shot but it'll override it whenever Rick speaks he'll have an over-the-shoulder shot you can see Rick specs it's over to the shoulder and if anyone else speaks it won't be over the shoulder but if you override the shot for a given line it will override the speaker shot so there's kind of an order of Precedence right it'll use the lines shot first it will use the speaker shot second and then it will fall back to these dialogue shots last I've also forgotten to mention you can actually turn off the Cinematic dialogue camera by checking that box there and if we compile and save Watch What Happens it actually doesn't spawn on a cinecam at all sometimes in a game you actually want that um but I think the Cinematic shots are pretty cool I tend to leave it on there's also this option if you check the box that says free movement that actually lets you move around while the dialogue is playing and this is really cool you see there's a lot of games like GTA where um you know you'll have a conversation with a person while you walk down the street generally speaking you don't want to have any dialogue options come up on the screen though because you're not going to have a mouse cursor and that brings me to the next feature which is Auto Select so whenever a player line comes up what you want to do if you don't want the player to have to select it if you click on this and go to Auto Select what this will do is it'll just select the line automatically this is really good for free movement shots you can see here I heard any rumors I have not right so it's automatically playing instead of me having to select it so I'm going to come back in here and uncheck Auto Select and you wouldn't want to backlink for an Auto Select by the way because it's just going to keep playing this forever but I want to show you one other thing so for example say the player says like hurt any rumors you guys must no something that's quite a long line of dialogue right and so this is where option text comes in if you select heard any rumors as the option text so I'll just turn free movement off and spawn dialogue camera back on and I'll just show you that as well so we'll hit play hi I'm Rick and if we say you can see it says heard any rumors right this is the option text we've selected heard any rumors but your player will actually say a different line of dialogue another thing you can do if you click on the player line here you can add alternative lines of dialogue so heard any rumors you guys must know something heard any rumors LOL what what this will do is it will randomly select one of the lines you've provided so if you provide more lines it'll add a bit of randomization I won't show you that because it's kind of self-explanatory now here's something that I really want to get into is the event graph right dialogues can have blueprint code in them because they are just blueprints right and one of the easiest ways to do this say you want to execute a little bit of code is you know imagine um you know if I ask Rick how he is we could say here have a gold coin right say we want Rick to give a character a gold coin what you could do is you could actually double click on this node here and you can get the owning you know controller and you can like give them a coin or whatever obviously we don't have any coin system in our project or anything like that but you could do that um as an example I'll just say black Print string give coin so this is a nice little event that gets called for you whenever this line of dialogue starts or ends and you can check whether it's started or ended using this here so I'll just say on started for example we'll compile and Save and check it out it's going to say give coin when Rick says his line of dialogue how are you Rick you can see it says give coin you'll also notice that it has this little lightning bolt here that means that it has an event bound to it if you want to remove the event all you have to do is hold shift and then click and then it will remove the bound event the event will still be there but it won't get called anymore and you can delete it if you want to while these events might sound really awesome you actually won't use these very often because there's a better system you can actually add events down here and these are generally a lot more versatile and you'll use these a lot more there's actually a few that come with narrative for example you can begin a quest um you know for example let's say I'm just swell partner um here's a quest help me find my lost gold coin and then you could actually automatically begin a quiz we haven't gotten into quests yet but if you did make a quest you could kick a quiz off there's also a run time this lets you control whether you want to begin that Quest when he starts talking or when he finishes the dialogue line so you can choose when or you can even do both if you want but events are very versatile year there's these ones that come with narrative but you can write your own events for example you can make an event that adds an item to the player's inventory let me show you how to do that really quick because it's pretty important you will do this a lot in narrative so I'm going to make a new folder I'll just call it events and I will go in there go to narrative make a new narrative event I'll call it in E underscore give item or something like that in your event you need to overwrite execute event and obviously I don't have an item system in my game so I'm just going to do a print string and I'll right click on this and do item name compile and save and then there's another function you want to override called get graph display text and I'll show you how this works we'll do um a pin string I'm gonna plug this in and I'm going to type give item and then drag item name in and connect it up like that and what that does is I'll show you if I compile there and go back into my Rec dialog so say Rick is going to give us a gold coin right so we'll say I'm doing swell here is a gold coin we can go to events and we can use that custom one we just made give item and it's saying give either I'm going to do give item coin and check it out so now it actually says on the UI give item coin and so that's why we had to do that get graph display text thing and so um check it out right if I do this if I hit play and I say how are you Rick he says here's a gold coin you can see it says coin up the top obviously in your game instead of just putting coin on the screen you would actually add the coin to the player's inventory so really cool and by the way this return value doesn't actually matter for events it's just a thing that's left in there from older versions of narrative so it doesn't matter whether you return true or not so events are pretty cool but conditions are even cooler so I want to show you how these work so let's go to Rick here and we'll add another player line and we'll say um thanks for the coin you're going to use this all the time these conditions are so so useful so say that Rick gives us a gold coin right we want to say thanks for the coin but we only want that to come up as an option if he's actually given us a gold coin right and this is where conditions come in so if I click on this I can add a condition one of the conditions that comes with narrative obviously you can make your own just like we did with the coin but one of the conditions that comes with narrative is this one has dialogue node played this one's so useful and so this lets you check if a dialogue lines ever played so if this Line's ever played we want to be able to say thanks right so we just come over to this line here we copy this ID and then we just paste and if we come down to node ID just paste that in there and you can see it says here has dialogue node Rick I'm just swell partner played one times right so if this is played one time then we can select this and you can do as many as you want you could do five times or whatever but we'll just do one and we'll have Rick say uh no worries and then we'll go back you can see these backlinks are starting to get a little bit messy by the way one technique for cleaning these up is if I hold alt and delete all of these you can just do an empty node right hook these all up and then you can just have one backlink instead of having a bunch sort of up to you how you do it another thing is with these empty nodes sometimes you don't want them to be massive like this and you can check this box that makes them into a nice little neat node it's just kind of a style thing here's another one I can make this a nice little tiny node and if you click on it you can undo that if you ever want to okay A little thing I forgot to mention for your reroute node just use a player node and check Auto Select and use that to Route backwards I'll explain at the end of the video why you need to do that because it's kind of complicated and not that important but if you really want to work with this plugin and know everything I'll put that at the end but just use a player node and let's try it out so how are you here's the gold coin and now it says thanks for the coin right we can actually select that option it doesn't show up until he's given me the coin also a narrative this is a feature that I didn't have turned on before but it will gray out any replies you've selected out of the box you don't have to do anything it should just do this right away okay so now I'm going to show you why I lift that um first node empty and the reason is because Rick might need to say lots of different things right imagine you're doing a quest with Rick well if you're doing a quest with Rick he should probably ask you how the quest's going right so I could say how is the quiz going but their narrative doesn't know which line to play right should it play high on Rick or should it play how's the quiz going we need to select the right one and to do that the easiest way is to use a condition so for example if there was a quest you could add a condition and there's actually one that comes with narrative called is quest in progress and you can select one of your quests that you've made and I'll get into that later and then you know it would select this and narrative goes from top to bottom so if there's a routing node here it'll say it'll try this one first and if the question progress it'll he'll say that but if the quest wasn't in progress he'll come down and say this instead so you can use these conditions to select certain options or filter out different player options right and another thing is that quests can get or sorry dialogues can get really messy you can see there's quite a lot of dialogue just here on its own and so you might often like to make sub dialogues and I'll show you how to do that so let's go to our rec dialog and I'm going to hit Ctrl D to duplicate it and I'm going to call this Rick underscore uh great something like that right and we'll go into the dialog graph and we'll delete this bit and we'll just leave that right we just want this bit and we'll come back in here and I'll delete all of this instead of saying hi I'm Rick I'll just leave it empty but this time I will go to events and use the begin dialogue event that comes with narrative and we will start the Rick greet dialogue and now what it's going to do is it's basically made a sub dialogue right and this is a great way to organize your dialogues into nice neat little packages so if I save compile and save both of those and try it out hopefully that should work he does say how's the quiz going if I delete that one we'll just use this as an example you can see it starts that sub dialog right and this is great like if you've got a main character they might have like 20 different dialogues so it's a great idea to package them up and then you would have like their main dialogue here it would select you know the right sub dialogue based on whether you're doing a quiz for them or a number of other things okay so the next thing I want to talk about is targets so lines can actually be targeted towards someone so for example Larry says I heard Rick smells right and then Rick says shut up Larry you can actually make it so that that line is directed at Larry it will show up on the UI there the reason you'd want to do that is the certain um shots like for example the over the shoulder shot it needs to know who the lines directed at to line this shot up correctly and so it's sometimes nice to fill that out also if you're ever making a game where the characters need to look at each other you need to sit that so that you can figure out who's talking at who right a little bit more of a complex feature and you really don't have to use it especially not all the time because narrative will try and figure out who the lines directed at by default and you can see how it does that here if you hover over this a little bit more of an advanced feature it's really just there if you need it all right next feature I'm going to show you we're going to go into D Rick greet and we're going to click on wreck and instead of saying I'm just swell partner I want him to actually say the player's name so I'm going to show you how to use dialogue variables so we're going to do curly brackets and then inside I'm going to do player a name compile and save we'll jump into the event graph here and override where is it get string variable and then switch on the variable name and just plug that in like that we'll add a case I believe I call that player name yes we're going to come in here and we're going to type player name and then what we'll do is we will get the owning controller get the player state and we'll grab the player's username right so get player name plug that in plug that in now what's going to happen is instead of saying I'm just swell and then you know partner it's actually going to say the player's name this is quite cool um it's particularly in games where you don't have audio this is a really nice thing to be able to do so if you say how are you uh Rick I'm just swell and then it inserts the player's username very cool now there's a feature that I haven't shown you so far and you really should use this and you should do this for all of your dialogues in your game as you should actually make a master dialogue class and the reason is for that you know how I just wrote that code there well if I ever make a new blueprint right if I ever make a new dialogue I'll call it D underscore Larry and if I try to make Larry do the same thing right High there brackets player name it's not going to work because I wrote the code inside of my D Rick greet class and Larry is not going to be able to use that same code unless I write that code again right and anyone who cares this is not the right way to do it and the answer is that generally speaking in your game you should make a dialogue called D underscore you know master or something like that and put all of your code in your master dialog so I'm going to do that actually let's copy my get string variable and I'll paste it in there instead yeah uh hang on right so I'll put it in here instead and then inside of Rick great go to class settings and sit the parent class to be your master dialogue and anytime you make a new blueprint just right click on master and create a child blueprint right and I'll do the same D underscore Larry or D underscore Nicholas whatever you want it to be and now the codes in your master blueprint and they'll all be able to do this right you can even go to edit project settings and set your default dialog class to your master one and this way anytime you make a new dialog you can see the parent class is D Master right out of the box by default and so I'd really highly recommend setting up sort of a master dialogue class and that way any code you write will be shared across all of your dialogues all right so now you've done all this it's actually really easy to add the metahumans adding the lip sync and the metahumans is actually the easy Parts not very hard at all so let's add some better humans to our dialogue so we're going to go to the plus thing here and open up quixel Bridge which comes with Unreal Engine I'm going to go to the middle humans tab we're going to go to metahuman presets and then just select any of these metahumans it doesn't really matter what one you go for I'm going to use Gavin here so I'll click on that and it seems like I have to do highest quality so I'm going to do highest quality and then click on download okay so I'm just going to use one meter human for this example I've downloaded one meter human Gavin and I'm going to click on add to add him to the project it's going to do all sorts of stuff it will also tell you to enable a bunch of things that it needs so we'll do that you will have to restart but we won't do that immediately I don't think it's that important but if you go to the midi humans folder now you'll have Gavin in here and if you drag BP Gavin into the level uh oh we might actually have to restart our project so let's do that it's also telling me to enable Shader Model six uh I don't know how important it is to actually do that but I will do that anyway so we're gonna go to edit project settings we're going to go to platforms windows and checklist boxes is SM sucks oh we gotta restart again all right so I'm going to restart again Okay so we've restarted the project now and if we come in here we're gonna have to change our dialogue avatars a bit because if we open up BP Gavin this metahuman that's now in our project it'll be in the middle humans Gavin folder you'll notice that there's lots of different pieces so there's a body there's a torso there's pants and so on um so we're going to definitely be modifying some things um so let's go into our dialogue Avatar here we've got a dialogue Avatar class and we're definitely going to have to modify this quite a lot so I'm going to rename in fact I'll just delete the skeletal mesh from my dialogue Avatar so we'll get rid of that and then we'll start to copy some of these ends so we're going to copy over the body I'm gonna copy of a in fact I might be able to do these all in one go I'm not going to do the here these can be kind of uh annoying feel free to copy the hero for if you want I'm going to leave that um so we'll paste that over and we'll select hmm for some reason it didn't do the feet properly I'm gonna delete that let's try the Feet Again it's calling them skeletal mesh for some reason I'm just going to rename those to feet and attach these all to the body like this and then we'll click on the body and we'll use the rotate tool again make sure that he's actually facing forward so I'm gonna Point them in the direction of the X there we go file and Save it's coming to a dialogue Avatar and what's going on here ah yes this old Dynamic material instance doesn't matter anymore get rid of that we'll click on Gavin we're gonna go into Gavin and don't do anything to the face I don't think but we will go to skeleton assign and we're going to select we're going to select this one here SK mannequin 157 kilobytes or roundabout should be about that size and we'll accept and click ok I'm going to take all of these clothing pieces I think that's all of them and then again we're going to do the same thing skeleton a science skeleton we're going to click on the same one except let's do that as many times as we need okay again same one accept save all right back into the dialogue Avatar we're going to go to the body we're going to go to use anim asset and we're going to try and use the emm idol all right almost there almost there inside of the construction scripts we're going to take all of these drag them in and then drag in the body sit uh I think it's called The Leader pose component plug all of these in oh sorry my bad plug them all into here plug the body into there uh my bad just have to hook that up again uh we'll check both of those just to be safe cool okay there we go so you can see now our animation setup is working so all we have to do is just make sure I met a human can use the old character's animation so that's why we had to do all that annoying stuff but anyways now we should actually be able to use our dialogue now they do have uh different color shirts they look the exact same I I'll add another meta human later I think but let's just try this out actually this actually works hi I'm Rick how are you Rick looks pretty good seems to be working okay Larry's working fine they look a bit terrifying without any here but you get the idea you can add the here if you want if you really want the here just copy and paste the hairs over and add the LOD sync component as well all right time to set up live link first thing to do is open up a command prompt and then type in uh ipconfig I'm going to blur this out but you're looking for the ipv4 address so you need to get that take a screenshot copy and paste it do whatever you need to but just remember that IP next you want to download the live link app on the app store for iOS and then go into live link and add a Target and then put in your IP and I've called mine Rubes iPhone okay so once you've done the setup on the iPhone we're going to put this BP Gavin in the level and it actually comes with a bit of code on it already for the live link setup it's already set up to do live link you should be able to find your iPhone and the drop down if you've set up the app correctly it should work if it isn't working there's plenty of tutorials I may have left something out but I'm pretty sure that's all you need to do click on live think face click on ribs iPhone and now what I'm going to do is I'm going to open up the app on my phone and check it out he should be lip syncing there we go yeah there's another toggle for doing the head rotation we're not going to do a head rotation today but you can see mine's turned on and what we need to do is record these animations so that our characters can use them and it's actually really really easy to do so let me show you how to do that we're going to go to Windows cinematics take recorder and we can use the take recorder to record audio and animations it's really cool how you can do this it's so easy so we're going to add microphone audio because obviously I want to record my audio and then we're also going to record um Gavin so make sure that Gavin's selected in the level you can see he's got that highlight around him and then just click on Gavin now this is where things get a little bit hairy but we only really want to record my face it's going to record a bunch you can delete the body and the legs and stuff and it makes it a little bit less bulky there's a lot of a little bit less data that it's recording but I'm just going to keep them all just because I'm showing you this as an example so let's just record one of these lines right hi I'm Rick just as an example I'll show you how to do this all right so I'm going to record a line so you ready let's do it hi I'm Rick so you can see what I did I just click the record button and then um when it's time to finish I hit the stop recording and you can see it's saving it to game slash takes I believe if we go to the content browser takes here it is hi I'm Rick there's the audio and you can see the face gets recorded this one here there it is there right so obviously you can do as many recordings as you want if you delete the Torso you won't get all these annoying animations but I'm going to rename this to a underscore hi I'm Rick I'm going to right click on it and make a and a montage so go to create and a montage and I'll call this s underscore hi I'm Rick if we open up our rec dialog we'll go into Rick great and here's the high iron brick line and I'm going to search for it hi I'm Rick we're going to go to the dialog montage and select hi I'm Rick it's just a couple more minor steps here all right so here's our head our kid's gonna play animations but if we play animations on the head it's not going to sync up with the body so we're going to do a little bit more coding to get it to work I'm going to browse to the face and a BP asset just find that should be in the middle humans folder here and we're going to make a new Adam blueprint so we're gonna go to animation and a blueprint we're going to go to uh what is it called face archetype skeleton I'm gonna create I'm going to call it uh nmbp underscore lip sync something like that open it up sorry if it sounds like I'm kind of winging this by the way guys I sort of am but I promise this will work we'll get this working so we'll go into event update blueprint animation we will get the owning actor and the only actor will be a dialogue Avatar so we'll cast a dialogue Avatar and we'll get the body of our character so get body and we will store this in a variable we'll just store it in body okay what you want to do now is go into your anim graph drag the body in we're going to use this copy pose from mesh node and then save that I'm going to give this a bit of Name by the way we'll call it body pose then what you want to do is uh uh use cached pose body pose we're going to do a layered blend per bone here okay this is going to be kind of annoying but bear with me here okay video layer is set up go to Branch filters add three branch filters okay first one facial underscore C underscore facial root these are names of Bones by the way uh facial underscore C underscore Nick to root facial underscore C underscore dick quad wrote this is really annoying but you only have to do this once so we will hook that up and then yeah I think that's fine we'll do slot default slot let's just try this I think this should work so um we're gonna improve this we'll make it even cooler in a little bit but I just want to make sure this works so far so okay we have Rick great with selected air Montage selected as sound go back into your dialogue Avatar click on the head and make sure he's using the that nmbp lip sync that we made compile save all right let's try this out this is the Moment of Truth guys oh my God and we'll go into the master dialogue because we're going to write some code so you really want to master dialogue because any dialogues you write in the future you want them to have this code that we're about to write so make sure you do that Master step I showed you earlier and what we're going to do is we're going to override play dialog animation by default the edit will try play any animations you've selected but it doesn't know whether to play them or the body or their face or whatever and we want to play them on the face right so what we want to do is go to speaker cast to dialogue Avatar get the face play montage and then hook up the Montage which is located in the dialog line that we're trying to play so there we go compile save okay we're going to go into a dialogue Avatar unhook face from sit leader pose component we no longer want to do the face we just want to do the Torso feet and the legs I think that's what the issue is here so we'll compile and Save all right this is our last tail mirroring hopefully this works now hi I'm Rick here we go yes all right it's finally years ago facial Innovations so that's all you have to do it is quite a lot once you have a good setup though like a few little tweaks and um it can be really quick to spam out animations you can actually do them quite quickly um obviously getting that setup is really annoying but once you have it set up it's honestly pretty easy to work with it's really just that setup process that's so awful I'm going to leave a link in the description to the narrative content examples by the way and that comes with a metahuman player as well I'm not going to show you how to make the player into a metahuman as well in this video just because it's kind of a little bit too much outside of the scope this is more about showing you how to use narrative but yeah link will be in the description for that and you can see for yourself how to do that in your dialogue avatars by the way you should still be able to change the color of the shirt if we take the Torso plug it in like this right it's actually diffuse underscore color underscore one we'll do that again let's come back in here compile and Save there we go okay so now you can use this body color and give them at least different colored shirts but obviously if you add more metahumans into the game then you can like change out their clothing and faces and things like that but because this is an example I think the best way to tell them apart is just to change the color of those shirts at the moment they kind of look like The Wiggles hi I'm Rick so cool how easy it is to get that setup going though like we must be less than an hour in so far okay so Chris let's go ahead and go to the quests folder and quests are very simple to create we just right click go to narrative and make in a quest blueprint you can see it says a special type of blueprint that includes a node-based quest editor so I like to call it Q underscore and then the name of your quest but it's a really good idea to set up a master class that all of your quests are going to use right so I'm just going to call this master quest so once we've made that Master Quest let's actually make our first Quest now so we're going to create a child blueprint class and I'm going to call this Q underscore my first Quest and we will open that up and I'm going to change the name to my first Quest and you can put a little description in if you want I'm not going to do that at the moment we'll compile and save and the Quist blueprint is exactly like any blueprint you've ever used except it also comes with a quest designer the quest editor is a little intimidating at first but it's actually really really easy to use so these gray nodes are states and you can add states by right-clicking and adding a state an estate is just a certain point at the quest you can be at so let's say that an NPC tells you that you have to go and find him a ancient Trophy and bring it back to him right well Quest start as we'd be at the start of the quest and then once you find the trophy you might be at this new state called found trophy right but you can't just hook a state up to a state the way that you move through the quest is by completing tasks right you have to find the trophy that's how you get to this state in the quest and so this brings me to branches so if we drag out there's a whole bunch of these tasks that actually come with narrative and there's this one called go to location so these are like things that the player has to do and you'll be making your own tasks and I'm going to show you how to do that later but here's one that comes with narrative called go to location you can see when you click one of your tasks it actually automatically adds a state for you to say if you're having to do this yourself so I'll delete this one and we'll come into quiz State too and I'll say went to cube because what I'm going to do is I'm going to make it so that the player just has to run over to this Cube over here just as an example right so we'll click on this Cube here I'm going to copy the location of the cube I'll come into my quiz tasks I'll expand this go to location and then for the goal location I'll just paste in the location of the cube it even takes this friendly location name you can see it says go to location name here if I was to change this to the cube you can see it now says go to the cube right so let me just show you this actually working we'll compile our Quest and save it and if I come into my narrative PC my narrative player controller if we drag narrative in and drag out and search for begin Quest we can begin that Quest that we just made and we'll select my first Quest and it's going to begin that question because the UI is on the screen it will actually show us the quest as well so we're going to hit play you can see it says go to the queue but if I run over to the cube you can see that it's completed that step now there's no new tasks in airquest the quest is essentially finished at this point because we need to add more stuff to it and so we'll go back into our Quest and I just want to demonstrate so this is a state it states a point you can be at at the quest but there's these special types of States if I hold alt and click there is the succeed the quest and fail the quest States and these are just States however they don't have an output pin and this is because the quest is over at this point right once you get here we'll call this Quest complete for example we could even get a give it a description we could say I've completed the quest right so once you get to a green State you've succeeded the quest if you go to a red State you've failed the quest right so for example you can make a quest where going to the cube will succeed the quest and you know if you did some other thing let's just use go to location again I'll delete this one hook up to the file here let's say if you go to the wrong Cube let's say if you go to this Cube it actually fails the quest so I'm going to move that over a little bit and copy that location I'll paste that in like that again we'll just save the cube or let's let's say the wrong Cube and we'll say uh Quest failed oh no I've failed the quest A lot of these descriptions and things don't really matter but they're really nice for the UI for example I'll show you later there's a quest Journal you can use and it uses these descriptions all right so here's our little Quest and I'll just show you if I play this now it's got two branches on the screen right go to the cube or go to the wrong Cube and so if we go to the cube you can see it says quiz succeeded up the top and this Quest is actually now succeeded and if we go to the wrong Cube it should say quiz failed and it does generally speaking you wouldn't want to actually tell the player to go to the wrong cube right that doesn't actually make much sense and so you can actually click on your uh Branch here and you can click hidden and you see it says this little icon here this branch is hidden and won't show up and so now if I hit play it actually won't say go to the wrong Cube it'll just say go to the cube so you can have ways of failing the quest that don't actually show up in the UI another thing you can do is you can have multiple tasks that the player needs to complete so let's actually uh click on this one here I'm going to hold shift and right click to copy this and I will add and then shift left click to paste right and instead of saying the wrong Cube I'll just say the other Cube and we'll get rid of this bit so you can actually have multiple tasks on a branch so I'll save that and now if I hit play you can see I need to go to both of the cubes to complete this Quest step right and I can do them at any order and so another cool thing is you can actually make tasks optional so for example go to the cube and then go to the other Cube if I go to the other Cube task and I check this box that says optional you can see it actually says optional here what that means is I don't actually have to go to the other Cube I can do that step if I want but if I just go to the main Cube it will complete the quiz you can see it says quiz succeeded even though I didn't do the optional task it doesn't matter it's still completed the quest likewise you can see if I complete the optional step right it doesn't actually complete the quest I have to go and do the main task s also Auto generate these descriptions right you can see it says like go to the cube go to the other Cube well it's Auto generating that depending on what I type in as the location name and I'll go more into that later but if you don't like that you can override these descriptions if you go to description override you can be like go to the cube man you know if you want to say something different if I use the description override compile and save my quest and try it you can see it says go to the cube man so you can put whatever you want for the task names if you wanted to make it so that the player had to go to the cubes in a certain order really easy to do as well I'm going to copy this and I will drag out add another state and then I'll add another go to location and then I'll just paste in my other go to location like this and we will get rid of that second one so you should have go to the cube and then go to the other cube right so if you compile and save this now we've essentially made a quest where you have to go to this Cube first and then you have to go to the other cube right so you have to do the tasks in a certain order and although so far we're just keeping it really simple by making it go to the cube in a real game this would be kill an enemy and find an item and all that sort of stuff and you can make really rich crazy quests right you can make a quest where once I'm at this step I could fail the quest you know I'll just I'll just wing it and give you a little example here like I could fail the quest but or maybe I want it so that I might fail the quest um but you can still redeem yourself and succeed the quest but if you don't redeem yourself um you know you can fail the quest right so you can see how you can make really like crazy non-diant um non-linear quests right you can make really complex quests with multiple different endings multiple different ways to complete the quest and this might be a little confusing um at the start but this is very intuitive trust me you'll get used to this in no time you can see it says like quiz State six and quiz Branch 11 it just shows the ID so you know you might actually want to give this a better ID like go to Cube and then here you might say go to Cube two so you can like give these better names if you want or you can just leave them as these defaults so I'll delete all of this missiness and we'll just go back to let's just go back to a nice simple Quest right let's just plug that in like that something that you've probably noticed by now is that when you open up your quest there's not really a lot of tasks the player can do in a real game right the player might have to find an item or kill a character to move the request and those don't exist so how do you make custom tasks well that's a great question let's do it you'll be doing this a lot in your game right and you don't have to make many of them if you think of a game like Skyrim most of the quests to like find this item then talk to this character then kill this boss and that's the quest done right so you really only have to make a few of them and so let's do a really common one which is find an item right let's make it so you have to find an item to complete your quest and so we're going to come into our Quest here and if we right click we can go to narrative and make a new task right and you can see it says tasks or blueprints that manage a task for the player to complete and so if I add my task I'm going to call it BPT underscore find item right that's the task you've got to find an item and now I'm going to save everything and open my quest back up and check it out if I drag out I can actually make find item a task in my quest how cool is that but we actually have to write a bit of code to make it do something it won't work just yet you can also see that it says uncategorized and it's got a bit of an ugly name so we'll fix that as well we'll come into our task and we'll go to the class settings and give it a nice name so find item the description I'm going to say task that completes when the player finds the given item and for the category I'll just do like items and so now you can see in the quest designer if you drag out it's under that nice items category now so it looks very nice and so what we'll do is we'll come into our narrative player controller here and you could obviously Implement an item system a number of different ways every game is going to be a little bit different but we'll just do a really basic one here we'll add a event dispatcher to our narrative player controller and I'm going to call it on item found and we'll come up to the inputs and add a input and you know this could be the class of the item but I'm just going to make it a nice little string here right I'm just going to say item name really simple and then under begin play I will search for one and then find the keyboard event for one and I'll add a keyboard event for two if you scroll up there it is there and if we drag our on item founder and I'm just going to call it so when you press one we're going to say that you've found a sword for example and when you press two it's going to be a shield now don't worry we're going to add some pickups and make proper items in a little bit I just want to show you this working for now right so we'll compile and save come back into our find item task and we'll override the begin task function now sometimes tasks need to tick but in our case we don't need a task that can ticks so we'll just go to begin task we can get the owning controller that's the person that's doing the quest and then if we drag out we can cast it to our narrative PC and we can assign on item found so what our task is doing here I'll explain a task is going to wait until the player finds an item and then complete itself right and so it's only going to do it if the item name will do a case insensitive is equal to whatever we type in so we'll say item to find if this is a little bit confusing bear with me because it will make sense in a second so we'll add a branch here and if the item is the one the player needs to find then we will add progress right we'll add one progress to the task compile and save and again I know this is probably a little confusing but this will make sense I promise make sure to click that little I next to item defined as well and if we compile and save and jump back in let's go to our go to cube task and I'm going to rename it to find you know sword or something like that and we'll go to quiz tasks and get rid of them all and then we'll add a new one and we'll add a find item task so you know when you drag out and you can select the task that's just a little convenience thing right if you want to change the task at any time you just come in here and select the one you want so find item okay find item sword and that's basically it so I've hooked it up so that when we press one it finds the sword item right and so let's try this out I'm going to hit play I'm going to press 1 to find the sword and you can see it completes the quest the only problem is notice how it says task description it really should say find a sword right and so this is the other thing we need to open it up and add the get task description function and again this might be a little bit confusing but just bear with me because you're going to see how this works in just a sec so format text we're going to type in find a and then do curly brackets and then do item name and drag that item to find in and this is really cool now you guys are going to love this check this out compile and save we'll come back into our Quest and check it out it automatically generates the description for US based on what you type in right if you type Shield it's going to say find a shield if you type sword it's going to say find a sword if we compile and Save now it says find a sword then if I press one you can see it succeeds the quest you're probably wondering what ad progress does exactly well if I go to my first Quest and I go to find a sword see how it says required quantity this is the number of times you need to find a sword if I type 5 for example check this out I'll compile and save jump into my quest and if I press the one key see how it adds progress to that quiz step and if I find the sword five times it succeeds the quiz so that's great if you have a quiz where you need to kill 10 wolves or something like that being able to add a quantity is really good optionally if you want you can just do a complete task and what that will do is even if you've set the quantity to be five right it'll complete it in one go but obviously you usually don't want to do that usually you want to do add progress instead and so that's really cool we can do like fine two swords and we can go to this little arrow and duplicate it and then we'll come down here and make this one Shield and um we'll just make it so you have to find two Shields as well and now we have a quest we have to find some swords and some Shields very cool you can also go to the actual Branch itself these blue things are called branches if you go to this Branch itself and go to the description you can actually say what you're doing these tasks for so for example you could say get ready for the war right and if you try this out in game now you can see it actually says get ready for the war and then it says find a sword or find a shield right and so now we'll just add some very basic pickups to it again so to add some pickups we're going to go to blueprint class and make a new actor and we're going to call this BP underscore pickup we're going to go to add and add a sphere and I might make the sphere say 75 I'll go to the text render and add a text render this is just so we can see what the item is and I'm going to horizontal align Center and I'm just going to say item name then go to the sphere click on it and then scroll down to begin overlap and add a event and basically we're going to cast to third pressing character so that when our character walks into it we can get our controller cast that to our narrative PC and call on item found and then we're going to right click on this and promote it to a variable and we'll click on the little I down here again so that we can change pickup names finally go to the construction script drag the text render in and set the text to be the name of the pickup again if you're a little confused don't worry this will all become apparent what this is doing in a second so we'll drag the item name in we'll hook that up like this compile save and now I'm going to put a pickup on the level and for its name I'm going to put sword and you can see the text will actually say what it is to it'll say sword right very cool I'm going to duplicate that and I'm going to make another sword and then I'll duplicate that again and I'll make a shield and I'll duplicate that and I'll make another shield and now if we play our game we should be able to actually take these pickups if I walk into the sword you can see it's taking the sword and it's taking the shield it doesn't actually remove them from the level what you can do is if you go back into your pickup you can actually destroy them once the player takes them and you can see this is already working quite nicely so that's how you make custom events right say your game needs an obtained item event or a task rather that's how you do it right okay I'm going to quickly explain a few more of the quest editor features and then we're going to take our NPCs that we've made and we're going to make them give us a quest to do next up I'm going to show you how to add some code to your quests a lot of people are going to want to modify their quests and they want to add things like quiz rewards and stuff like that it's really simple to do narrative is made to be easily modifiable so anytime you want to write code in your quest add it to your master Quest class and that way any quests you make will have that code in them as well it's exactly like making a child of any blueprint right it's the exact same setup so we're going to our Master Quest and let's add quiz rewards right we'll just add a really basic quiz reward system just to show you how it's done so we'll go to the onquist succeeded function and then I'm going to add a variable called you know Quest reward item an onquist succeeded I'm just gonna you know print the quest reward item on the screen obviously in a real game what you would do is you'd get your player you know you're earning porn and you'd add the quest reward to the inventory or whatever but because we don't have an inventory system I'm just doing this as an example and let's say well just as an example we'll also add XP right so maybe completing a quest is supposed to give you some XP so we'll add that feature in as well this is how easy it is to modify narrative so add another print string we'll just do it append I'm actually going to do a couple of opins here so we'll say reward item we'll plug in that reward and then we'll plug that in like that and we're going to say you got XP and then plug in the XP right so here's how cool this is right your code your reward system and now if we go into my first Quest and go to the class defaults see how it has XP up the top so I might make it so that this quiz gives the player 150 XP when they complete it and it gives you a crossbow or something like that compile and save and now watch this when I complete the quest you got XP 150 reward item crossbow so that's how easy it is to modify Quest and add node features it's really really cool let me show you one other cool thing you can do tasks don't necessarily just check if you've completed a task tasks can actually do anything you can make a task called kill enemies and the task could even spawn in the enemies and just to show you like how this would work let's actually make it so the task can optionally spawn in an item right and so what we'll do is we'll come into our task on begin task we're going to spawn in an actor we'll spawn in one of our pickups if you go to your pickup and go to item name make sure to check expose on spawn come back in a find item and we'll just uh select pickup again you can see it now asks for an item name we can just plug in the item defined we'll add another variable right we'll say uh item spawn transform and we'll give the player we'll give the quiz designer the option they don't have to make it spawn in an item right so we'll have like a spawn item variable and we'll make sure to check that little I there as well on both of those and so here if we've selected that we want to actually spawn the item we can spawn in the item so this is really cool let me show you how this will work so we'll compile and Save and let's um we'll go back into our quiz this isn't going to work with multiple at the moment so we'll just do one all right we'll change it to one sword and one Shield okay and we'll delete some of our swords and shields we've got a sword and we've got a shield right we're going to copy the location of the sword open up our Quest where it says find a sword well it's actually paste in that sword location and we'll check the box that says spawn item and let's just do it for the shield as well right so we'll copy that in there we'll come into our Shield and paste that in there again we're going to check that spawn item box and now watch what happens when this task becomes available the items will actually spawn it so we can delete these now and when we get up to that task in the quiz which we will immediately it spawns the items in that's so cool so that's really useful right there's going to be plenty of quests where the item should only spawn in like once a player is doing the quiz for example and it's really easy to add logic to these tasks so think of tasks as much more than just checking if the task has been completed they can do way more they can even spawn in items okay so now we're going to make it so that Larry gives the player the quest so it will come to our dialogue that we made earlier a rick dialogue we'll open it up we'll go to Brick great actually and we'll make it so the Rick gives you that Quest right so um if we say how are you Rick let's change it we'll get rid of that event I don't really need it anymore we'll just say um I'm not doing so well there's a war coming and we don't have any weapons right and let's change that from how are you we'll just say like do you need any help and um let's disconnect that there and we'll add an option for the player where the player can say can I help I'd actually put this up here just so it's a bit cleaner looking so say can I help and we'll drag off and we'll say would you will need at least two swords and two Shields two actually we'll just say one sword and one Shield because that's how we made the Quest for now so we'll need a sword and a shield to defend the castle and you don't have to use narrative for like medieval games it's useful for any type of game but I'm just going with that sort of uh genre so we'll need a sword and a shield to defend the castle and then we'll just add an event and there's an event that comes with narrative called begin Quest and this will automatically begin the quest so we'll select my first Quest it'll automatically begin the quest when he starts talking we kind of want it to begin the quest after he's finished talking so we'll just go to event runtime and hit end right compile and Save let's try it out if we run up to oh we're still Auto beginning that Quest let's go back into our narrative player controller and we'll just disconnect that right because now we're going to start at using dialogue so we're going to hit play here and hi I'm hi I'm Rick we'll say do you need any help not doing so well there's a war coming and we don't have any weapons can I help would you will need a sword and a shield to defend the castle and you can see it's automatically kicked off that Quest and now we can do the quest and you can see that the quest automatically completes but wouldn't it be nice if you could actually bring the Sword and the shield back to Rick right it doesn't really make sense that we just have to find it we should have to bring it back to him so let's code that in to do that we'll come back into that brick greet dialogue and you know what let's make like a sub dialogue let's do that right so again we'll do a sub dialogue so we're going to come into Rick and we'll duplicate it and we'll make one called the underscore Rick underscore my first Quest right so we're going to clean this up a little bit and make it its own special little dialogue and so Rick is going to say here he's going to say um how's the quest coming along have you found the weapons and our player is going to say I sure have or if you haven't found the weapons we're going to say sorry I haven't found the weapons yet compile and save and we'll go back into D underscore Rec and you can see that we've got this Rick great we're going to have another sub dialogue now which is again dialogue Rick underscore my first Quest and now again we have that problem we need to select the right one we want to play this one if the quest is in progress so just go to conditions is quest in progress and select my first Quest and now if you're doing the Rex Quest it'll select that dialogue to play otherwise it will select this dialog to play and this is a great way to do a dialogue right to organize your dialogue out of it so we'll compile it and seems pretty good to me so let's try that out we just have to modify our Quest a little bit if we come back into my first Quest you can see that if we find the sword and find the shield the quest is completed we want to change it so you have to bring the items back to Rick and so what we're going to do is we are going to add another state to the quest right so we're going to say got weapons that'll be the name of our state and then we need to talk to Rick and give him the weapons so I'm going to show you a task that comes with narrative it's called play dialogue node so if we come into the rec my first Quest right you can see there's this I sure have so let's actually rename this we'll give it uh the ID player give weapons to wreck right we'll copy that we'll come into our Quest and then we'll say that the player has to select that dialogue right so we'll just use play dialog node player give weapons to Rick and it's auto-generated that um task but that's not really correct so we're going to change that we're going to go to a description override we'll say take the web ends or we'll just say talk to Rick and for the major description we'll say um bring the weapons back to wreck and we could even give it the ID you know give weapons right those are the tasks we have to give the weapons back to Rick and then you complete the quest so you can see the design of our Quest has changed a little bit now there's two steps right you've got to find the weapons you've got to bring them back to wreck again I'm throwing a lot of information at you but you will become a lot more familiar with this it's just a bit of a learning curve so let's try this out now we're going to hit play and we're going to walk up to Rick and try out his quest so do you need any help I'm not doing so well we'll start as Quest and so we're gonna find The Sword and the shield and you can see now it's saying bring the weapons back to Rex so we're going to do just that we're going to bring them back to Rick how's the quiz coming along have you found the weapon so you can see it selected the right dialogue because that's quiz is now in progress and this is not great right you can see we can actually tell them we haven't found the weapons even though we have the weapons doesn't really make sense we'll fix that in a second but let's just try click on I sure have and there you go the quest is complete and it says you've got XP 150 you got crossbow right really really cool love that so yeah you can see that bug here that if we ask for the quest and then we come back to them we can actually tell them we have the weapons even though we don't have the weapons and this is very easily fixed so let me show you how to do this we're going to go back into our Rick Quest and we just have to add some conditions right so um basically if you have the weapons we want to be able to tell them we have the weapons and if you don't we don't so we're going to copy this got weapons ID we'll come back into the brick dialog here and we'll just add a condition and there's one that comes with narrative yet again it's called is Quest at State and we can check if the quest is at the got weapons state so if you're at the got weapon state you can tell them that you have the weapons and we'll just copy these conditions and just paste them on here but this time we're going to check the box that says not so are you not at the got weapon state if you're not at the Gob weapon state you'll have to say sorry I haven't found them yet right pile and save once again gonna hit play and we'll try this out so we'll say do you need any help if we come back to him he's going to ask if we have the weapons and because we don't have the weapons we can't give him the weapons right sorry I haven't found the weapons yet but now if we go and find them and take them back now we can give them the weapons how cool is that so there you go other things I haven't quite touched on in fact I don't even know if I mentioned this with the dialogues maybe I did but if you double click a dialog node you can call the blueprint event when the dialog node plays which can be quite useful I think I already covered that but um quists have the exact same functionality if you come into the quest you can double click on any of these and add a event to it so quest to the exact same exact same shift click to remove the event and quiznotes can also have events on them for example if I have got the weapons you know you could start a dialogue with just your player in it where the players is you know I should bring those weapons back how let me show you let me show you how to do that so we've got to go do Master we'll say d player bring weapons back something like that and we'll leave this empty and we'll add a player response Auto Select come to class defaults will say free movement should be turned on no no dialogue camera and we'll just say I should bring those weapons back to wreck right so I just want to show you this in quests you can use these events um as well so once you have the weapons I might want the player to say to themselves I need to bring the weapons back right so I could kick off that dialogue and now very cool if we grab the quest once we get the weapons our player will say to themselves I should bring those weapons back to Rick right see that so cool and of course we can bring them back to Rick and it works great we'll go back into Rick grit here I'll just show you like just more on these conditions because the conditions are really important you're going to use them all the time uh we could go into we could add a player response right and we could add a player response and it's only available after you've completed the quest so we can add a condition is Quest succeeded my first Quest right we might be able to say hey could I get a reward for helping you earlier right so you can have a dialogue option only show up after you've completed Rick's quiz forum you might say sure thing here you go and then you could add an event give item you know give item Rex sword or something like that you know what I mean so you can you can really easily start to create some super cool uh complex stuff so check us out if I talked to Rick the option to grab that reward often won't be available right the option to get the reward didn't show up but once I bring the weapons back to wreck if I come back and talk to them hi I'm Rick and check it out hey could I get a reward for helping you earlier and he gives you Rick's sword right so cool my game's a little bit laggy by the way it's just because I'm recording this on my laptop so one of the things that you can do narrative seems like a closed off system but it's really not so if I come into my player controller I just want to emphasize you know that narrative UI that seems so complicated you can actually grab the narrative component and you can check if a quest is completed right um as Quest succeeded you know you can um you can get a quest it's actually let me show you this I'm going to hook it up so that when you press the one key it's going to get that Quest we're going to get the current state that your player's at or grab the description and we'll print it let's open our Quest back up and I'm going to actually add some descriptions right you can see it says this is the start of my quest here we'll say I've found the weapons I need to bring them back to wreck if we compile and save and actually try this out if I start his quest and I press the one key it says this is the start of my quest so you can access all this stuff I know the narrative UI seems really complex but this is all it's doing it's just reading this quiz data and you can read it yourself if you need to check it out I'll find these weapons and if I press the one key check it out it says I've found the weapons I need to bring them back to wreck so if you ever want to make your own UI you can do it quite easily there's actually an example Quest Journal that comes with narrative that does a lot of this for you it's a little bit ugly but it helps you immensely if you want to do something like this so when I press one we're going to make a widget and we'll add the quest Journal you need to plug in your narrative component and then just add it to the viewport and so this is just a little example quiz Journal that comes with narrative and it shows you your quests and objectives and things like that and it's not terribly complicated there's a bit of code there of course but not that much and you'll see what it does if I press one right it's a really ugly quiz Channel at the moment I do need to make it a bit prettier but it's a really good example and you can style it to your game's needs you can see that if I start the quest and I open my quest Journal right it's in my active Quest and I forgot to mention but you can have as many quests going at one time as you like right and you can see the objectives here it says this is the start of my quest and if I you know find one of the items you can see it updates the quest journal and if I find the other one you can see here I've found the weapons I need to bring them back to Rick and if I complete the quest and up in the journal you can see it's now in finished Quest so that's an example of a quiz journal and you know you might like to add something like that to your game as well the other really powerful thing about quests and dialogue is all of it is saved to disk every Quest you've done and things like that so you know we've got this Rick Quest and you can ask for award if you've completed the quest and whatnot but say you complete the quest and then you close the game and you open it back up later this will still show up because it's going to remember that you've succeeded this Quest because it gets saved to disk so I'm going to show you how to use the save system it's really really simple we'll just come down here and add a keyboard event for three so when you press the 2 key will save your game so I'll just get rid of this for now and we'll just print string we'll just say saving and then when you press three we will load your game back in and we're going to say loading dot dot and this is just the coolest thing ever let me show you this so if we play the game and I open that Quest Journal up you can see that the quest is not in here right I'm going to come up to Rick I'm going to get the quest off him and I'm going to press 2 to save the game okay so you can see it says saving if I open the question or the quest is here I'm going to close the game open it back up if I open my question I know it's not there but if I press 3 to load my save again check it out my quest is loaded back into memory and now all the dialogues are going to work too right check this out how's the quest coming along right my dialogue my NPCs remember that I'm doing the quest it all gets loaded back in it's so cool finally we'll discuss data tasks narrative stores a big database of every task the player has ever completed and how many times they have completed it for example every time you jump we could complete that data task and now you can track the amount of jumps the player has ever done in their lifetime even if they close the game and reopen it it's saved to disk across all of their play sessions and it might not sound that useful being able to track how many times a player has ever jumped but what about knowing every NPC the player has killed all of a sudden this opens up some powerful options right and NPC could scream and yell at you if you've killed his brother or a dialogue option could become available but only if you've visited a certain city before and being able to check anything the player has ever done and have it all saved to disk with a small lightweight save file it's really really powerful so as an example let's track every item the player has ever found just to show you how to implement these data tasks so I've put my sword pick up at the level here just to show you this we've got you know these items let's make it so that we track every item the players ever found using data tasks it's actually really simple so we'll go to narrative data task and we'll make one called find item and if you open it up it's got the name of the task which is just find item and then the description about the task and it's also got this argument so tasks consist of a task asset in this case find item and then an argument in this case the argument is the item's name and that's how it stores all this data so let me just show you this will become a little bit more obvious here on beginplay I'm going to drag on item founder and I will assign to that event so that whenever we find an item I'll tell narrative to track it using data tasks so we'll drag narrative in and we will complete a narrative data task depending on the task you select the argument will change so check this out if I click on our find item task it's asking for the item's name so tasks are the task asset and then a string argument and that's how tasks are tracked by narrative so in this case we can just plug the item's name in you might use the item's name if you had a kill character task you might use the character's name or so on we will compile and save this and now what you can do is we'll add a four event here so we'll just type 4 and then scroll up and look for the event we can drag narrow defend and get the number of times a task has been completed right we can check how many times you've found a sword before and we'll and we'll print that out onto the screen here compile and Save and so if I play my game and press 4 you can see it says zero because I've never found a sword but if I take the sword here and press four you can see it says one here's where the system gets really powerful this is all saved to disk right so if I save my game by pressing two and I close the game if I open it back up later I'm going to load the game pressing three and then four you can see it says one so it's tracking how many times I've found a sword before and so having access to all this information is really quite useful in fact you might have noticed a narrative that narrative seems to remember any dialogue options that you've selected before right it Grays them out and actually if I say goodbye here and I save my game and then I close the game and I load the game back in you'll say that it remembers that I've selected these options before even though I've closed the game that's because narrative actually uses these data tasks to remember all the options you've selected before in fact if you go to plug Edge narrative content and go to default tasks you can see there it is there play dialog node and it's tracking every dialogue node and the ID of the node that you've ever selected and it can use it there's almost too many uses for this to name but you know for example you could have Rick say a certain dialogue line it could be like I heard you'd found a sword somewhere you know and you can make them only say that if the player has completed data task find item sword right and because it's all saved to disk that will work even if you save the game open it back up he'll say that only if you've found a sword before so the use of these tasks they're pretty useful in fact if we open up my first Quest you can even add them as quiz tasks if you go to complete narrative data task and go to find item sword you can actually use them as quiz tasks right if I uh start that Quest and I find the sword it's completed that Quest step and it's done that only using these data tasks it didn't actually use my find item task we made earlier I just used a data task where these get particularly interesting is you can actually go to that find item sword task and check the box retroactive because narratives keeping a database of every time you found a sort if you check this box retroactive it will actually check if you've already found the sword and complete the step and this is pretty interesting you can find the sword first then start the quest and it will complete the quest step right it's saying I should bring the weapons back to wreck because it's retroactively going back and checking have you done that already in the past so that's kind of another use of these data tasks you might not use those data tasks often but when you do use them they will come in handy and it's really nice that they're saved to disk that's kind of the main advantage of them these blueprint tasks are just kind of one-off things that are used in quests whereas these data tasks are more kind of permanent storage and they're stored very efficiently if your player has done 5 million tasks these are stored in such a way where there's not going to be a huge save file or anything like that finally narrative is perfectly configured for networked games if I play as a client you just have to remember to start quests and Dialogue on the server and that's really the only thing you need to remember but check us out right hi I'm Rick we're going to do Rex Quest the only thing is in a networked game you can't skip the dialogue options with enter at the moment you just have to wait for the dialogue to play out and if we find the sword item you can see that works and we'll bring it back to Brick and there we go you can see it's working really well and the server can give the rewards and it's all it's all server authoritative the coolest thing about this is that it is server authoritative so if your player is doing this Quest they'll only be able to select this dialog option if they're actually at the state in the quest the server will check these conditions and if the client tries to select one they're not allowed to the server will disallow it so it's server authoritative and it will stop your players from trying to cheat which is a big deal in an online game really quickly just want to explain why we couldn't use a rick node for air backlinking and why we had to use a player node the simple answer is that when you hit a player node narrative will then check all of the conditions but if you have an NPC node it won't check all the conditions ahead of it and this is because narrative generates its dialogue in chunks if I select this line here narrative will instantly grab all of these and it will grab this and it will it will use that as the next chunk and it checks all of those conditions in one go if you don't use a player response it will keep looking and it won't recheck these conditions right so if you want it to check all the conditions use a player node in fact I would say as a general rule just use the player node for backlinking I'll probably have this fixed in the future but you may as well just do it this way and it will guarantee that your conditions will work perfectly one thing I actually missed out and I want to explain is the get line duration function so by default it will wait until the audio is finished playing and then it will go to the next line so it uses the length of the audio by default however if you want that to be different you can override the get line duration function and you could just return a value like 10 seconds and if you do this every line of dialogue is going to last for 10 seconds in fact let's just do one second just to show this off no matter how long the audio is it will always go for one second because I've put that override in so let me show you that uh so we'll say do you need any help do you need I'm not doing right see how it's only lasting one second for a lot of games you want the player to have to press enter to move to the next line of dialogue and so you could actually use like 9999 like a really high number and that way the dialogue line will never really end you'll have to press enter to skip the line manually so I can show you that as well hey there I'm Rick right and there you go nothing happens we have to press enter to skip to the next slide so that's a way you can achieve that sort of functionality if you want it's by overriding the line duration and by default it uses the duration of the sound but you could you could do whatever you wanted or if you um if you had a high number like 999 you could ever play a skip it you can also I believe you can do skip current line yeah and that will skip the line so that does the same thing as pressing the enter key if you want to skip the line using Code so that's what get line duration does very useful and I also probably should have mentioned this but you can also override where the speaker's head is that helps narrative know where to point the uh camera so you could like get the head socket or whatever it does a good job out of the box I think but if you need to you can override it you can also do things like overriding how the sound gets played for example if I override the sound to do nothing right I won't do anything narrative will not play any sound check this out right you can see it's not playing any sound because when narrative tries to play sound it'll call this function and by default it's going to play the sound for you but if you override it you can make it do whatever you want you can make it play the sound um so just hook that in but you might want to play the sound in half pitch right or you might want the sound to be played at a quieter volume right so you can do all that as well so that's just a little bit on um on this and you can also do like if you want to override how the the sound is played you can do that you can also override how the animation is played or you can even override how a whole dialogue node is played if you override play NPC dialogue for example you could override that to do nothing and Watch What Happens playing an NPC dialogue line it won't do anything I won't play any audio won't do anything right you have to actually code it to do something now so you can override huge pieces of narrative from blueprints if you want and so that's some of the functions you can do there's also a nice Tech dialogue for whatever reason you have to do something every frame in your dialogue you've got that there as well um so yeah and then there's some nice ones like on begin dialogue you know everything you need and while we're on it of course um quests do the same right you can override tasks completed on Quest failed you could you know remove some XP from the player whatever you want to do so those functions are there in the quest and dialogue blueprints to use if you're upgrading to narrative 3 from an earlier version of narrative if you come into your tasks down here back in narrative um two point whatever you would have tasks and you would add these data tasks and that's how quests used to work but now they use these um new Quest tasks right these blueprint based tasks so if you want to convert your old narrative 2.x quests into narrative three ones simply go to quiz tasks complete narrative data task and then you can just copy your old tasks over I'm just going to copy and paste all of the stuff over and now this will work in narrative three so if you're upgrading from an old version you'll have to copy all of your old tasks over to new ones dialogues should work fine however um I would recommend if anything does not work for whatever reason delete your dialogue and recreate it and that should uh fix any issues you have but hopefully you don't have any issues um but there may be some upgrading from two to three might cause some problems because there are a lot of changes for quests though you will explicitly have to copy these old ones over to new ones for it to work thanks for watching the video I hope you love narrative as much as I do and if you have any questions please come into the Discord will be in the description go into the narrative Channel we have the narrative Forum as well and you can ask any questions there's tons of discussion and help and um we're always around to answer questions in here so yeah thanks for watching the video
Info
Channel: reubs
Views: 39,102
Rating: undefined out of 5
Keywords: Unreal, Engine, C++, Tutorial, Beginner, Game, Programming
Id: 8UPzGAv32xM
Channel Id: undefined
Length: 108min 29sec (6509 seconds)
Published: Mon Jun 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.