Let's Build the RPG! - 26 – Creating a Blueprint-Only Gameplay Ability System in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys in this episode we're going to begin development on a brand new blueprint only gameplay ability system from the ground up let's get to it [Music] so this this episode right here this is when we actually make the transition to beginning to make a game this is not going to be a fun episode in the classical sense of the word and most likely this episode will be ignored compared to all the fun stuff we got coming up in this series but this episode is absolutely foundational to the game that we're making everything related to blueprints niagara the basics of animation all of that we've been working on to build up to this the beginning of our gameplay ability system from this episode on not everything we do is going to be universally applicable to all rpgs so what do i mean by that well pretty much every rpg has a landscape pretty much every single rpg will have some foliage but the abilities of a game that's really what makes the distinctiveness of a game so this is the moment in this series where it ceases becoming this general thing and we start getting specific when i started out on this journey of learning unreal engine i told myself that my number one goal my highest priority was i wanted to get a working prototype of gameplay up and running as fast as possible so in short we need to create a proof of concept a demo of how the game is actually going to play and that means we've got to get into gameplay the gameplay ability system is the backbone of any game that you're going to have and the reason is because the gameplay ability system determines what in the game the player is actually going to do now in the process of learning to make a game i got really excited when i found out that unreal engine already has a game play ability system and it's designed with the structure to support virtually any gameplay ability any system that you'd like to have in the game but then i started digging into it and it became crystal clear right away i'd have to start learning c plus plus if i was going to use this but from everything i've learned about it it seems like a really good system and especially if i was working with a lot of other people it seems like the way to go because it already has a standard structure built out that everybody on a team can learn and then everybody on that team knows how to use that structure and they can work together to improve the overall system and the reason that that's important is because inevitably a gameplay ability system is one of the most complex parts of any game not only is it the animation and the special effects but it's how the game is actually going to be impacted whether it's characters environment everything related to what the player is doing and so i said to myself well if i was doing a run-of-the-mill game i would probably stick with this and i'd probably be forced to learn c plus plus but i'm not planning a run-of-the-mill game and if there's anything that i should design from the ground up to be completely unique it really is this how the game is going to play so how do we even begin conceptualizing a gameplay ability system so i came up with this basic framework and i don't even know if something like this exists standard in the video game industry but here's what i'm thinking so inevitably we have our ability inputs we have the things in the game that are allowing or causing the ability to occur so from a player's standpoint it's pretty standard right we're thinking of things like the keyboard mouse gamepad like a ui hop bar at the bottom of the screen that's pretty typical for any rpg but it's actually more complicated than that because for example will the player be able to customize their own abilities so i've divided this into sort of the basics and then game dynamics like how the abilities are actually going to function and then we have the outputs of abilities so inevitably you're expecting your character to do something on the screen right so there's animation there's visual effects typically there's sound effects so that's the surface level that's just what's going on on the screen but behind the scenes what's going on so there's effects on other characters there's effects on the players the player levels up by doing things and so the way i'm conceptualizing this is the top left corner i want this to be as simple as possible i want anyone to be able to pick up the game and start playing right away and typically the best games ever made they do this really well so i'm thinking things like minecraft or portal or the classic diablo series where you just go and you can play but then the other thing that makes the best games the best games is this down here so the more open-ended that this bottom right quadrant is the more open-ended gameplay can be the more viable paths to a solution to any problem in the game the better the game and so what i'm aiming for it's ambitious i'm gonna have something really simple up here the simplest possible ui but down here i want this game to be tremendously dynamic in the ideal circumstance you see games played online and people come up with strategies that the creators never even envisioned were possible and that's what makes an awesome game and as you would expect the bottom right hand corner here this is the most complicated stuff so we're not going to cover this right away this is going to be some of our later stuff so what we're going to cover today are just the basics to get a game play ability up and running so it's this top right corner the first and the second if you followed along in episode 23 and then also the activation and deactivation but all of this stuff we will absolutely get to in this series and pretty soon just in a few episodes we'll get to the ui hotbar so as the build basis of this episode we gotta talk a quick moment about blueprint classes and inheritance and you're probably already familiar with this based on the stuff we've already done in this series so whenever you create a new blueprint class you get a screen that looks just like this pick parent class and at first when i was doing this i thought to myself okay if i pick character then i just get the character stuff and if i pick the pawn then i just get the pawn stuff and it's actually a lot more sophisticated than that so whenever you create a blueprint in unreal engine what you're actually doing is creating what's called an object class and in the very first episode of this series actually it was episode three but it was the first episode where we actually did stuff i talked about objects and actors and how i use those two terms interchangeably but really i shouldn't because objects really refer to anything at all that's built in the engine and actors are a specific class of object so all actors are within object but not all objects are within actor and the same goes for pawns and characters so all pawns are actors and all characters are pawns and actors but not all pawns are characters and not all actors are pawns and the reason that this is important but not just for the gameplay ability system but in everything is that all of the properties of the parent the child gets so what i mean by that is if an actor has variables or if an actor has functions then all of the child classes pawn character etc they all inherit all of those functions variables etc that's what inheritance means it basically means you get all of the stuff of that class but in addition then for example here a pawn would get all the pawn stuff and so a character has all of the pawn features but in addition it also has the character features and this is tremendously useful throughout a game but for a gameplay ability system let's go into how i intend this to be used and so in this episode we're going to create a parent gameplay ability blueprint basically a parent gameplay ability actor and that's going to inherit from the actor blueprint class but then we are going to have at least five and probably just five gameplay ability subclasses basically child actors then inherit from the parent gameplay ability class and the advantage to this is that whatever i set up as a general gameplay ability characteristic whether it's certain variables certain functions etc then all of them can use those functions can use those variables but then if i want specific functions variables for fire abilities we got it right then and there and it's possible i might even do sub-inheritance i might have additional layers of classes beyond just fire but i think for now this is going to suffice now you're probably looking at this and saying to yourself neil this has been done to death there are tons of games with the four elements and a fifth element it's always a mystery element unless you watch the fifth element and then you know the fifth element so if i'm not making a run-of-the-mill game then why am i going off of this classical structure and the reason is that this structure is archetypal you can find in every single historical culture every single mythology you can find these four elements now they all vary in what the fifth element is but even there they agree that there is a fifth element and the typical modern response to that is well the four elements have no actual basis in reality but they're wrong because they have a basis in psychological reality they have a basis in how people think and that's what we're interested in games we're interested in the actual experience of the player and so every gameplay ability that i'm envisioning they're going to fit into one of these five buckets and this well we're going to leave it for a while we'll find out in the due course of time so here are the key concepts for today's episode we already talked about inheritance but we're going to get into some other new stuff by the end of this episode we're going to have the basics of our class structure created at least for our fire abilities and obviously the parent class to that and we're going to transition our first gameplay ability into that framework so let's get to it all right so we're going to begin today by creating our two gameplay ability blueprints and if we navigate over to content drawer and then into blueprints folder i'm going to create a new folder here titled gameplay abilities navigate into that and then we're going to right click and we're going to create a new blueprint class now we talked about this earlier we want all of our gameplay abilities to be subsets of actors because we want them to have all the functions features variables etc that are common to an actor so we could select actor and our first blueprint class here is just going to be called gameplay ability and then we're going to right click we're going to do another blueprint class and this one we have to come down to all classes and now we can search for our gameplay ability class which we just created and that's going to be our parent of what we're creating select and this is going to be gameplay ability fire and the reason we're just starting with fire today is that's what we did in episode 23 with the human torch light effect but eventually we're going to have four other gameplay ability child blueprints and on these actors this is where the bread and butter of the ability is going to be stored so things like the niagara effects the sounds what we want the ability to actually do but there's going to be a lot of things that are shared by all abilities and so for all those things we're going to store them on the parent gameplay ability actor and so examples of that are like how powerful is the ability but also things like the icon for the ability once we set up a hotbar and so that way the stuff that's shared by all abilities can be stored in one place and then the things that are truly unique to each type of ability like fire air water etc can be stored on those individual actors so there's three main blueprints that we're going to be working in today obviously these two but first let's navigate into our third person character blueprint so that's under my core folder bp third person character because this is where all the action is going to start and then i'm also going to open up the other two so go back to my content to our content blueprints gameplay abilities and we'll start with our parent and then i'm also going to open up the fire child so let's talk about how this is actually going to work so on our third person character this is where everything starts so right now we just have a keyboard button one executing our ability but in the future what i'm envisioning is that we're going to have a hot bar at the bottom of the screen but also a spell inventory the player can move ability icons from one button to another but they can also move them in and out of their spell inventory and then based on where the ability icon is on the screen that's the corresponding button that they'll use to activate it but before we build out that hotbar and we're going to get to that in just a few episodes but for now we're just going to stick with our keyboard buttons so before i mess up what i've got working already for keyboard button one i'm just gonna right click and search for keyboard two we'll select that and so this keyboard too that's what we're going to get the ability working on today and then once we're confident it's working then we'll get rid of all this because we can connect it up to keyboard one so what's going to happen when i press keyboard 2 is ideally it gets a gameplay ability or creates a gameplay ability and it gets that here and then from the gameplay ability that's created here it identifies a type of gameplay ability and from this generic game playability then it's going to go to the appropriate type whether it's fire air water and in this episode it's just going to be fire so the first thing we need is we need to define the variables that are going to make this setup work and the first one is we need to have a variable for the activated gameplay ability on our third person character because that's going to be what this references so to do that i can come over to variables on the left hand side hit plus and i can call this our activated gameplay ability and then for the type what's really neat about this is you can choose any blueprint class as a type so if i search for game playability because we've already created that object type we've got it and i can do an object reference and compile and save and so now this too is going to communicate over to our gameplay ability right so let's go over there and so let's set up our variables here so i'll hit plus and you heard me talk about how all gameplay abilities will have something that measures how powerful it is so i'm going to call that intensity and over here on the right instead of a boolean this is going to be a float because it's going to be a number and for all of these variables that live on each of the gameplay ability and gameplay ability fire in general you want to make them instanced editable and exposed on spawn and we're actually going to use this for the first time because when we spawn a new gameplay ability we're going to be able to define how intense it is now for this first ability it might not matter that much because the torch light is the torch light but it could still matter so maybe we want that light to be super bright but once we get into real spells and effects obviously we're going to want something that changes over time that gets more powerful as the player progresses so then you heard me say that the third person character blueprint is going to communicate to the gameplay ability but then the gameplay ability is going to communicate to whatever the child ability is but the problem is we need some way of defining what that child ability is is it a fire ability is it a water ability etcetera and so we need a new variable to do that and we could do like five booleans for each of the types but i think there's a much easier way of doing this and so i want to introduce you to a new type of build and it's called an enumerator so if you go back to your content drawer in the same folder we're going to create a new enumerator right now so if you right-click and you go over to blueprints so we have an option here called enumeration and think of enumeration as just a way of listing out one is this two is this and the benefit of this enumeration is we'll actually be able to do a switch based on that variable so we'll be able to say okay if water do this or if air do this and so we're gonna create a new enumeration here and we're gonna call this gameplay ability type and if you double click into that so we have an enum description and i can say game playability types and then we can add an enumerator and so our first one here this is going to be fire now we can add another one this is going to be water and if you mess up you can just scrap it by hitting the trash can over here and then we got earth we got air and the last one well for now i'm just going to do three question marks and save and so now let's go back to our content drawer because i actually want to set up one more enumerator and i was thinking about this and for our fire abilities we're actually going to have a few different types of fire abilities so for example i'm going to have a fireball and that's next episode and two episodes from now we're going to set up a flamethrower but those are fundamentally different abilities right because one is a sudden cast one time cast and the other is a channeled ability where the player can keep it going as long as he or she wants and then we also have this torchlight ability that we're setting up this episode and that does no damage so for those fire abilities but also for those other types when we get into it we need some way of distinguishing okay this is just a light only effect and no damage or this is a channeled effect and i think that an enumerator is the best way to do that so we might as well set that up right now so if you right click again we'll go to blueprints we'll go to enumerator i'm going to call this fire ability type and we'll double click into that and i'll just say types of fire abilities now we'll add an enumerator the first one is going to be light only because this is what we're going to do with the torch effect today and the second one i'm gonna make this single cast and then the third one i'm gonna make this a type of channel and that's gonna be something like a flamethrower where the player can keep it going as long as he or she wants and then the fourth type that i have in mind i'm not gonna clarify what it means at this point but i'm going to call this summon and i'll leave it at that for now and to be honest with this i actually debated okay maybe we're going to need separate child classes of gameplay ability fire because obviously each of the fire abilities is going to share some elements but maybe it would make sense to have a separate class separate blueprint for each of those sub-abilities and we might get to that in the future but i think i can do everything on one blueprint i don't think it'll be too complicated if you get to the point where you have like 100 functions on a single blueprint that might be a good reason to try to differentiate but i don't think it's going to be that bad you know maybe a couple dozen functions that we'll end up with but we can organize those we can categorize those by each of these different types and you'll see that over the progression of this series all right so now that we got our enums set up let's finish off our variables so let's first go to our gameplay ability and under variables here we'll hit plus sign and i'll call this variable ability type and then over here on the right now i can search for our enum so gameplay ability type and there it is and like i said for all of these make them instanced editable and exposed on spawn and that means that for every instance of our gameplay ability because there's going to be multiple instances multiple gameplay abilities that this variable will be different for each one or at least can be different for each one and then the expose on spawn you're going to see that in just a minute so let's navigate now to our gameplay ability fire we're going to do the same thing so our variables plus sign and i'm going to call this fire ability type and aptly it's also going to be fire ability type enum and same thing instance editable and exposed on spawn so now that we have our enumeration variables set up there's one more type of variable that we need to set up especially on our gameplay ability here and that's what's called a reference variable because each of these the gameplay ability gameplay ability fire every type of blueprint class for our gameplay ability it's going to need to be able to talk to two different things on a regular basis it's going to need to be able to talk back to our third person character and it's also going to need to be able to talk to the animation blueprint because depending on what the ability is doing it's going to change the animation accordingly and so to be able to easily communicate between those blueprints we got to set up what are called references and typically i set those up on the blueprints as soon as we begin play in the event graph so let's navigate over to the event graph we got our event begin play here and just make sure you're starting this on the gameplay ability so to set up a reference so we could talk back to our third person character it's very easy so we could just get player character and then from the return value here i'm just going to right click promote to variable and i'll connect these up and i want to rename this so i'll right click here rename and i'll call this third person character reference and this does not need to be instance editable or exposed on spocs it's just one reference but what i will do is i will classify that under a category of references and what that'll do is then any blueprint variable that i create that's really a reference i can just store under that category now the other reference we need to get our animation blueprint is a little bit more complicated so from our player character we need to get the mesh so get mesh here and then from that mesh we need to get the anim instance so basically we need to get the animation instance of what's being used for that particular character and then from that animation instance in order to communicate directly to it we need to cast to it so cast to abp third person character this might be called something different for you and the way you can tell is if you go back to your third person character blueprint the mesh so over here on the right whatever this is that's what you've got to cast to so i'm going to go back to my gameplay ability and we got a cast to abp third person character and now we got to do the same thing that we did over here so we gotta right click on this and promote that to a variable and instead of calling it as abp third person character i'm just gonna rename and say abp third person character reference and same thing classify that under references and the one addition i'm gonna do is i'm actually gonna take that get player character and just replicate it and the reason i'm doing that is because i'm going to end up splitting these into two different functions and you'll see why in just a second so i'm going to move these over here i'm going to select this one right click and collapse this to a function and i'm going to call this function our third person character reference and you can't name it the exact same name so i could say third person character ref and then i'm going to take our setup for a second reference here and i'll collapse that to a function and the reason we're collapsing to a function instead of a macro is because we're going to reference these functions on our child actors on our child gameplay ability fire in this case and that way those game playability actors will also have the same references and we don't need to duplicate the function for each individual child class so for this one i'm going to right click on the function rename this is going to be our abp third person character ref compile and save now here's the cool thing so over in our gameplay ability fire over in the event graph we need to do the same thing but we can just call the function because the function exists now on the parent class and any child actor can reference the functions and the variables that are on the parent class so we got that one actually i'm going to break this and i'm just going to say third person character ref perfect and instead of the event i'm going to do call function here basically any function can be called as an event but we're just going to call the function directly because it's going to be on event begin play third person character ref and this way for any gameplay ability the moment they begin play they're going to be able to communicate back to our animation blueprint and our third person character compile and save and then back on our gameplay ability blueprint i'm going to do the same exact thing with these functions give them a category of references same with this one compile save all right so now how do we trigger our gameplay ability off of our third person character so we're going to do something that's brand new we haven't done this yet in the series we're going to spawn an actor from class in the class that we're going to spawn from at first it's going to be game play ability but long term it's always going to be an individual child actor game playability fire air etc and the reason we need to spawn an actor from class is because these themselves are not actually actors so actors are physically in the world they exist and these are what are called classes so they have the potential to spawn actors to create actors of that class that share those properties but they're just potential right now there's not a physical thing that's been created and so that's exactly what we got to do and so at first we're going to do this all under the keyboard number two so if i right click i say spawn actor from class right here first thing we have to do is we have to select our class now you heard me say it is going to be game playability fire but for now let's just get this working directly with gameplay ability so if i select here gameplay ability choose the top one and what's cool is as soon as you select that you see that we've got a variable for intensity and our ability type of fire and so where is that coming from that's coming from these two variables that we set to be exposed on spawn because the moment that they're spawned over here we can change them we can set the intensity of how strong that actor from that class is going to be and we can also set the ability type now in this case because we're just doing a torchlight the intensity isn't going to matter and also the ability type is going to be fire but in the future this is definitely going to matter now the other thing we need to do to get this working is because it's creating a physical entity of some kind we need to have a transform to it so typically what i do here is i just get actor transform and that's just the transform of our actor whatever's spawning it and i hook that right up and now i'll connect this to our number two spawn actor and i'm just going to move this down here all right so once an actor for our gameplay ability is actually spawned then what do we want to do well the first thing is that i want to get a reference to it because as soon as that spawned i want our character to be able to continuously update and change that ability and that's going to become especially relevant when we have a channeled ability now i could just right click on the return value and promote this to a variable but we already got our variable here this is our activated gameplay ability so we can drag that in and say set and then connect this up then compile and save and so now once the gameplay ability is spawned what do we want it to do well we want it to do something right that something is going to be different with every gameplay ability but it's going to be something and so what i'm going to do is i'm just going to create a standard event basically a brand new event on our gameplay ability that we call activate and then i'm going to call that event right here but let's create the event first so if i go to game playability and so what i can do is i can right click on here and just search for custom event and add custom event and i'm going to call this activate ability and we can actually do the same thing for deactivate so i'll right click and i'm going to do a custom event again and this one is going to be deactivate ability i can delete out these two we're not going to need them and so now that i've got these two events created i'm just going to compile save if i go back to our third person character i can actually call that event so right from here i can say activate ability call function and even though it's an event you can call it as a function compile save so now let's actually test this right so when i hit 2 it's going to spawn an actor a gameplay ability it's going to set a variable so i have a reference to it and then from that reference it's activating the ability and by the way instead of doing this i could also just drag and get activated ability and then connect it up here it's really referencing the same thing so when it does this then it's going to communicate over here to this custom event so how do we test things well i'll just do a print string and i can say activated ability test successful all right let's give this a whirl huh compile save all right moment of truth it should show up in the top left corner here two activated ability test successful so if we go back into our gameplay ability just make sure we've got our activate ability event we got our deactivate ability we are all set for the next step because you heard me say earlier we actually don't want to create an actor that's a game play ability right we actually want to create an actor that's more specific than that whether it's fire water etc so if i go back to our third person character what i'm gonna do is i'm gonna delete out this right here spawn actor gameplay ability and then instead of that we're gonna do it again spawn actor from class and we go to class and if i search for gameplay ability fire and so then what you'll notice is i get three variables i get the variables that are on game playability because those are the exposed on spawn variables on the parent class but i also get the fire ability type because that's the exposed variable that we set up here and what's going to happen as we build out our gameplay abilities is there's going to be more and more exposed variables and we're going to set those as we get our abilities and in the future i hope that the player is going to be able to customize their abilities all sorts of stuff it's going to be awesome but we'll get to it in the due course of time so i'll hook up our actor transform we'll hook up this and we'll do the same thing return value activated ability right like that so now this is going to spawn a gameplay ability fire and it's still going to activate the ability on the generic gameplay ability here and the reason i'm doing that is because i'm just going to have one way to activate the ability all paths of activating abilities are going to progress through the gameplay ability blueprint this is going to be like a big switchboard and so once it activates the ability then it's going to have the ability to switch based on the type of ability so how do we do that well we've got our ability type right we can get that and we can do a switch based on the game playability type and this ability type is going to be set as soon as it's spawned because it's right down here so what do we want it to do for each of these well each of these is going to have a separate blueprint class right so we can cast to that individual class so from fire i can drag out a pin and i can cast to gameplay ability fire and you see this object is grayed out i'm just going to drag out and search for self so get a reference to self and what that's doing is it just means i'm casting from this actor directly to game playability fire and do a reroute reorganize that a little bit and so now what do we want to do when we cast a gameplay ability fire we need to do something right we need to have some sort of function here so over on game playability fire i'm going to delete out these we're going to do the same kind of thing as activate but now we're going to do a custom event called activate fire ability activate fire ability and we're going to do the same thing with deactivate custom event and deactivate fire ability compile and save and then back to our game play ability so in the spirit of acting as a switchboard that's exactly what this is doing we're activating a generic ability here but then depending on the ability type it's going to cast to the appropriate blueprint and that's where it's going to do its thing it's going to activate a fire ability over here so then we can drag out a reference to this we could say activate fire ability and we're going to do this in the future for other types of blueprints obviously but we're going to do this gameplay ability by ability and so now we can do the same thing with our deactivatability here too right so i can copy all this and then paste it down below and connect this up and then instead of our activate fire ability what's this going to be so this is going to be our deactivate fire ability and this is coming from what we just set up right here i'm going to make some more space because eventually we're going to need it compile save so now how can we test this well if we go back to our gameplay ability fire and from activate fire ability we can do a print string there so we could do a print string and we could say testing fire ability let's just do that and compile save moment of truth all right so keyboard button two testing fire ability there it is bingo two two two yep fire fire fire good to go so now let's set up what we actually want to have happen in our gameplay ability fire blueprint on activation so i'm going to delete out our print string and make some space here first thing we got to do is based on our fire ability type we're going to do a different execution so we could do a switch based on the type connect this up and so for now we're just transitioning the one ability we have which is a light only and if i go back to our third person character blueprint and i go up to the number one on all this by the way we set up an episode 23 but what that's doing is it's setting our right arm holding up variable on our animbp and so that way the character goes like this whenever they got the light activated so we're basically going to copy that exact same setup so i can copy both of these copy come over to game play ability fire and paste but now this atom bp reference this isn't going to work here right because that reference is only set up on our third person character and we also set it up on our gameplay ability but we haven't set it up yet on our gameplay ability fire so i'm going to delete this out and i can get the variable that we previously set up on our gameplay ability so we set up abp third person character reference so on our gameplay ability fire we can get that so get abp and there it is get abp third person character reference connect that up and then i'm going to move these up here connect that up to light only put in a redirect and so now after that 0.2 second delay and that's when the character is actually raising their arm what do we want to have happen so here is where we spawn the niagara system right because back in episode 23 that's exactly what we did here but here it's connected to the mesh right so if i go back to game playability fire we're going to do the same kind of thing but we need to get a character reference so i could search for get third person character there it is get third person character reference and then i can get a mesh reference and then this is what's going to be connected up to the spawn niagara system and so i can drag out from retriggerable delay and say spawn niagara system attached and the attach component is going to be the mesh and i just want to make sure everything here matches up to what we already got so over here so we got to get the hand r socket i can copy and paste that to the attach point that's got to be exactly right and then also we set the z to negative 20 over here i'll do the same z negative 20. and now we could promote this to a variable but instead what i'm going to do is i'm going to add the niagara component directly to this gameplay ability and i'm going to call it niagara system one and so then what i can do is when i spawn this system i can set it to be this component that's attached directly to the ability so i can say set niagara system one right there game playability fire because any components that are part of our blueprint they're automatically set as variables down here so then we got to set up the same thing for deactivate right so if i go back to third person character so what are we doing when we're deactivating well we're just doing both of these things so we're destroying the component and we're setting right arm holding up to be false so if i go back to game playability fire i'm going to copy our switch because it's going to work the same exact way connect this up and so again i'll just copy this as a reference paste that in here and then i can get a reference to our niagara system here and i can say destroy component connect that up so let me just move these out tiny little bit because there's going to be a lot more stuff here for all the different types so if everything looks like this you should be all set compile save so now we gotta set up our player character to be able to reference all this so if i go back to the third person character blueprint zoom out and i'm not going to delete out anything from number one here from episode 23 until we confirm that everything's working for number two and so right now when i hit number two it's just going to activate the ability and instead we need to switch to a toggle so what i'm going to do is i'm going to move this out and very similar to what we set up last episode i'm just going to check to see is our activated gameplay ability valid because if it is valid then we can disable it and if it's not then we can enable the ability but before that i'm just going to make some space here as always and so what we need to do is drag in activated gameplay ability get and we're just going to check is it valid and you could choose the question mark here just to get the function and that allows us to hook up the execution pin is valid do this and actually this is going to be if it's not valid right so if it doesn't exist then it's doing the ability so i'm going to hook this up here and if it is valid what is it going to do well we've got to get a reference to our activated gameplay ability because in order to deactivate it we need a reference and then we can say deactivate ability and we can connect this up re-wrap i'm going to move this down a little bit the other thing i'm going to do is i'm going to destroy the actor because once it's deactivated i can just destroy it and then it's not taking up memory anymore all right so let's test this out compile and save and here we go so moment of truth i hit 2 and the hand raises and nothing's happening and then if i hit 2 again and then after i close out of play mode i get this message log saying access none trying to read property niagara system one so what's going on here so if we go back into our blueprints and if we go back to our game playability fire the first thing is i totally forgot to assign an actual niagara system because the niagara system that's supposed to be assigned up here is torchlight underscore ns which we created in episode 23. so torchlight there it is so let's give this one more whirl and see where it goes from here number two boom number two again and the hand does not go down so our next mistake so when i copied our right arm holding up down here for the deactivate i forgot to uncheck it and whenever i do this i always think to myself well do i record the episode where it's perfect it's pristine or do i show them when i mess up and in this case you could see firsthand you know the troubleshooting all right so here we go again if it doesn't work now really embarrassing so two and then two yep so far so good we are good and i can run and it readjusts the fire position i can hit two again while running so the last thing if i go back to our third person character and i can take out all of this build that we set up in episode 23 i could take out our number two i'm just gonna move all of this up to our number one right here so actually i'm gonna move number one down pressed and we'll do one final test so i'm running i hit number two now nothing happens number one there we go number one again and i can spam it i can spam it again and again and again and again and again and it doesn't activate until the 0.2 seconds is elapsed guys i apologize we got to do a quick addendum on the gameplay ability blueprint i made a mistake on the third person character ref function so if we go back into that function and what i made a mistake of is that this reference i set to be a type of character and instead it specifically needs to be a third person character and the reason for that is unless it's a reference to the third person character type we're not going to be able to access any functions or variables that are on our third person character so the way we can fix this is i can just drag out some space and from our get player character i'm going to cast to bp third person character here connect this up connect this up here and now i've got to connect the as bp third person character up there but the problem is i've got to change this type so on the left hand side here from character i'm just going to switch this to bp underscore third person character or really whatever your third person character type is object reference and change variable type and last but not least compile and save so on the gameplay ability blueprint if third person character reference is now bp third person character or whatever your actual third person character blueprint class is then you're all set so that concludes today's episode but in our next episode we're definitely taking our gameplay abilities up a notch we're gonna put together this somewhat more substantive flamethrower effect so i hope to see you there
Info
Channel: NumenBrothers
Views: 28,319
Rating: undefined out of 5
Keywords: GAS
Id: ZvlQrJrPg-U
Channel Id: undefined
Length: 36min 21sec (2181 seconds)
Published: Sat Aug 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.