Welcome back.
Now, in this video, we're going to very quickly see how hard it is to fight all these enemies with
ora's measly little one fireball attack.
But we're going to do our best to defeat them all, because I'd like to encounter a specific problem.
I won't say bug, because it's really just something we haven't implemented yet.
And that is what happens when we destroy or kill our enemies.
What's happening from their behavior tree standpoint.
So I'm going to press play and I'm going to do my best to just defeat all of my enemies before they
defeat me, especially those ones that launch projectiles.
Right?
Those are the worst.
I always try to get those projectile launchers before everything else because they just sit back and
they try to hurt you and it's really annoying.
All right.
Now, here's what I'm talking about.
Look at this.
Those enemies are dead.
And after they're dead, they're still firing.
So why is that?
Well, if we open our behavior tree.
Notice we're never checking to see if the enemy is dead.
The enemy doesn't even know from the behavior tree standpoint whether it's dead or not.
We're going to need a blackboard key that we can set whenever our enemy dies.
And that way the behavior tree will know if the enemy has died yet.
So pretty simple fix.
We're going to go to our blackboard.
We're going to add a new key selecting BOOL.
We're going to just call it dead and we're going to check this key.
We're going to check it right here before doing anything else in this selector.
So I'm going to right click and I can add it right here.
And before I do, I notice that I really could name these nodes.
This one is checking, hit, reacting, making sure hit reacting is not set.
I'm going to change the node name to say am I not hit reacting?
And this one is checking if Target to follow is set.
I'm going to say.
Do I have a target?
And we'll add one more.
It's going to be a decorator blackboard based.
And I'm going to rename this one right away.
Am I alive with a question mark?
Now this one's going to check Dead.
So Blackboard Key will be dead.
And we don't want to continue unless dead is not set.
In other words, dead should be false.
Now, if this condition changes, I want to abort everything immediately.
So I'm going to change notify observer to on value, change and observer aborts self and lower priority.
In other words, I'm going to select both.
So it's going to abort the entire tree if the enemy becomes dead.
Now we just need to set this blackboard key and we can do that when the enemy dies from C plus plus.
So I'm going to save all and close the editor.
So I'm going to go into Ora Enemy and find its die function.
Here it is.
And we don't care about the multicast handle.
Death function only die is what matters.
That's what's called in the server.
And for enemies, we're going to set that blackboard.
Key value.
How did we do this before?
Well, if we go to possessed by, we can see how we're setting a value as BOOL.
We're going to copy that line there and we'll go back to the die function.
Paste that line here.
We should have a valid AI controller, but we'll check just in case if or AI controller.
And the value that we want to set is the blackboard key dead.
And we want to set it to true if we've just died.
So that should set that blackboard key and that should prevent us from doing anything in the blackboard.
So we can go ahead and compile and launch the editor.
And we can test this out.
I'm going to go ahead and just kill some of these enemies, especially those ranged attackers.
Let's see if we can kill them first before I get taken out.
It's actually becoming a little bit more challenging, isn't it?
Now that we have more enemies, it's a little harder.
We're going to need some more powerful spells.
I need some aoe spells.
That would be nice.
Okay.
And I'm not getting fired at and that enemy has died.
So it looks like we've done our job.
Excellent.
So as I was saying, it's becoming harder to fight these enemies without getting damaged.
Now, that means we need a way for aura to get more powerful, gain more stats, gain more abilities,
level up her abilities.
It would be nice if our fireball could level up and get more powerful.
It'd also be nice if we had some more area of effect skills.
So we're going to need to do that and we will be doing that throughout the rest of the course.
But more importantly, what happens when we kill an enemy, right?
We should be gaining experience.
We currently don't have a way to know what our experience is.
We don't have a way to know what level we are.
We need that sense of progress, right?
We need to know that we're getting stronger, which means whenever we destroy or kill an enemy, we
should see some kind of experience gauge go up.
And once that experience gauge reaches a certain threshold, we should level up.
And that means we should get more power.
We should be able to open our attribute menu and spend attribute points.
Remember, this top row is reserved for attribute points.
That's something that we still haven't implemented yet.
Our character has a level that's also something we haven't implemented.
So these are the things that we need to make sure we have in our game.
And once we're gaining experience and getting progress and gaining attribute points, then we can start
thinking about expanding our spell repertoire.
We can create a spell menu with a spell tree and gain spell points when we level up, and that will
give us the opportunity to implement things like leveling up our abilities, creating newer, more powerful
abilities and so on.
And with those newer, more powerful abilities, we're going to discover different techniques that we
can use with our gameplay abilities, including opportunities to create gameplay.
Cuz the last missing piece of this gas puzzle and that is going to really give us the sense that we're
playing an actual RPG game Once we have the ability to create that fun cycle where you're gaining progress,
getting more powerful, killing more powerful enemies and the cycle continues for now.
Great job and I'll see you in the next video.