Randomize your NPC/Character - Unreal Engine 5.2 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there I'm your host lasoe and in today's video I'll show you how to create an array of colors which you'll be able to use to customize any of your characters and give them a unique look so let's begin go to your content drawer and find the character you want to use so for me it's going to be DP underscore brood and if I double click and go to my construction script it will be the place where I set these parameters so first of all we need to know which material we want to use so one good way to check if you go to your skeletal mesh you'll have something called a material slots so instead of here we have element 0 all the way how many materials you have and I know that for this character the pants are element 2 and body is 11 7. now this is important because if you don't send the right element the color will be in the wrong place so even for example if I wanted to change the X I can see that this is silver so it probably will be 11 0. so let's click X and go to the textures and find the pants so we have pants over here if I double click inside of this I can then create a parameter called a scalar parameter I'm going to call this brightness and the value will be 1.0 from here I'm going to hold down M and press the left Mouse button twice or to multiply nodes and then once again I'm gonna get a parameter this one will be Vector parameter and I'm going to call it color then what you want to do from the first one connect it into a then the outcome of the first multiply node will go into base color the B value will go into the outcome of the second multiply node then the color will go into a and B will go into the RGB for the texture sample then one more thing double click on the color and set it all the way to White press ok then we can apply and Save so that's essentially done with the material now let's create the material instance so if I find the pants again create material instance so this is what we'll use for our color so I'm going to call it pants underscore zero one and I'll create a duplicate and one more duplicate just to show you so um this one press OK for brightness press OK for color and the color I want will be blue for example and if I'm not happy with the brightness I can always just increase this slightly that's okay then let's go to our second pants this will be brightness color again and let's say I wanted an aqua color and again I'm not happy with the brightness so we can increase that a little bit then for my third pants um let's say I want something like pink once again not happy with the brightness increase it a little bit then we can exit from these and if I wanted to change my body we can do that as well so this says body underscore m84 so double click into this and the same principle applies so I could even make my life easier I could go into the pants and just copy these notes Ctrl C and in my body we can paste this and just hook it up so it will go into the base color and B will go into RGB so I can hit apply and I can hit save then let's exit and in my body let's create a material instance called body underscore zero one and let's create one more so just duplicate this and let's say the second one I want to be a darker color so let's go for something like black like so press ok in my construction script of the brute I'm going to drag the mesh which is the character mesh and I will do set skeletal mesh asset so you don't need to do this step but let's say you have a brute with an ax and a brood without an X so if you'd like to place both these assets this would allow you to randomize that so just to show you how this would work if I connect this to the outcome and for the mesh I'm going to select root because that's what we're using and then what I will do I will create a variable so I'm going to promote this to a variable call it skeletal ref break the node and if I convert this to an array then we can compile and save and this will be create a parameter this will be my Brute so it should allow me to compile now and let's say you had more of these guys so an ax or a brute without an ax and a brute with an ax so you'd be able to use both of them and it would randomize it for you so from here we would get a length then I would get a random integer and then once again I would get a copy and then if we connect all of this we've connected into the new mesh over here so now to show you how to create the color from here we can do create Dynamic material instance and same principle applies let's create a variable and this variable I want it to be the pads so it will be called Pants ref and for the type I'm going to create material instance and let's get a object reference nope that oh yeah it did so compile and Save and if I drag it on the screen get it we're going to trade length again then get a random random integer and let's get a copy connect this like so and then inside of my pants reference let's create three elements and select the colors we've just created so here I have a bit more um yeah I have the body and I have the pants so let's select pants aqua and pink and connect this here and remember because this was element 2 in the skeletal mesh it should be two and body was number seven so let's create another one but before we do uh this has a problem that's because I didn't connect the mesh over here now if I compile and save this should work so so just to show you if I drag my root on the screen and create another one it'll randomize the paths so to change the skin color let's go once again into our construction script and we can copy this Ctrl C Ctrl V and instead of our pants I want to use the body so I'm going to delete this with another variable called body under our body ref and it's also going to be a material instance and if I get it connect here and here then for the elements let's create two because that's what we have body 1 body 2 and if I set the element index to 7 and then compile and save everything should work and our boots should get different colors I hope you guys enjoyed the video If You did leave a like if you didn't leave a dislike and as always happy developing
Info
Channel: Lisowi
Views: 989
Rating: undefined out of 5
Keywords: Unreal Engine, Unreal Engine 5.2, UE5, Unreal Engine Materials, Unreal Engine Customization, Unreal Engine Random NPC, Unreal Engine Character material
Id: sSZLMdv9BkQ
Channel Id: undefined
Length: 8min 8sec (488 seconds)
Published: Mon May 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.