All language subtitles for 002 Shooting Enemy AI[UdemyIran.Com]

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In this lesson, we're going to create a stationary enemy that just keeps on shooting projectiles.

Let's first start out by making the lizard blueprint.

As we have established in the beginning, the BPM lizard is going to be based on the BPM base, which

then again is going to be based on the BP action chart base.

So all of the paper XRD settings, parameters, health, all of this is going to be passed down here.

And the turn character function is on here too.

But I don't think we're going to use it for the lizard.

And then all of the other stuff and the shoot interval system is going to be on the lizard itself,

which we're going to create in this lesson.

First, we can just close everything down here.

Just close tabs to the right, go to the content, draw blueprints characters enemies and right click

the BP enemy base.

And here just create Child Blueprint class.

And I'm just going to call BP Enemy Lizard.

And open it up.

And now we just want to go to the sprite.

And here select the lizard.

Idol.

Just like this.

And as always, we want to adjust the capsule collision slightly.

Right.

So in this case again we want to go to the capsule and we can make it smaller like this.

So around 45.

And then put it in the level.

Like this.

Just drag out one here on top of these boxes and make sure it is -50 on the y axis.

I just mistyped -50.

And yeah.

So now you can see it is on top here.

We want to turn it around so it shoots towards the player.

So we can just go to rotate mode and rotate around by 180 degrees.

And now we can just start the game, we can simulate and we can zoom in here and see that now the sprite

is actually inside of the floor.

So we again want to adjust the position slightly.

So on the enemy lizard we can just go to the sprite.

And here just drag around a little bit.

And this looks about right.

A little bit more to the bottom.

So I think about 16.5.

Yeah 16.5 looks like the right value.

So we can just copy this.

Exit out of the game.

Go to the sprite on the lizard.

And here just paste in 16.5.

And now it's going to have the right height here.

And now if we go to selected viewport we can see that everything works for the lizard right.

We can take damage from the lizard.

We can shoot the lizard.

All of these things are working.

But actually it takes a lot of damage because the health is really high right now.

So on the lizard here, we can go to the top and we can just look for the health.

No, actually it's here on the BPP vitality and just set the health to three also.

And this carrot isn't going to move.

It's either going to be idle or it's going to be shooting a fireball.

So let's create the fireball, the projectile first.

Go through the content drawer.

Under blueprints.

Projectiles.

Enemy.

We don't have anything here yet.

Right.

So as we also established before or the projectiles, we want to have the BP projectile base.

We already created this.

We created the player projectile and we created all the three sub player projectiles.

But now we want to create the BP enemy projectile base.

And this isn't really going to have any properties or anything.

This is just here for good practice.

So if we want to create something else later, we can just easily do this and have these all under the

same umbrella.

And then we just want to create a the enemy projectile lizard and change the flipbook, maybe change

the damage.

So back here go to the projectiles folder, right click the BP projectile base and create a Child Blueprint

class.

And then just call BP Enemy Projectile Base.

And drag this into the enemy folder like this.

And from this again create a child create child blueprint class.

And this is going to be BP enemy projectile lizard.

And this one we want to double click.

In here for the flipbook.

We just want to go to the flipbook and here we can look for fireball.

Yeah, we have the fireball loop.

And yeah.

So it has the same animation.

It's just a different color.

And one thing we talked about before is we want to make the player feel good.

Right.

So the collision on the player projectile should be bigger than it looks.

But for enemies we usually want to make it a little bit smaller than it looks to not have this feeling

of, hey, that shouldn't have hit me.

So we can just go to the sphere and make the sphere radius smaller.

So I think for this one actually, we can go like this.

So it is a little bit smaller than it looks like.

And this is going to make a huge difference in how fair your game feels.

We also want to check the damage.

So when we click here here you can see projectile damage one which I think is a good value considering

our player has ten health.

Now in the enemy lizard, we have to create a function that actually spawns this projectile.

Just click on functions, add a new function and just call it.

Dude.

Fireball.

And now we just want to spawn actor.

From class.

And here select our lizard fireball, the BP enemy projectile lizard.

And here the spawn transform.

We just want to split the struct pin again.

We don't want to have anything for the scale.

The default collision overwrite.

Just always spawn ignore collision to make sure it always spawns.

And for now we can just get actor location to spawn it in the middle of the enemy.

And for the transform the same get actor rotation.

And we're going to change this later to make it come actually from the mouth.

Now let's create an AI controller for the lizard that tells it to shoot at certain intervals.

Back here in the content drawer.

Go to blueprints AI and on the AIC base right click Create Child Blueprint class and called AIC lizard.

And in here we want to do the same thing again we did for the grab.

So on the event graph we don't use the Beginplay.

Get rid of this.

Instead we use the on possess.

Event on possess.

And here we again want to cast the possessed pawn cast to.

In this case, BP lizard.

Actually BP enemy lizard.

And we want to save a reference, promote the variable.

And it's called owning lizard.

Like this.

And again, now we can just use this variable anywhere in our code.

In this case, actually we don't have to use the tick event.

There is a better way for doing this if we just do something at set intervals.

We just want to delete the tick event and create a custom event.

And I'm just going to call it shoot projectile.

Like this.

And what do we do here?

Well, we just call on the owning lizard.

We just shoot fireball.

Like this.

And we just need this event so we can call it from a timer.

It's just a very simple thing, but we need this to call it from a timer.

And how do we call a timer?

So after we possess we just say set timer by event, which we've used before.

And for the event, just look for event and create event.

And here we can then just pick this shoot projectile right.

So we can just look for shoot projectile.

And this is just gonna call this event for us.

We do want it to loop.

So it shoots over and over again.

And here we can give it the interval timing.

Like should it shoot every one second every two seconds.

And we can just set a value here.

For now, let's just try every three seconds and promote this to a variable.

And it's called shoot interval.

Like this.

And to activate this in the BPM lizard, we just want to select the top level and look for AI.

And we have the AI controller class.

And here we just want to select the AIC lizard now.

And this is fine placed in world or spawned.

So we can just compile and save and check this out so I can start the game, can defeat some enemies

and go towards the lizard and you can see that it shoots fireballs every three seconds.

And the functionality is now built in, but it doesn't look like the lizard is actually spitting the

fireball.

We still have to change the animation for that to happen.

And also if we get hit by the projectile, you see that we kind of fly off in the wrong direction.

And also if we exit out, we get an error message because the damage causer is not set.

But that is actually something we'll take care of in the next lesson.

So for now, just ignore it.

Let's look at the animations for the lizard.

We can go to content paper, assets, characters, enemies and lizard.

We have a jump animation, but we're not going to use this.

And we have the shoot animation here.

And this is a really nice animation because it is telescoped, it lets the player know this enemy is

preparing an attack.

And then here on frame three or frame four, actually we're just going to shoot the projectile.

But to do this, we actually need to learn something new because we don't want to shoot the projectile

right when we start the animation, right?

We actually have to wait for the animation and then let the animation decide when we want to shoot the

projectile.

And now again, we have to decide for this character.

Do we use the base paper 2D method without the plugin, or do we make use of the plugin even though

it takes some time to set up?

And I believe in this case I do want to use paper XD because a great feature of it are animation notifies

and activating an event on a certain frame without paper XDD you can still do it, but it is actually

quite annoying.

And on tick you always have to check which animation are we playing currently, which frame are we on,

and then use a do once node to execute an action.

It isn't very intuitive and it's not a great method.

So I think for this we just use paper XDD.

And this also gives me the chance to show you anim notifies and how awesome they are.

So let's do that.

Now in the content drawer we want to go to content blueprints, characters, enemies and we want to

create a folder for the lizard.

And just drag in the BPM lizard like this.

And now right click here paper XDD.

We're going to do the same thing we did for the character.

So first create an animation source and it's called as Enemy Lizard.

Now open this up.

And here we have to register the animations.

So just add new and we want to rename this F2 idle.

And double click.

And on the right side just look for Lizard Idol.

And zoom out here with the scroll wheel.

And then we also want to add the shoot animation.

And here again, double click and look for lizard and shoot.

We don't want to use the jump.

We're not going to register this even just use the shoot animation.

And yeah.

So now we can see this here.

And at the bottom here you can see a timeline.

And this is going to come into play later.

But now we just set up the animation blueprint as well.

So back here in the content drawer in our lizard folder we just right click again paper 3D not paper

2D.

And look for the paper Z and MVP.

And here we have to select our as enemy lizard to base it off of.

And then a BP enemy lizard.

Like this and open it up.

And again on init.

When this is initialized we just want to get owning actor.

And then just cast this to be enemy lizard.

And save a reference.

Promote the variable owning lizard.

And then again, we can just use this in our anim graph like we did for the player.

You've already seen how useful this is.

Open up the anim graph.

And here again just right click create a state machine.

Add new state machine.

And I'm going to call it locomotion like I always do for the basic one.

And just connect this here and now in here we just want to set up the Idle so animation state idle F2

to rename it.

And this is something we've already done before.

So I can go quite fast.

And in here we just want to play idle which again we have access to because we registered it in the

animation source.

Right.

And this is pretty much all we do here.

We only need this one state.

And now for the shooting.

There's multiple options.

We have to implement it.

We could just make another animation state, call it shoot and then transition into it.

Transition out of it.

And this works just fine.

But it's a lot of work for this.

We could again just use a jump right.

And then jump into this and then go back to idle after we're done playing.

This also works fine, but for a one off animation like this, there's actually an even better method.

So we can just delete these two and we go one step back to the anim graph.

And between the state machine and the output animation we have to add a slot so we can just drag off

here look for slot and have a new override slot.

And we can just connect this here.

And this is just necessary for us to use the animation override feature.

And if you've worked with skeletal meshes before, this is pretty similar to animation montages.

And the slots we have for them as well.

So we can pretty much just ignore everything that is happening here and just overwrite it here with

our attack animation or something else.

So now back in the enemy lizard.

Instead of shooting the fireball, we can just hit alt and click this line.

We just want to play the animation for now.

And this is actually quite easy because we set up this slot here.

Now in the blueprints we can just get the animation component from paper XDD.

Here get anim instance.

And here we can just look for overwrite.

And here we have three functions related to overrides.

And the one we want is play animation override like this.

And just connect it here.

And yes.

So this gives us the target.

The target is the anim instance.

The anim sequence is the thing we want to play, the animation we want to play.

But here we have to be careful.

There's actually all the animations for all the characters, and we need to make sure we pick one that

works with our character.

So especially in the case of let's say it's idle, it is really hard because you have three different

animations that are called idle.

So if you hover, you actually have to look at the path.

You see game blueprints, characters, enemies, lizard anim sequence, and here you see blueprints,

characters, player anim sequences.

So this path can actually help you figure out if this is correct for your character.

But now we just want to use the chute.

And here again we need to be careful because there's multiple shoot animations.

And here again I look at the path I see game blueprints, characters, enemies, lizard.

So I know this is the correct one and just pick it and player it is just how fast we play it.

Yes, 1.0 is fine and the starting position if we play from the start or play from the middle, but

there's actually one more important thing we have to do, and we still have to click on the animation

component and make sure and make sure that here under paper XDD.

For the anim instance class, we are selecting the BP abp enemy lizard because otherwise it doesn't

know which animation blueprint to use.

And yeah, so we just select the blueprint and then we can call this play Anim Override.

And we can check this out now.

And now every three seconds you can see that we are playing this shoot animation.

So this is working, but we also still have to actually shoot the projectile.

One more cool thing I want to show you is that if we just copy paste these two and we go out in the

event graph and just put it anywhere, and we drag off here and type in overwrite, we actually have

a fourth option which is play animation overwrite with callbacks.

We don't need this in this case, but this is actually super useful, just like we had for the slide.

This also gives us an uncompleted and on cancelled event.

So for example, if you use this for a sword attack and maybe you want to lock the player in place,

then you could have like an is attacking boolean here.

And then after it's completed just set is attacking back to false.

And then you can walk again.

Or you can handle cooldowns in this way.

And you can see this clock on the top right.

So this is actually using a delay internally.

And this is why we cannot use this inside of a function.

We can only use this on the event graph.

So if you want to use this you have to make a custom event, connect it and do all of those things which

we've done a couple of times before.

And I just wanted to show you this.

And now let's spawn the projectile on the correct frame.

And here we want to use the as enemy lizard, the animation source.

And if you don't have it open, just go back to the folder here for the lizard.

And here we just want to click on pause now and see where exactly do we want to spawn the projectile.

And I think exactly.

Frame four is where we want to spawn it.

So while you are on the same height as the track one, we can right click and add notify and just make

a new notify.

And I'm just going to call it spit.

And now it is kind of in the middle of four.

It's not going to make a difference, but we can just right click it, click on four here and hit enter

to make sure it aligns perfectly.

And this just looks nicer.

Makes it a more clear what we want to do here.

And what does this notify do.

Well, if we go back to the ABP enemy lizard now because these are connected it creates this receive

notify spit.

And this then lets us do whatever we want to do.

And here we can just call the owning lizard.

And we can then just call a function here.

But now.

But now we get rid of the function that spawns the projectile.

So back in the BP enemy lizard we want to go back to the shoot fireball.

And here we have this where we actually spawn the projectile.

So we can just hit control X and then create a new function and just call it spawn projectile.

And just put it here.

And do this.

And now compile and save.

Important.

And now back in the APB enemy here for the receive notify spit.

Well, now we can just spawn projectile like this.

And let's check it out.

Compile and save.

Go here.

Right.

We can see the projector now spawns on the correct frame.

And this is something you can use in a lot of different ways.

Whenever you want to trigger something at a certain point in an animation.

Now, the last thing we want to do in this video is to change the spawn position slightly, to have

it actually come out of the mouth of the lizard.

And again, we've done this for the player before where we set a location to shoot, and on the BPM

lizard, we can just go to the viewport and select the capsule component and add a scene.

Like this and it's called it.

Shoot.

Pause.

And on the sprite.

We just want to play the lizard shoot animation.

And here I just want to set it to 0.1.

So it plays very slowly.

And now I can get the shoot pass and adjust it accordingly.

Let's see.

And yeah this looks about right a little bit more here and here.

And yeah, so this lines up perfectly now.

And now I can just go back to the sprite, set it back to player rate of one, and just set it back

to the lizard idle animation.

And now where we spawn the projectile instead of get actor location get actor forward rotation.

Just get rid of this, get the shoot pass and here get world location.

Because it is a component.

It doesn't have an actor location, it just has a world location and also get world rotation.

Like this.

And connect it here and now compile and save and let's go here.

And let's see.

And.

Yeah.

It is now spawning at the correct position.

It flies over our head slightly and this is what I said before with making the collisions a little bit

smaller, but this is actually missing us by a hair.

So maybe for you, if you have the collision even a little bit differently, it's actually going to

hit your head.

So you might want to make some adjustments.

But actually maybe you want to do it that way.

And yeah.

So now we can shoot it and everything is working fine with the lizard.

But yeah.

Now in the next video I want to take care of the projectile knockback because we still have the issue

that we flying the wrong direction and we get this error message.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.