Full transcript
Intro
0:00[Music]
0:06all right now that we have the boss able
0:08to attack uh able to Parry randomly um
0:12and also uh uh able to block us and I
0:16show you that the player now has this um
0:19teleport now let's also add movement so
Adding teleport ability
0:22right now if I'm far away the boss is
0:24just doing his thing he's just attacking
0:26uh because we're not telling the boss to
0:28move to the player
0:30um now uh to tie back to rule number
0:33three as well the boss won't just be
0:35walking to the player the boss is
0:37powerful so that they they should react
0:39differently to the player when the
0:40player moves away from the boss I don't
0:42want the boss to just follow them slowly
0:44I want the boss to just teleport
0:46directly to them like the Mage is able
0:48to teleport um so like I mentioned we'll
0:50be combining uh stuff from the Mage and
0:52melee enemies um so we're going to copy
0:55the teleport from our BP enemy
0:58mage now you can also put it in your
1:01base enemy if you want this uh teleport
1:03to be used by uh all uh enemies but uh
1:07I'm not going to do that I'm just going
1:08to copy it and paste it in the boss
1:11because I'm going to modify it a bit and
1:13I only want them for these
1:15two um so I'm just going to comment this
1:18call it attacks and move it a bit down
1:21here and paste the
1:27teleport all right and we're going to
1:30have to create some variables is
1:32teleporting right click create
1:35variable um everything else is correct
1:40correct this capsule this
1:43mesh we need to uh create this uh event
1:48dispatcher
1:50on teleport
1:55end uh teleport body effect and teleport
1:59Trail I'm actually not going to do a
2:00body effect here I'm just going to do a
2:02trail
2:04so again making it just a bit
2:11simpler maybe we need to move this
2:15back um so right click on the trail and
2:18create a variable this one just refresh
2:21it because now it's
2:23created and uh we don't need this
2:26anymore because we're only destroying
2:29the tra
2:30and we don't have the body effect
2:34anymore um everything else should be the
2:37same let's compile we have an
2:40error on teleport end but we did create
2:45it maybe we need to
2:48just
2:50on teleport end I don't see any
2:54difference but okay let's use this
2:57one compile now it's not complet
3:02complaining all
3:04right um and one very important thing
3:06here is that right now this teleport
3:08takes a location for our boss I want
3:10them to teleport to the player and not
3:13to where the player is so I want them to
3:15take an attack Target um so I'm going to
3:18modify this teleport to take both a
3:21location or attack Target so if attack
3:24Target is valid then go there if not go
3:27to the location and luckily the move two
3:30function already has this it has
3:32destination and an attack Target so all
3:35I have to do is just pass it in and the
3:37move
3:38to will take care of the
3:43rest um and the acceptance radius I want
3:45it to be a bit larger than 15 so I want
3:48you to move maybe uh
3:51150 um yeah 150 uh units away from your
3:56target that's
3:58fine uh um all right so now we need to
4:01create the task for it so over here new
4:05task blueprint base put it in our tasks
4:08folder and name it
4:11BTT boss teleport and we start with boss
4:15because we are creating a boss task so
4:19event receive execute AI get our Pawn
4:23cast to
4:25boss call
4:27teleport and pass in an attack Target or
4:31a location it depends um so I'm going to
4:34create one variable just call it um
4:39location
4:40or attack Target
4:44key and it's going to be of type
4:46Blackboard key selector and this is the
4:48kind of the cool thing about Blackboard
4:50Keys is that they can have multiple
4:52values this can be an attack Target or a
4:54location uh and we just get this and
4:58check uh first get value
5:02as
5:04actor and then we check if it is valid
5:07so if this is a valid actor so plug in
5:11here then call um teleport with
5:17this um attack Target if it is not a
5:20valid actor so I'll just copy and paste
5:24the teleport off of Boss
5:27here um
5:30so if this is not a valid actor then get
5:34value as Vector so then it's probably a
5:39location and then once you're
5:41done uh assign on teleport
5:46end plug it in both of these so when the
5:50teleport is ended we just call Finish
5:54execute and this is how you um have one
5:57Blackboard value contained
6:00uh one Blackboard key contain multiple
6:03values
6:05um all right and now we can call it
6:09here so in our combo sequence
6:13before
6:15um doing all of
6:17this or maybe actually after setting
6:21focus and before attacking let's do a
6:25Teleport a boss teleport to the attack
6:30Target and then as soon as you reach
6:33then continue with the
6:34attack who he teleported past
6:38me okay no now he didn't let's watch
6:43again the
6:46teleport oh I am missing one thing very
6:49important you see the effect is on the
6:50floor this teleport effect
6:54right um and the reason is because the
6:57Mage enemy has different socket names
7:00than the boss so we're attaching here to
7:02spine one for
7:05the uh mesh it's called spine underscore
7:08one for the Manny for the other Mage
7:10enemy it's called spine one uh without
7:13the underscore zero do we have anything
7:16else here no so now it should work let
7:18me do it slow motion yeah okay so now we
7:21have our
7:23effect
7:25perfect um let me actually do this where
7:29where am I before the focus so first
7:33thing at all is teleport yeah I think
7:35this is better so teleport then focus
7:38and then
7:39attack great uh but if I'm already close
How to make "optional" tasks in the behavior tree
7:43to the enemy so if I'm already standing
7:45here there is no point to teleport so
7:47right now why did he teleport I'm
7:49already standing right in front of
7:51him um so we want to check and before
7:56doing this
7:57teleport um our are we at a certain
8:00distance from the enemy uh from the
8:02Target or not so I can add a decorator
8:05on this so say a Blackboard
8:07decorator and say um if the value of
8:12distance to attack Target which is a
8:14distance that's set by this service that
8:16we created before and this just sets the
8:19distance to our attack Target every 0.1
8:21seconds so we're going to check if this
8:23value
8:25is um less than or equal to
8:31250 maybe something like that so if it's
8:33less than or equal 250 then teleport
8:36otherwise don't teleport but here's a
8:39problem if this decorator fails then
8:43this task fails and when a task fails
8:46the entire sequence fails so we don't
8:48want that to happen we only want this to
8:49be an optional thing so teleport if
8:52you're far away but if you're close
8:53don't do it but in either case continue
8:55the rest of the attack sequence and to
8:58do that I'm going to show you how how to
8:59create optional tasks and it's really
9:01simple to do that there is a decorator
9:03so right click add decorator it's
9:06called Uh Force success Force success
9:11means regardless of the outcome uh of uh
9:15this condition and regardless of the
9:17outcome of uh this Behavior tree task
9:20this whole task will succeed always so
9:22that makes it conditional even if the
9:24Blackboard decorator fails uh the
9:27teleport will still succeed the boss
9:29won't actually teleport but the task
9:31itself will succeed so now if we
9:34play uh oh this shouldn't be if the
9:37distance is less than or equal should be
9:38if it's greater than or equal so
9:40teleport if the distance is greater than
9:42or equal to 50 so if you're far away so
9:45now okay now he should teleport attack
9:47me he's now close so he shouldn't
9:49teleport great so he just attacked me
9:51right away he didn't teleport and same
9:53again if I'm at like this
9:56distance teleported okay okay what about
10:00this distance didn't Perfect all right
Second melee combo attack
10:03now let's start adding more attacks and
10:05more variability to the boss so we have
10:08this single combo now let's add another
10:11one um so I already told you I call this
10:14combo one because I have combo two
10:18here and this is a three hit combo with
10:22the ending this AOE slash and again uh
10:26these are patterns that the player is
10:29already used to so this is um tied back
10:32to predictable but challenging so the
10:35player knows that uh this lightning
10:38slash is an AOE damage and knows that
10:41the regular sword swing is an ax swing
10:43from previous enemies um and again this
10:46just plays the ax swing sound has the
10:48same Red Trail effect and the same
10:51lightning effect that we have for the
10:53regular smash of the melee and the
10:55player I just made it red again because
10:57everything is red for this uh
11:01boss um so let's create the attack now
11:06we don't have an attack similar to this
11:08uh something with a slash and an AOE
11:10slash in the bpc attacks except for one
11:14so if we go to the bpc attacks we have
11:18um this uh spinning melee attack has a
11:21slash and an AOE slash but I'm not going
11:23to reuse it I'm going to create the new
11:25one and I'm going to show you
11:27why so over here here in our attacks I'm
11:31going to create a new custom event call
11:35it attack combo
11:392 takes as input and attack
11:44Target and it's going to mimic what we
11:47already have in the bpc attacks which is
11:49calling the attack uh from the parent
11:52which is uh uh where is
11:57it yeah call this attack from bpc enemy
12:00base and then we play the Montage no
12:05wrong one play Montage this one in our
12:11skeletal
12:12mesh and the Montage is combo
12:162 and then here we're going to switch on
12:19name plug it into notify
12:23begin remove the default and add two
12:26pins here one pin is called slash and
12:29the other one is called AOE slash oh
12:34godamn AOE slash all right so uh the
12:39slash is the regular hits and the AOE
12:40slash is of course the explosion at the
12:43end so for the slash we already have
12:46these in the bpc attack so bpc attack we
12:49have uh sphere trace on damage sorry
12:53this is what we want to
12:55do um we call sphere trace on damage and
12:58pass in the damage info say
13:01make damage
13:04info 15 damage info melee can be blocked
13:09can be parried great radius um let's say
13:12same as the regular attack so 40 and 220
13:16220 whatever we did for this one we did
13:2040 and 220
13:23yeah um and for AOE slash uh we get bpc
13:28and call AOE damage which is also a
13:31helper that we have what happened
13:34here a helper that we have on our bpc
13:38attacks and the damage is going to be
13:40similar let's say it does 20 damage this
13:42one but this time it's
13:45explosion and can't be blocked and can't
13:48be parried and should force
13:50interrupt uh and hit reaction here and
13:53hit reaction here but won't really
13:54matter cuz we're not using it for the
13:57player radius let's say a radius of
14:02300 all
14:04right and then on end we need to do what
14:07we also do here which is call uh attack
14:09end so for here we call attack
14:14end uh where is it on enemy base so
14:19uncompleted uninterrupted and pass in
14:22the attack
14:26Target great um
14:29um now we have this combo but we need a
14:33way to call it from our Behavior tree so
14:35we need to add it first to our boss
14:38attacks enum so open the enum and add
14:43combo
14:45two great and then back here in our boss
14:49attack open up the boss attack task in
14:52the attack based on name you'll see
14:54combo 2 appears here so just add it as
14:58well well combo
15:01two plug it in plug it in here and plug
15:05in the attack
15:08Target great so in my boss if I just
15:11change this combo one uh to combo two in
15:14the attack name now he should teleport
15:17and do one two boom very nice so this
15:22one uh I can
15:24block but this one I have to teleport
15:26away from that's why I added this
15:29um and here's a
15:32stagger block block and
15:36teleport great and one thing to note
15:38about this teleport is while I'm
15:40invisible so this one while I'm
15:43invisible uh I'm also
15:46Invincible uh but this we haven't
15:48touched on yet but I will show you uh
15:50later this invincibility
15:54frames uh one other thing you see that
Boss rotate to face player during attack
15:56once the when when the boss starts
15:58attacking in if I move away he doesn't
16:01rotate to face me he just stays in the
16:03same direction and this is because all
16:06of these attacks that we're doing have
16:07root motion and by default root motion
16:11doesn't make uh locks the rotation of um
16:16a mesh so if you want to override that
16:18which is very important if you do um you
16:21can go over to your character movement
16:23search for rotation and you'll see allow
16:27physics rotation
16:29during root motion this says during root
16:31motion so if I check this
16:34box and play
16:37now as I'm as he's doing the attack and
16:40I'm spinning he's rotating to face me
16:43see that even during his
16:46attack not during the Stagger of course
16:48but yeah during the attack he's rotating
16:50to face me now this is something you can
16:52enable if you want you can disable if
16:54you want them to start the attack and
16:56keep facing the same direction up to you
Randomly choosing an attack in the behavior tree
17:00all right so now that we have two
17:01different attacks um let's choose one of
17:05them at random as well so right now in
17:07our Behavior tree this is called the
17:09combo one sequence let's just call it
17:11the uh random combo sequence and let's
17:16have it choose an attack at random so we
17:19have two attacks now we have combo one
17:21and combo two how do we choose one of
17:25them randomly well we're going to create
17:27also a very handy um decorator called
17:31chance so new
17:34decorator uh BTD blueprint
17:38space put it in our decorators folder
17:41and call it BTD chance and it's the same
17:45as the random chance function we created
17:47for the player during the
17:49Stagger so for decorators as usual you
17:52override the perform conditional check
17:55AI um and we're going to need a variable
17:58called um
18:00percent which is going to be a
18:03float and you can say you can force it
18:05to be between 0 and one and the value
18:08zero and one to make sure that you don't
18:11pass any other value and then you're
18:13going to generate a random float in the
18:16range of 0o and one and
18:20check uh is this percent greater than or
18:24equal the random float
18:28and you will just return this
18:32percent that's basically it it's a very
18:34simple decorator and how we oh make sure
18:37to click the eye icon I forgot to do
18:39that and how do we use it in our
18:42Behavior
18:43tree I'm going to create a
18:45selector to select between one of those
18:49right so how the selector works is if
18:51one fails it selects the other so let's
18:53just add a
18:54decorator let's make it combo one it
18:56doesn't really matter but yeah for
18:58naming conventions let's have combo one
19:00followed by combo two and add The
19:02Decorator on this one BTD chance and
19:06let's give it a did I not compile I did
19:09not
19:10compile and let's give it a percent of
19:130.5 so 50% of the time it will do combo
19:16one and other 50% combo one will fail so
19:19it will do combo two and that's how you
19:22choose between two different um uh nodes
19:26so let's see how this looks in all cases
19:28say he will teleport that was combo
19:32one that was combo two perfect so again
19:38combo
19:39one
19:42and combo
19:44two excellent so it was really 50%
19:47exactly in both
19:50times all right now uh it's time to move
Throw axe attack
19:54on to something a bit more exciting and
19:56this is what's going to give the boss
19:58uh the feeling of being U of doing
20:02different attacks and actually using the
20:03environment so far the boss has just
20:05been um doing melee attacks teleporting
20:08to the Target uh and doing the regular
20:11combos but not using the environment so
20:13we're going to add uh an ability for the
20:16boss to throw their axe from specific
20:19points in the arena so it's going to be
20:22sort of a projectile effect but it's
20:23going to be the axe in their hand that
20:25they're actually throwing so I think
20:26that's uh going to look pretty cool
20:28so let's uh let's do that so first we
20:32need to create a projectile um and if
20:35you don't remember what we did in our
20:37projectiles I suggest going back to the
20:39projectiles tutorial to see um
20:41everything we created here uh but we're
20:43going to create a new projectile off of
20:45projectile base so right click create
20:48child blueprint and we're going to call
20:50it BP
20:52projectile
20:55X open it up so usually what we do do is
20:58we just add um actually I'm not going to
21:01call it axe it's not just an axe it's a
21:03spinning axe so let's make sure that we
21:06name it correctly it's a spinning Axe
21:09and I'm going to make it spin inside the
21:11projectile class itself but usually what
21:14we do here is we go to our static mesh
21:16and override this to be um our whatever
21:20mesh we want and uh let me rotate it on
21:26the uh xaxis is
21:2990 yeah so now I wanted to uh before
21:35before actually changing the Box
21:36Collision size I want it to rotate right
21:39and if it rotates uh it's going to
21:42rotate along the z-axis like
21:44this now you see the problem here is
21:47that it's rotating along the origin
21:49point and the origin point is at the tip
21:51of the ax so it rotates it has a very
21:55big spin radius I actually wanted to
21:57rotate from the center uh of the ax and
22:01not from the tip so how do we do that to
22:04do that I'm actually going to ignore
22:06this mesh completely uh so I'm going to
22:08undo I'm not going to use this
22:10mesh let's clear this as well I'm going
22:13to keep it as is and I'm going to create
22:14a new element here called
22:19scene uh and this is just going to be
22:21our rotation point I'm going to call it
22:24um a
22:26rotation point and I'm going to add a
22:29new mesh so a new static
22:32mesh inside this rotation point it's
22:34already added it's a child of the
22:36rotation point and this is going to be
22:38our ax
22:40mesh all right and I'm going to rotate
22:43this uh again 90 on the Z on the x axis
22:48and now this rotation point is at the
22:51center uh of uh the actual actor the
22:55projectile actor so if I move the status
22:58mesh now to be at the center of the
23:01rotation point so yeah something like
23:05here and if I rotate now this rotation
23:08point the axe rotates along its Center
23:11and that's exactly what we want we want
23:13the ax to rotate along its Center so it
23:15doesn't have a very large spinning
23:16radius because then it looks pretty
23:18weird and hard to
23:20avoid all right um now we can set the
23:24size of our box Collision to be exactly
23:26as the ax so
23:28let's make
23:33this yeah this can be
23:3580 this should also match it so this
23:38should be a square because of course um
23:41it's going to rotate in this entire area
23:44so we should fill
23:46it and um yeah the height can be a bit
23:51lowered to I don't know
23:5310 yeah maybe even less if we want to be
23:57really accurate
23:58I don't know five that's
24:01fine um and then we also want a trail
24:04effect so I want it to have a trail when
24:06it's spinning so um we're going to add
24:10in our static mesh a particle system now
24:14if you have Niagara use Niagara I have
24:17an old one so I'm using
24:19the uh the old particle system going to
24:22call this Trail effect and I'm going to
24:25use the same one that I'm using for the
24:27ax I think yeah it's h this
24:32one yep so I'm going to just plug it in
24:36here and this one I'm going to make sure
24:38it's at the tip of the axe so as the ax
24:42is
24:43rotating so does
24:46this
24:48yeah now let's actually make the axe um
24:51spin when uh we start uh moving this
24:54projectile so in the event graph I'm
24:56going to make a custom event call it
24:59spin
25:02X um and it's going to be pretty simple
25:04it's going to be a timeline so I'm going
25:05to add a timeline because we're doing
25:06something over time and we're going to
25:08call this the uh rotation
25:14timeline uh double click to open it up
25:17um it's going to be pretty short it's
25:18going to be say 0.2 seconds and then add
25:21a float track call it uh Z
25:26rotation
25:29and right click add key at Point Z it's
25:33zero and right click add key again at
25:360.2 it's um - 360 so I want it to spin
25:42one full rotation which is 360° but in
25:46the opposite direction so uh
25:48counterclockwise that's why the negative
25:51and I wanted to do it in 0.2 seconds so
25:54you go from 0 to - 360 in 0.2 seconds
25:58and then back here uh we want to um add
26:03a uh sorry get our rotation point and
26:07say set World
26:10rotation on
26:12each
26:15update and we're going to split
26:18this um the value of the new rotation
26:21sorry the value of the X and the Y
26:22should be yeah whatever they start with
26:25so you can just get them here and say
26:27get World
26:29rotation now of course you can assume
26:32they're zero because they are but if you
26:34change them here it's good that they
26:35reflect here as well so this will be the
26:37X this will be the Y and this will be
26:40the
26:45Z all right and then on vegan play we
26:48just call spin
26:52X perfect now if I go over here and say
26:56simulate w
26:58it SP it spins only once and then stops
27:01right spins once and stops so what we
27:04want to do is when we're finished
27:06spinning just call spin ax again so then
27:10it spins
27:11continuously and now if I go over here
27:14and
27:16simulate I didn't compile so if I
27:18compile and then simulate
27:21still why why isn't oh sorry compile
27:26simulate
27:28no didn't
27:30work oh because this is play not play
27:33from
27:35start uh that should do it let's try now
27:39simulate yeah now it's spinning
27:42continuously
27:46great yeah very
27:48nice um now you can of course change the
27:51uh the spin speed by adjusting this um
27:54time from 0.2 to 0.5 to 1 yeah depends
27:58how fast you want it to spin of course
28:00the less time the faster it will
28:02be now we want this boss to throw uh the
28:07axe right so now we created the
28:08projectile let's start throwing it so
28:11back in our boss here uh in this attacks
28:15area uh let's create a new
28:17attack so add custom events and going to
28:21call it throw
28:24ax and I'll delete this and this just
28:28takes into input again as all the other
28:30attacks do and attack
28:34Target um it will call the Attack Base
28:40that we usually call and then it will
28:43play a montage now I already have a
28:46montage setup here so animations X um
28:51where is it throw ax yeah so it just
28:56looks like this as you can see it's just
28:58a regular axe swing but at this point I
29:00call a montage notify called Throw so in
29:03this point we'll spawn the projectile
29:05and hide the axe from the enemy's hand
29:08so it looks like they actually threw it
29:10but we're not going to throw the actual
29:11axe that they're
29:13holding um all right so get our
29:18mesh and plug in the throw
29:21montage and then switch on notify on
29:26begin so sorry not here on begin and it
29:30was called Throw I
29:33believe so when throw happens we just
29:36want to spawn an actor from
29:38class and this class is the spinning axe
29:44projectile uh the spawn transform here
29:46is important so uh actually the location
29:49is important so I needed to spawn it
29:51where the hand is the right hand that's
29:53holding the axe so I'm going to get my
29:55mesh and I'm going to say get
29:58socket
30:00location it get socket location or get
30:03socket
30:05world yeah I think it's just got socket
30:07location and the socket is
30:09handcore r and that's the location
30:13here the speed I want it to be very fast
30:15so it's hard to hit uh again all of the
30:18uh going back to uh rule number two it's
30:22predictable so I'm going to make it very
30:24clear that the boss will throw the ax
30:26but it's challenging ing so it's a lot
30:28faster than all the other projectiles
30:29that we faced so
30:31far um and the target is the attack
30:35Target here so that it aims it at the
30:40player and the instigator is
30:43self and I'm also going to make it
30:45homing that means it follows the player
30:48now because it's really fast it's not
30:50going to uh the player is not going to
30:52have time to actually the projectile is
30:54not going to have time to spin around
30:56the player uh but but if the player
30:58moves slightly while the boss is
31:00throwing the projectile it will still
31:01follow them so again making it a bit
31:03more challenging to
31:06avoid um and once we spawn it uh we just
31:10say uh assign on projectile impact this
31:13is the event that's dispatched when the
31:15projectile hits
31:17something um now when we hit something
31:20you can check did I hit my attack Target
31:22you can check if this actor is equal to
31:24attack Target and only then do damage or
31:26just do damage all the time which is
31:28what I'm going to do because I don't
31:30really care who I hit even if I hit
31:31myself or friendly I'm still going to do
31:33damage and damage causer is
31:37self the damage
31:39info is
31:42um
31:43make damage
31:45info so this should be let's say takes
31:4920 damage damage type
31:52projectile hit reaction can be blocked
31:55but can't be parried
31:59all right uh and another important thing
32:01we forgot to do is as soon as we spawn
32:04the projectile we also want to hide the
32:07sword that's in our hand right so we can
32:12just over
32:14here uh get our weapon we already have a
32:18reference to that and say set
32:22visibility of its mesh of or really of
32:25anything it's fine
32:28to not
32:35visible and once we're
32:38done so over here on completed and on
32:41interrupted set visibility to is visible
32:44again and call attack end always make
32:47sure to call attack end if you're not
32:50using one of the bpc
32:52attacks because they already Call It by
32:56default
32:59um are we missing
33:05something nope Let's test it out so
33:08first let's add it to our enum of
33:11attacks let's call it throw Axe and also
33:16add it to our uh BTT boss attack
33:23here we're going to call throw
33:28X plug it in here pass the attack
33:33Target this function is going to look
33:36like spaghetti once we have a lot of
33:37attacks but for now it's fine and then
33:41back here um let's just for testing now
33:44let's remove all of let's remove both of
33:47these and just
33:49call uh the attack with throw ax by the
33:54way we should rename these to be uh
33:57combo one this one to combo two just so
34:02it's clear what they are and this one to
34:04throw
34:07X all right so let's see how this looks
34:09like oh he's actually going to teleport
34:11to me let's remove the teleport I don't
34:12want him to teleport let's just see and
34:14he's throwing the ax do it in slow
34:16motion yes yes woo nice okay so a few
34:22things uh the ax is rotating in the
34:24wrong
34:25direction so he throws the axe watch
34:29again and it rotates oh no actually it's
34:33rotating in the right direction oh
34:35that's good but it spawns uh a bit
34:38weirdly so if you look at it it spawns
34:41with its head facing him it should be
34:43with the head facing me so I can really
34:45change that very simply by going here
34:49and instead of rotating at 90 I'm going
34:50to rotate at negative
34:5290 and then move it back to the center
34:58now it should spawn
35:03better yeah that's much better looks
35:05like it actually spawned and now we need
35:07a sound when it hits me and an effect we
35:11don't have any of that we don't have a
35:13hit we have a block effect sound uh but
35:16we don't have a one on impact so let's
35:19add that so in our projectile here uh we
35:23can go to the class settings so for the
35:26impact effect uh I think we have this um
35:30Sparrow alt again from the Paragon
35:32Gideon Sparrow you'll see what it looks
35:34like uh for the impact sound I have this
35:37void impact sounds like
35:41this and for the spawn sound let's just
35:44do the axe
35:45swing so the same sound you get when you
35:47swing the
35:49axe um all right so putting all that
35:52together now looks like
35:54this yep Sparrow impact is just loading
35:58now yeah much better look at it
36:02again all right and if I block
36:06it perfect slow
36:11motion boom looks great uh one thing to
36:14note though is this axe is smaller than
36:16the boss's axe because the boss is
36:18scaled up 1.25 times um so actually we
36:22might want to scale up this smesh as
36:23well to
36:251.25 which would mean we need to expand
36:28the Box Collision a
36:31bit to 100
36:35100 yeah I think that's all right let's
36:38move it to the center
36:40again all right now it should be the
36:42same size as his
36:45axe yeah very
36:48nice okay so I told you that we're going
Teleport to specific place in the arena
36:50to be using the arena for this right so
36:53right now the boss just throws the axe
36:54while standing in place to make it more
36:57interesting I want the boss to teleport
36:58to
36:59specific uh points of interest in the
37:02arena and throw the axe from there so
37:04that the enemy constantly has to look
37:06and face the boss uh to see where they
37:09are and where they're throwing the axe
37:11obviously right now the player can block
37:13with his back to the enemy uh this is a
37:16bug that we should fix at some point uh
37:18blocking should only be when you're
37:19facing the direction of the attack but
37:22this is the point of having the boss
37:24teleport so the player has to think
37:26where the boss is at this point so I
37:29want the boss to move to um one of four
37:33locations on the arena randomly so
37:36either move here move here move here or
37:39move here to one of the edges of the
37:42Arena but how do I do that how do I Mark
37:45a place for the boss to
37:47move well to do that I'm going to create
37:50um an actor and place it around the
37:53world so over here let's go to our
37:57uh
37:58content um enemies AI so somewhere here
38:03I'm going to create a new blueprint
38:05class of type uh actor just a regular
38:08actor I'm going to call it
38:09BP uh
38:12POI um actor so point of interest uh
38:18actor um and I'm not going to do
38:20anything it's I'm not going to do
38:22anything inside the actor I just want a
38:24class with uh with this name
38:27all right and I'm going to take this I'm
38:28going to place it where I want it so one
38:31of them should
38:34be
38:38here uh let's actually place it right in
38:42the
38:43center and then yeah this is the center
38:47and then move it over here so one will
38:49be here another one I'm just alt and
38:52drag to duplicate another one will be
38:55here then another one let's copy it
38:57again move it to the center but now to
39:00this side and ALT and drag one last time
39:03and move it
39:04here all right so now we have four of
39:07these actors scattered across these
39:09different points and now we want the
39:11boss to pick one of them at random but
39:14make sure that it's the one of the
39:16furthest ones so how do we uh find the
39:19location of an actor randomly now of
39:22course I can do get distance and find
39:23the location of the actor with specific
39:25class but I want to show you a new way
39:27of using the environment query system or
39:29the
39:30eqs so we're going to go over here in
39:32eqs and we're going to create a new one
39:35so right click and create new
39:37environment query so search for
39:39environment query and we're going to
39:41call this
39:42eqs uh furthest POI
39:47actor all
39:49right um by the way I noticed I named
39:52this actor and it's already an actor so
39:54maybe just BP POI instead of pp POI
39:58actor all right so now in this uh eqs
40:02forth this POI actor I'm going to show
40:04you how you can create an eqs that
40:06instead of generating um a grid of
40:08points it generates a grid of locations
40:11of specific actors so I'm going to pull
40:14here and say actors of
40:16class and then the class that I'm going
40:19to pick is our POI or point of interest
40:23and I'm going to say search radius like
40:25something like 3,000
40:27so search for actors of type of of class
40:31BP POI in uh 3,000 unit
40:36radius and then when you find one I'm
40:39going to add a test so right click add a
40:42test
40:44distance uh I'm going to just do score
40:47only and say prefer greater so whichever
40:51has the greatest distance will have the
40:53highest
40:54score um and of course this generates it
40:57around the querier so it generates this
40:59around the person that's querying the
41:01eqs which is our
41:03boss now to test it out let's get our
41:06handy testing Pawn
41:09here and change the eqs to be the
41:13furthest
41:15POI and now you can see how it works so
41:18these are the point of interests it put
41:20a dot around each one of them see so if
41:22I'm standing close to this one this has
41:24the lowest score and this is the
41:25furthest one so this has the highest
41:27score and if I move then this one has a
41:32lower score this one gets a higher score
41:33and so on so this is how you can
41:36actually look for specific actors in a
41:39scene and then do certain tests like
41:41this distance test or line of sight or
41:43whatever tests that we were doing in the
41:44previous eqss so I think it's a very
41:47handy way and used for a lot of uh cool
41:51things all right so uh now let's create
41:55our throw a sequence to use this new eqs
41:58let's see how it's going to look
42:00like back here uh I'm going to undo this
42:04put these
42:07back and this is already one complete
42:12attack
42:13sequence I'm just going to move it
42:16somewhere let's move it somewhere to the
42:18left here uh to the right I mean and
42:20let's create a new one a new sequence
42:22and call it the axe the throw
42:26X
42:29sequence so this is how the sequence
42:31starts first of all it clears
42:35Focus then runs an
42:39eqs the eqs that it runs is the uh POI
42:44thing find F this POI and we're going to
42:47say um don't get the single best so
42:49don't get the furthest one but get uh
42:52random from the best 25 so it's not
42:55going to pick the closest one one but
42:56it's going to pick one of the two
42:57furthest ones to also give it a bit of
42:59variability if you always move to the
43:01furthest one then you're just moving
43:02from one side to the other and store it
43:05in the point of Interest Blackboard
43:07key then
43:10teleport to the point of Interest
43:12remember that that this is location or
43:14attack Target so I can give it a point
43:16of Interest which is a
43:18location after you teleport to
43:21it uh Focus so look at the attack Target
43:28and throw your
43:30axe so now let's uh test out this uh axe
43:34throw sequence so goes teleports and
43:38throws the axe great and now he's going
43:41to keep teleporting to the furthest uh
43:43point of
43:45interest and he's going to keep throwing
43:47the axe because we don't have a cool
43:48down there's nothing to end it right uh
43:51but I don't want him to keep picking the
43:53same two because right now he just
43:54picking two out of the four and that's
43:56because these are the furthest ones from
43:58each other so let me modify the eqs a
44:02bit so instead of just prefer greater
44:04distance let's
44:06actually not do that let's just
44:10filter um very close ones and have it
44:13just pick one at random right so we're
44:16going to filter uh anything that's
44:18closer than let's
44:20say 500 units right uh and then
44:26um for the others pick at random so now
44:29he's picking that one then he's picking
44:31this
44:31one then he's picking that
44:35one yeah so now he's going to different
44:37ones at random I think this looks a lot
44:39better so now you really have to think
44:41oh he's here oh now he's here
44:44nice all right so what would happen if
44:47we put a cool down on this uh sequence
44:50right now if I add a cool down let's say
44:55uh 10
44:57seconds so the boss will start by doing
44:59the regular attack sequence he didn't
45:02teleport to me for some reason oh we
45:03remove the
45:05teleport oopsie okay so the boss will
45:08start doing the regular uh attack
45:11sequence right and then once the other
45:14one is ready which is uh usually 10
45:16seconds
45:17later any second now he's going to go
45:21throw the axe once and then come back
45:24and do the regular attack sequence right
Looping the throw axe sequence
45:26but what if I want him to throw the axe
45:29multiple
45:30times well then I can uh on this throw
45:34axe uh attack I can add a loop so say do
45:39this four times let's decrease the cool
45:41down a bit to like 5
45:43Seconds all right so now he does his
45:45normal attack
45:47sequence as soon as 5 seconds are up he
45:51throws his axe
45:53once twice but he's is doing it from the
45:56same place right he's throwing his axe
45:59four times and then goes back and does
46:02the normal attack sequence but I don't
46:04want him to just throw his axe four
46:06times I want him to do the whole
46:07sequence four times so then we can add a
46:10loop on the whole thing so I'm going to
46:12take this Loop and add it
46:15here so now regular
46:24attack and one teleport oh he did it
46:28only
46:29once um okay so here's another thing so
46:33this uh cool down as soon as it finished
46:37um the loop was only done once why
46:41because on the second Loop uh this was
46:43already on cool down so what we're going
46:45to do is create two nested sequences so
46:50we have a sequence here and another one
46:53here and this sequence
46:56is going to be the regular attack one
46:58with the
46:59loop and this one is just going to be
47:01the one with the cool
47:03down so now if I do
47:08this after 5
47:11Seconds he's going to go throw the axe
47:16once twice very nice three
47:21times and four times now it's on cool
47:25down and he's back perfect still on cool
47:28down so he's still doing regular attacks
47:30and once it stops he's going to do it so
47:33now the reason we added two sequences is
47:35because this whole thing has one cool
47:37down but once it's not on cool down then
47:39this can repeat you can't repeat a loop
47:42with a coold down if its cool down is
47:43still running so this is very
47:45important all right now one thing I want
Adding quick attack after axe throw sequence
47:47to add also this throwa sequence is once
47:50it ends I want the player the boss to
47:52teleport to the player but do a specific
47:54attack every time time and not do uh
47:57whatever is next uh here so and this
48:01attack is let me show it to you I have a
48:03montage for it uh it's called quick
48:07attack so this quick attack is just a
48:09single slash but um it's pretty quick
48:13quicker than the other combos um and the
48:16reason I want this is so that the player
48:19counts or player knows and be able to
48:21predict oh after four axe throws he's
48:24going to teleport and do the quick
48:25attack
48:26and this quick attack will always be
48:28will always stagger the enemy if parried
48:30so it's a high risk High reward
48:32situation for the player so let's see
48:34how we're going to do that um over here
48:37in the in the boss we're just going to
48:39create a new custom event call it quick
48:45attack takes as input the attack Target
48:52and it's going to be the same as the
48:53first combo so it just does the primary
48:56melee attack from uh the bpc attacks I'm
48:59going to copy that and paste it
49:04here well what
49:08happened okay so the only thing that's
49:10different of course is uh that we're
49:11going to be doing the quick attack
49:13Montage
49:15here and maybe um yeah this one can be
49:19blocked can be parried and notice I
49:21won't make the enemy interruptable so I
49:24won't make the enemy non interruptible
49:26so he is interruptible that means if you
49:28parry you have 100% chance of Staggering
49:31the
49:32enemy um just plug an attack Target and
49:35let's say damage is also
49:3720 so to demonstrate it uh let me just
49:40make the ax throw um two Loops so it's a
49:43bit quicker and let's make the cool down
49:47um let's just remove the cool down okay
49:50let's make it one
49:51second uh and now once this is done so
49:55once once the loops are over I'm going
49:57to have uh another sequence here called
50:00the quick
50:02attack and what it does is it
50:05teleports boss teleport to the attack
50:09Target and then calls uh
50:14attack uh boss attack oh we didn't add
50:17the teleport to our attack enum so this
50:21is sorry the quick attack so in our
50:23attack enum here go quick attack as a
50:26new
50:27one and then back here in our BTT
50:31attacks uh we're going to call Quick oh
50:35sorry pull off of Boss ref and call
50:37Quick attack so we're adding it in the
50:41attack based on name function uh which
50:44is inside the uh BTT
50:49attack uh all right so now I can select
50:51it from here quick attack attack Target
50:55and let's just call it quick
50:57attack all right so now when the loop is
51:00over he's going to always do the quick
51:01attack and then go back to doing
51:03whatever is not on cool down so let's
51:06see how this looks like it has a cool
51:08down of 1 second so now 1 second is over
51:11throw axxe once throw axe twice and
51:16teleport quick attack perfect do a
51:20regular sequence let me show it to you
51:22again and show you that um you can
51:24always Parry it so ax once twice and
51:29boom actually I did not Parry
51:32it why is
51:39that uh
51:41is this by any chance non-interruptible
51:49nope this should have staggered the
51:52enemy let's try it again sorry
51:56and throw ax once throw ax
52:00twice and Parry yeah okay so maybe the
52:03first time I just blocked it I didn't
52:05Parry correctly or it wasn't compiled
52:08but now uh this is working uh correctly
52:10you can put back the cool down to
52:11whatever number you want it um we're
52:13going to be modifying all of once we
52:15have all the attacks ready we're going
52:16to be modifying how they behave together
52:18what has cool down when how they
52:20interact uh to make the boss fight feel
52:23more uh measured and calculated
52:27nice awesome the boss fight is really
Next up in part 22
52:30starting to come together now we have
52:31multiple unique attacks and abilities
52:34and we're using the arena and the next
52:36tutorial is going to be the last one uh
52:38and we're going to add a few more cool
52:41attacks and abilities and then we're
52:42going to combine it all together uh for
52:45the final fight so I hope you enjoy it
52:48and I'll see you
52:50[Music]
52:54there
52:55[Music]
53:03oh