Welcome back everyone. In the last video we went about creating our BP fireball. In this one Our goal is to set up our player with the appropriate components, variables, functions, etc. In order to lay the groundwork for our player actually shooting out a fireball. So the first thing I would like to do here is to import a sound effect. I've got a fireball shooting kind of sound effect that I want to import.
You should find this attached to this particular video in the course outline. I have mine in my file explorer here. So I'm going to come to my Metroidvania audio folder, where we have been dumping our various sound effects. And with Windows Explorer open here, I'm just going to drag and drop my SF x fireball. Left click drag it down into this folder. You should be able to Find this file after you have downloaded it likely in your downloads folder, although you may have it downloading elsewhere, that will be up to you to find.
Okay, so with that imported, we can then go inside of our BP player and start working in there. So come under blueprints, characters, there's our BP player, open it up. And I've got some existing tabs open from the previous videos, I am just going to close out quickly only concerned with the BP player for now. I'm going to click on the viewport tab. So we get to see our character few things I want to add in here. The first I'm going to add is a fireball spawn point component.
That's the point that we're going to designate where we want our fireball to shoot out from. And this is going to be from an arrow component. So in my list of components, I'm going to click Add Component and I'm going to do a search. For an arrow component, there's utility arrow. There it is, and I will name it fire ball spawn points. Okay, it's this giant red arrow sticking out from our character's pelvis.
At the moment, select that. And with that selected over in the Details panel, let's change the x location of this to be 70. It's going to put it out in front a little bit, and I'm going to change the Z location to be 20. Now why this exact location? Well, because when we have our character playing a sort of casting animation, or hand is going to end up at right about this position. So that's about the spot where I want the fireball to spawn from, we can leave the rotation and the scale as is.
Okay, so with that in place, we're gonna go on to creating some variables down in our My Blueprint panel, and we're going to be working inside of our magic black fireball section of Variables right here. So when we add some variables we're going to add them to this grouping this category. Okay, so the first variable we're going to add by clicking plus variable is going to be called renaming it here. Be Used fireball course question mark this will be a Boolean again I'm going to put it in my magic black fireball a category now this use fireball the primary use of this one is going to be to drive our animation we're going to have a you know fireball casting animation. So that is a variable that's going to be passed to our animation blueprints by defaults if I compile this, I do want this to be false.
Okay, creating a another variable here coming under variables plus variable. I'm going to create one called be fire ball. Ready, question mark. This will also be in our magic black fireball category. compile this is well, and of course it changed my variable name here. I must have screwed up there.
So be fireball ready? was what I wanted to call this question mark, compile that and I do want this to be true by default. Okay, um, this one is going to sorry let me flip my page notes here. So this is gonna set true again after a delay here, this fireball ready. It's going to act in concert with our next variable that we're going to be creating here. So create a new variable.
This one is going to be a fireball cooldown. We will make this a float variable Put this in our category of magic black fireball compile and the default time I want to set for this is going to be 1.13 seconds why that weird value? Well because that is about the length of time that our casting animation is when it plays and I basically want to make it so that we can cast a fireball again once that fireball casting animation has finished up so you can't spam it over and over and over again. Okay, I'm just gonna be doing some reorganization of my variables here because I'm a DD like that so I've got B has B magic fireball on top the next one I'm going to put is be use firebomb left clicking and dragging over here. Then be fireball ready. Then our fireball cooldown left clicking and dragging that right up there.
Then we got data in attributes that is all looking splendid. Okay, earlier in the course We made a function called update man on, we need to jump in here and update it because we now have some mana cost values that we want to take into consideration. So you can double click on this Update Manager right here. And if you remember right, this is where we left off and on this node right here, I even left a note that said that this is temporary. Okay, what I need to do here is select our update Amana input node. I'm going to click right here to add a new parameter and I'm going to call this magic attributes.
And our variable type here is going to be our struct str magic attributes. Okay. Now, I am also Going to add another output here, click this plus new parameter. And this one is going to be called Sorry, I do not want to add one there, that is my bad. I don't want to add one there, scratch that I'm looking ahead my page notes. That's not the one I want to add out of our update man here.
So now we've got this magic attributes input node right here. I'm gonna drag out of this in type in a break the magic attributes. Because if you remember in this struct, if I expand this down is got a mana cost associated with it. And I'm going to plug this into this subtraction node right here. So when we cast a fireball spell, we're going to be calling this function and we're going to be taking our current manna amount and we're going to be studying tracking the appropriate manner cost based on whatever it is we're trying to cast. In this case it would be a fireball, which I believe was five manna, I don't really recall off the top of my head, I can right click on this node and get rid of this temporary node comment for now.
Okay, so this function is looking pretty good I do need need to create another function inside of our BP player here. So if I come over here into my my blueprints, panel functions, we're going to create another function. This one is going to be called check, if, check if enough manna to use magic. And I think that function name pretty much describes what we're looking to do here. So here I'm going to select my entry tunnel note. I'm going to add that input.
This one is also going to be called Magic attributes. Let me capitalize that magic attributes. It's got that str magic attribute struct already listed in there, which is what I want that I'm going to right click in some empty space here in our graph, and I'm going to add a return node. And with that selected, I want to add an output to this by clicking this plus parameter button. And I must have clicked rather fast. It already added one on there, I am going to change this to be enough mana question mark.
This is going to be a boolean variable. So we're going to do an evaluation here to see if we have enough mana to actually cast the spell, in this case, the fireball. So the way we're going to do this is we're going to drag out of our magic attributes. We're going to break that structure we are going to drag out of our manner costs in the input in a less than or equal to sign. And the thing we want to evaluate is if our cost is less than or equal to our manna current. And where did I put that in player attributes, there it is man a current, left click and drag that on top right here.
And right up above here, we're going to bring in a branch node, hold down B and left click, that is going to be the condition we're going to check against in this function. Hook this in. And if this is true, sorry, we actually don't even need that. We don't even need this branch My bad. We can plug this directly into our enough manner return node. So this is our function right here.
Alright, let me check my page notes to see if we have missed anything. No, that looks to be it for this video let's Compile and Save quickly. still more work here to be done. We still need to create the use fireball script that is upcoming. We will see you guys in the next video.