Hello Neighbor UE4 AI Tutorial #1 | Chase and Catch (REMAKE) — Transcript
Full transcript
- 0:00wo oh I'm making another tutorial wow
- 0:02wow that's so crazy let's just get on to
- 0:04it firstly we're just going to make the
- 0:06ground work or the framework it's called
- 0:09for the AI so in the soed folder in the
- 0:14new version of the template you'll find
- 0:16this blueprints folder with just the uh
- 0:19blend space and the animation blueprint
- 0:21for the neighbor we're going to right
- 0:24click here cck blueprint class and click
- 0:27character we'll call this BP neighbor
- 0:31then we'll open
- 0:33this and we'll set the mesh to the
- 0:38neighbor low poly
- 0:40mesh set it to use the ABP neighbor
- 0:44animation blueprint we'll move this down
- 0:48so it's there then rotate it so that
- 0:51he's facing the correct direction there
- 0:54we go now we have the basic the very
- 0:57very Bare Bones basic uh
- 1:01framework and stuff
- 1:03for now now we have the basic animations
- 1:06for the
- 1:07AI now now we're going to create go back
- 1:12now we're going to go back now we're
- 1:15going to go back into the blueprints
- 1:17folder right click do go to Blueprints
- 1:21and click enumeration we call this e
- 1:24neighbor
- 1:27State and of course as you can guess gu
- 1:30will'll have four states here one called
- 1:36Idol one called
- 1:40hunt one called
- 1:42offline and one called
- 1:47attack idle hunt offline attack these
- 1:49are the four states that we'll be
- 1:51working within the entirety of these uh
- 1:54these updated AI
- 1:57tutorials and back in the blueprint for
- 2:00the neighbor we're going to create a
- 2:01variable called current
- 2:04state and we'll make this a Type e I
- 2:08can't spell e neighbor State there we go
- 2:11all that and we're also going to create
- 2:14a Boolean called cany
- 2:18[Music]
- 2:21player and that's pretty much all the we
- 2:24have to do in terms of like like
- 2:27everything non uh like print and nodes
- 2:30and all that for the uh for the for the
- 2:33BP neighbor now we're going to go back
- 2:35into the blueprints folder make a new
- 2:37folder we call this
- 2:40behavior and here is where we're going
- 2:43to keep all of our stuff related to the
- 2:45ai's
- 2:46behavior and so we're going to go to
- 2:49artificial intelligence click Behavior
- 2:51tree we'll call
- 2:54this uh
- 2:57neighbor Idol BT
- 3:02or actually we'll call this BT neighbor
- 3:07Idol duplicate
- 3:09this call this BT neighbor
- 3:14hunt call this BT neighbor
- 3:17offline and and finally BT neighbor
- 3:24attack and finally we're going to make
- 3:27one last thing a Blackboard we call this
- 3:32BB
- 3:34neighbor let's save all of this and now
- 3:38we have the different Behavior trees in
- 3:39the Blackboard for in for the AI States
- 3:45and basically what we're what we're
- 3:47going to be making the AI do is we're
- 3:48going to make it switch between these
- 3:51four Behavior trees whenever it wants to
- 3:54switch States this will basically
- 3:56prevent any behavior from overlapping
- 3:59one another such as uh idle t such as
- 4:03Idle tasks overlapping with uh hunt mode
- 4:06tasks and he'll try to do idle tasks in
- 4:10the middle of hunt mode and
- 4:12it's yeah that that's basically this is
- 4:15basically to prevent that this is
- 4:17basically to prevent
- 4:19that so now that we have this we're
- 4:23going to go back into BP neighbor I'm
- 4:24going to create a new function called
- 4:26set state
- 4:28[Music]
- 4:30and firstly in this function we're going
- 4:31to go do a branch here and we're going
- 4:34to check if the current
- 4:37state uh oh actually I forgot to do one
- 4:39thing got to make an input called New
- 4:43State and make this type e neor State
- 4:48there we go and we're and before we do
- 4:52anything within this function we want to
- 4:55check if the new state is not equal to
- 5:00the uh you know what actually let's
- 5:02let's just do a regular not you will
- 5:04know that that actually is easier so we
- 5:08first want to check if the new state is
- 5:10not equal to the current state we want
- 5:13it to do everything
- 5:16here only if it is not currently in the
- 5:20state that it wants to switch to if it
- 5:24cuz obviously uh in attack
- 5:27mode uh we don't want it to constantly
- 5:30switch to attack mode uh Behavior tree
- 5:35because it's basically going to
- 5:36re-trigger out all of it over and over
- 5:38and over and over and over again and
- 5:39it'll be very buggy and whatever not
- 5:43good so this is basically all we have to
- 5:45do to prevent
- 5:47that so now we're going to get the AI
- 5:53controller the controlled actor being
- 5:55self of
- 5:57course and we're going to do run
- 6:00Behavior
- 6:03tree off of the true and off of the BT
- 6:06asset we're going to do still a select
- 6:09node and connect the index to here and
- 6:12it'll do this lovely little thing where
- 6:13it'll automatically have each option for
- 6:18all of the
- 6:19states so for idle of course we're going
- 6:23to use BT neighbor Idol or hunt we're
- 6:25going to use BT neighbor hunt and so on
- 6:30[Music]
- 6:33now if you want
- 6:36to you could also do a select not oh no
- 6:42not select uh switch on you never State
- 6:45there it is you could also do this and
- 6:48you could also have different uh
- 6:50different uh like uh things trigger
- 6:54depending on what state it is being set
- 6:57to uh actually actually let's do that do
- 7:00that now let's do that now uh cuz we do
- 7:03want the uh Max walk speed to be that
- 7:10depending on what state it's in actually
- 7:13let's do it let's just use another
- 7:15select node for this just to make it
- 7:22easier so let's see what is the current
- 7:26Max block speed 600 that's way too fast
- 7:29for idle let's do
- 7:31150 for hunt let's do
- 7:35300
- 7:37offline 200 sure uh attack will be
- 7:44600 so idle of course is wherever you
- 7:46want to we just walk and I believe in
- 7:50the blend
- 7:53space uh it
- 7:56is okay the walks the walk is at uh 100
- 8:01okay so let's actually 100 instead of
- 8:04[Music]
- 8:07150
- 8:09cool now that we have all of
- 8:12that let's actually get him to chase the
- 8:16player because currently if we drop him
- 8:20here
- 8:22uh he just doesn't do anything he
- 8:25literally doesn't do
- 8:27anything hello
- 8:30you look very handsome today Mr
- 8:34Peterson yeah he does literally nothing
- 8:37right now so we got to fix that let's
- 8:41add an AI perception component and we'll
- 8:44just call this site
- 8:48component We'll add a new sensus config
- 8:51call this AI not call this uh set it to
- 8:54the AI scyon fig click the drop down
- 8:56click the drop down again and then the
- 9:00peripheral vision is is uh basically the
- 9:04the angle of the cone of like the cone
- 9:07of the AI site uh if I actually go into
- 9:10here and press the uh apostrophe and
- 9:14then press four on the numpad as you can
- 9:16see there's this little green these
- 9:19little green lines
- 9:22here uh this is the ai's uh peripheral
- 9:25vision So currently it's set to 90 so
- 9:28it's just going to be
- 9:29basically a
- 9:31180° uh sight lines for him which
- 9:35obviously we don't
- 9:37want uh let's I usually set it to
- 9:4185 but we could do 80 let's see how that
- 9:45looks let's see what that is
- 9:48okay uh 85 is a little 80 is a little
- 9:52too small let's do
- 9:5485
- 9:56cool however
- 9:59as you can see if we go into his uh line
- 10:01of sight uh nothing really happens and
- 10:05trust me there is something that's
- 10:07supposed to be like shown like a de
- 10:09little debug visual such as the little
- 10:12green lines here uh to fix that we have
- 10:15to go into detection by affiliation and
- 10:19just check all of these that way
- 10:21anything that has an uh AI perception
- 10:25stimuli Source component uh registered
- 10:29to it will um he will be able to see so
- 10:35now now if we go in his line of sight
- 10:40here as you can see there's this little
- 10:42sphere that follows us here that means
- 10:45that he is able to see us
- 10:48awesome
- 10:50so now let's go back into the blueprint
- 10:53and go down to here on target perception
- 10:56updated click that little plus sign
- 10:59there
- 11:00and for the actor we're going to do cast
- 11:02to BP
- 11:06human do break this is actually going to
- 11:09be very very
- 11:11simple literally all you need to do just
- 11:14set cany player to successfully
- 11:17sensed that's all this needs to do right
- 11:20now we just need it to to to update cany
- 11:25player so that we can use that for a
- 11:27whole bunch of different purposes but
- 11:29for right now we're just going to use it
- 11:30for
- 11:31chasing now for switching the state
- 11:35there are a couple ways you could do it
- 11:39uh and I mean in particularly uh having
- 11:43it constantly checking what you can do
- 11:46is you can use event tick
- 11:48however given depending on how complex
- 11:51your AI is you would instead want to do
- 11:55a set timer by event thing and set it
- 11:59to1 seconds and looping and make a
- 12:04custom event here and basically this
- 12:08would be a pseudo event tick where
- 12:10instead of this working off of uh the
- 12:12frame rate uh this would just work on a
- 12:15completely separate timer rather than
- 12:18that completely desinc from the uh from
- 12:21the frame rate uh I usually do this
- 12:24because I usually like to make complex
- 12:26more complex AI so that's just what
- 12:28we're going to do
- 12:29uh just keep in mind that you can use
- 12:32event Tech if you want uh just be
- 12:36mindful of the performance issues that
- 12:39that could introduce if you put a lot of
- 12:42stuff on aent tick but
- 12:45anyways off of neighbor tick we're going
- 12:48to do a sequence node because we're
- 12:51going to do a couple things at once on
- 12:54the neighbor tick Uh custom event here
- 12:58and we're going to to a branch
- 13:01[Music]
- 13:02here can see
- 13:05player it's going to be very simple if
- 13:07you can see the player set the state to
- 13:12attack right
- 13:14[Music]
- 13:16here
- 13:18and we're actually going to do one last
- 13:20thing in set
- 13:22State we're going to do a switch on E
- 13:27neighbor State here
- 13:31a new state not neighbor
- 13:33State uh we're going to add double click
- 13:36on the string here for a reroute node to
- 13:40make it a bit more
- 13:42organized and off of attack we're going
- 13:46to actually before we do anything I
- 13:49forgot one thing add an
- 13:53audio
- 13:55and search for attack I believe it is
- 13:58attack
- 14:00Q yep it's attack q and it's looping yep
- 14:04it's looping cool so this will be the
- 14:07chase music let's just call this Chase
- 14:12music and we want to turn off
- 14:14autoactivate because what will happen is
- 14:18if we press
- 14:19play it'll just play at the very start
- 14:22and we don't want that so just turning
- 14:25off auto activate will prevent that from
- 14:27happening
- 14:29cool so now back in set State we're
- 14:32going to off of the attack on the switch
- 14:35here we're going to add a branch Dragon
- 14:39the chase music I'm going to check is
- 14:43[Music]
- 14:46playing and if it isn't already playing
- 14:50we're going to press
- 14:51[Music]
- 14:57play and and again the reason why we
- 15:00want to check this instead of just
- 15:02having it go uh straight to play here is
- 15:06because we are going to be triggering
- 15:10set State on event tick or or our
- 15:13version of event tick and of course we
- 15:17don't want it just repeating over and
- 15:19over and over and over and over
- 15:21again uh so we're we're just going to
- 15:24add a fail safe here and just and just
- 15:27make it check if it is already playing
- 15:30just to make sure that uh just to make
- 15:34sure
- 15:35that uh that it's
- 15:37actually you know playing at the right
- 15:40time and playing correctly
- 15:43so
- 15:45now if we press play
- 15:49here everything is fine there's no music
- 15:51playing but as soon as we get into his
- 15:53line of
- 15:57sight cool
- 16:01so
- 16:04finally we're going to go into the
- 16:08neighbor attack Behavior
- 16:11tree create a
- 16:15selector and we're going to create a new
- 16:17task here by clicking new task and in
- 16:20here it's going to create a new BT task
- 16:23blue Bas new we're going to call this BT
- 16:26task attack
- 16:28[Music]
- 16:30and let's actually put this in a in a
- 16:32new uh folder uh tasks folder here just
- 16:36to make things a little more organized
- 16:39move there in here we're going to do
- 16:42event receive execute
- 16:46AI off of the controlled Pawn we're
- 16:49going to do c 2 BP
- 16:53neighbor and we're going to do a very
- 16:55simple simple thing here AI move
- 17:00to PA being DP neighbor the target actor
- 17:03being get player
- 17:08character
- 17:09and
- 17:11sometimes it will and sometimes it will
- 17:16fail
- 17:18and and uh we're going to want
- 17:25[Music]
- 17:27to actually
- 17:30let's make a new variable a new Boolean
- 17:33called uh hot
- 17:37[Music]
- 17:41player and we'll set that to True
- 17:43whenever he catches the uh the player
- 17:46but we're we haven't actually set that
- 17:48right now but we will later uh off of
- 17:50the cast in the task we're going to do
- 17:53get caught
- 17:56[Music]
- 17:57player and we're going to make a
- 18:01branch and if he hasn't caught the
- 18:04player he's going to try to move to them
- 18:09again again double click on the string
- 18:12to make a reroute
- 18:15node what is going on
- 18:19here there we
- 18:23go
- 18:25so once we once we get into the L sight
- 18:32here he actually doesn't move and
- 18:35there's a reason for
- 18:38that press P really quick what do you
- 18:43see oh I guess I already set that
- 18:46[Music]
- 18:48there uh so the reason actually isn't
- 18:50what I thought is because we're not
- 18:53actually triggering that in the task so
- 18:56attack Beauty task attack and now
- 19:02[Music]
- 19:04he's moving towards us
- 19:07nice however if you
- 19:13notice if you
- 19:15notice he his movement is a bit
- 19:19jittery he like snaps towards the uh his
- 19:24Destin his destination and of course
- 19:27there is a way way uh to make that a bit
- 19:31smoother however we have to do we have
- 19:33to enable and disable a couple first we
- 19:36have to you we have to turn off use
- 19:38controller rotation
- 19:40yaah and then in the character
- 19:43movement uh by the way that was in the
- 19:45uh the default character uh settings in
- 19:48the pawn
- 19:50here uh in and in the character movement
- 19:54uh component settings we want to scroll
- 19:56all the way down until we see character
- 19:58move
- 19:59movement and then we're going to want to
- 20:02check Orient rotation to
- 20:05movement and this setting right here the
- 20:08Z rotation setting that's that's
- 20:11basically this is basically how quickly
- 20:13he's going to move he's going to orient
- 20:16himself towards the uh the desired uh
- 20:20the desired path So currently it's very
- 20:23fast 360 it literally just means he'll
- 20:26just snap straight to it so let's set
- 20:29this
- 20:30to
- 20:33[Music]
- 20:37250 and he moves a lot
- 20:42[Music]
- 20:46smoother
- 20:49nice so now that that's done we got to
- 20:53make him actually catch the player
- 20:56because currently if he moves towards us
- 20:58he just
- 20:59stares at
- 21:01us actually let's let's do let's trigger
- 21:05this branch on success as
- 21:09[Music]
- 21:10well yeah there we go look at that look
- 21:14at that okay
- 21:20so now let's actually make him catch the
- 21:22player so we're going to make a box
- 21:24Collision component we we'll just call
- 21:27this catch box
- 21:29and then move this over here let's uh
- 21:33let's change the thickness to look like
- 21:38uh let's
- 21:41see about
- 21:44that actually it's a little too
- 21:46[Music]
- 21:48thin about that yeah that seems fine
- 21:51seems fine all right this will act as
- 21:54the HIIT box for his
- 21:57catching and
- 22:01so we also are going to want to do the
- 22:03do this on a vent Teck or on neighbor
- 22:05tick I guess in this in my case we're
- 22:08going to get
- 22:11catchbox is overlapping
- 22:15actor and with the with the other we're
- 22:17going to get
- 22:19player get player
- 22:21[Music]
- 22:24character and
- 22:29off of the TR the
- 22:31true if if the box is overlapping the
- 22:35character we're going to
- 22:37check if the player has if the AI has
- 22:42caught the player if it hasn't we're
- 22:45going to trigger a custom event because
- 22:47this is a very
- 22:49large uh this is a very large bit of
- 22:53functionality uh but before we do any of
- 22:55that let's actually comment stuff out
- 23:00just so that we are
- 23:05[Music]
- 23:13organized trigger
- 23:17[Music]
- 23:20attack oh oops yeah there we go
- 23:25[Music]
- 23:29make a custom
- 23:32event call a catch player and then right
- 23:36at the right at the start we're going to
- 23:39set catch player cop player to
- 23:44true and we'll actually trigger that
- 23:50here go and the the reason why we want
- 23:55to do this first is because since this
- 23:57is being triggered uh every1 seconds we
- 24:01don't want this to Loop and and since
- 24:04this is checking if he hasn't already
- 24:06caught the player if it's set to
- 24:10true it's just not going to do
- 24:13anything which is what we
- 24:15want so we also want to play a
- 24:22sound and uh let's see
- 24:26actually let's
- 24:29catch let's see which one of these do we
- 24:31want to want do we want to
- 24:33use uh you know what let's just make
- 24:36this more like the original uh hello
- 24:39neighbor we'll just use catch
- 24:41two now let's close the Bey task attacks
- 24:44cuz we're not going to do anything in
- 24:46that anymore for now we'll just use
- 24:48catch
- 24:50two so now if
- 24:56we look at that
- 25:00it plays the sound and everything but
- 25:01nothing nothing else actually happens
- 25:03however this we at least know it's
- 25:09trigger uh
- 25:12actually let's add a
- 25:17final let's actually add a final State
- 25:22here in the neighbor State we'll call
- 25:25this none
- 25:28[Music]
- 25:30and we'll only set this when
- 25:34uh and we'll only set this when uh when
- 25:38we want him to like do nothing
- 25:42essentially and have zero Behavior so in
- 25:47the event graph here we're going to
- 25:49do we're going to do one last thing here
- 25:52in the in the attack triggering
- 25:56part we're going to
- 25:59check
- 26:02if if the player has not been
- 26:07[Music]
- 26:10caught that
- 26:11way when he does catch the player uh
- 26:16Attack Mode is not going to be
- 26:20triggered and we can do we can be free
- 26:22to do whatever we
- 26:24want so now and now back in set State
- 26:30actually I don't
- 26:33think uh let's just set the max walk
- 26:36speed to
- 26:37[Music]
- 26:40100
- 26:41[Music]
- 26:42actually we'll just set it to zero
- 26:44because that'll work
- 26:46perfectly uh
- 26:50so actually we can use we can leave it
- 26:55as cool so let's set the stick
- 26:58State To
- 27:02None we'll
- 27:06play
- 27:09animation play
- 27:11animation search for
- 27:15choke cool so now when he catches
- 27:21us plays the animation but we also want
- 27:24the chase music to stop playing so in
- 27:27the set state
- 27:29let's get the chase music and just do
- 27:33[Music]
- 27:43stop there we
- 27:44[Music]
- 27:50go
- 27:53uh let's make the hatchbox a little bit
- 27:58[Music]
- 28:01bger there we go that's
- 28:03better okay so now he is playing the
- 28:09animation everything but we can still
- 28:11move around and
- 28:14[Music]
- 28:16everything which is not what we want so
- 28:21firstly we're going to get the player
- 28:24character
- 28:25[Music]
- 28:29uh
- 28:31disable
- 28:34input going to get the player
- 28:37controller and what this is going to do
- 28:40is it will disable all kinds of input
- 28:43from the
- 28:46player I can't see I can't do anything I
- 28:49can't I literally can't do
- 28:52anything it won't let me do anything
- 28:54which is what which is exactly what we
- 28:56want however
- 28:58there's one last there's the second to
- 29:01last part before the reset uh and it's
- 29:05the fact that if I look away from
- 29:07him it isn't turning towards him it the
- 29:12player camera is not turning to look at
- 29:14them so to to fix that and to implement
- 29:17that we're going to do add
- 29:21timeline we'll call this player
- 29:25rotate player oh whoops
- 29:32whoops open this call this Alpha shift
- 29:36click in here to add a key frame set the
- 29:38time to 0
- 29:40seconds and uh let's set it to
- 29:44be5
- 29:48seconds set time5 set it to
- 29:53one compile save close that that's all
- 29:57done actually we can close set status
- 30:00below and
- 30:03update now you might want to do
- 30:07something like set actor
- 30:10rotation and use a target for a player
- 30:15character you might want to do this for
- 30:19it however you don't want to do this
- 30:21actually and I'll show you why but first
- 30:24let's do
- 30:26[Music]
- 30:31th get get acor
- 30:37rotation so that as the a
- 30:41value and we want it to use the shortest
- 30:44path so it so it doesn't look weird uh
- 30:47when trust me trust me use shortest path
- 30:50you you'll want to turn that on for the
- 30:53B we going need to get look find Lookout
- 30:57rotation
- 31:00from the start we're going to do get
- 31:02actor
- 31:04[Music]
- 31:06location and at the Target we're going
- 31:08to copy and paste get actor location but
- 31:11we'll just leave this blank so that it
- 31:13is using the neighbor's location for the
- 31:16Target now again you don't actually want
- 31:20to use set actor rotation and the reason
- 31:23for that is
- 31:25because it actually doesn't really do
- 31:29anything and the reason for that is
- 31:32because this little setting right here
- 31:35use controller rotation yaw the player
- 31:38is also a character
- 31:40blueprint and it has this turned on by
- 31:45default so and that and that is actually
- 31:48needed in order to have like player
- 31:50input and everything so to fix that uh
- 31:55and so so to uh
- 31:57[Music]
- 31:59to make it so that we can actually
- 32:01rotate the player we're going to not use
- 32:04set actor
- 32:05rotation instead we're going to get the
- 32:08player
- 32:11controller we're going to do get control
- 32:15rotation we'll use that as the as the
- 32:19start instead and we'll
- 32:22do and then we'll do set control
- 32:26rotation
- 32:33and we'll connect that to there now when
- 32:36we do when we P
- 32:39play there we go look at
- 32:41[Music]
- 32:45that I can be running away from oh no oh
- 32:48no he's going to get me oh he got
- 32:52me if you want to make it slower you can
- 32:56if you want to make the turn slower you
- 32:57can set the length to one or
- 33:00something set the
- 33:02time
- 33:07one yeah oh no he's going to get
- 33:11me I think that looks nicer actually so
- 33:13we're going to keep it that way we're
- 33:14going to keep it one
- 33:16second uh so now finally for the
- 33:23resetting uh let's
- 33:25actually Comet this out we'll call this
- 33:29rotate
- 33:31[Music]
- 33:35layer and off of this we're going to do
- 33:38a sequence
- 33:39node I'm going to set a delay make a
- 33:43delay node for one second now you may be
- 33:45wondering why would we not just use the
- 33:48finished uh pin here on the on the
- 33:51timeline for whatever
- 33:54reason uh I'm sure there's probably some
- 33:58I'm missing or something but for some
- 34:00reason this pin triggers
- 34:05way late after the timeline is actually
- 34:08finished triggering when it it has
- 34:11actually gone through the entire
- 34:12animation for whatever reason it just
- 34:15does not trigger on time at all so we're
- 34:18just going to use a Delano
- 34:20instead now there are a couple ways you
- 34:24can do the
- 34:25reset uh you can just use uh open level
- 34:32and uh and just and just uh do
- 34:39like yeah you can just do like open
- 34:42level and use the current level name and
- 34:44just reopen the level however we don't
- 34:47really want that because that completely
- 34:49resets all of your progress and of
- 34:51course nobody wants that so instead
- 34:54we're just going to do uh get all
- 34:57widgets of
- 34:59class going to do we're going to get the
- 35:02fade for each
- 35:06Loop fade
- 35:09anim forward so that now when we do
- 35:16play it'll
- 35:18fade uh you know what the camera keeps
- 35:21clipping inside of him for whatever
- 35:23reason so let's just add one extra new
- 35:27and do set movement
- 35:33mode and just leave it as nut so that he
- 35:37immediately stops in his
- 35:42tracks or we can probably just just make
- 35:48it or we can probably just make it
- 35:51bigger
- 35:52[Music]
- 35:59cool so I don't think that was even
- 36:03needed I I don't think that was even
- 36:06needed oh what the heck I didn't mean to
- 36:08do
- 36:09[Music]
- 36:17that you know what let's make this
- 36:2305
- 36:26.01 St
- 36:31okay there we go now it's more
- 36:36[Music]
- 36:40accurate Okay cool so now it actually
- 36:44like Fades into black after he catches
- 36:48you uh
- 36:50however uh we're going to have to make
- 36:53him actually reset your
- 36:56locations so to do that we're going to
- 36:59want to create two more
- 37:03variables we'll call this NE reset
- 37:09transform and let's set this to
- 37:13transform make another one call this
- 37:15player reset Point
- 37:19form and and make both of these public
- 37:22so that we can edit these in the level
- 37:25editor like so
- 37:28uh and to add a little bit more uh
- 37:31customization or like organization I
- 37:33should say let's make the category to
- 37:37[Music]
- 37:38uh game
- 37:41play add that
- 37:51there make an AI
- 37:53category change that just set all those
- 37:57there there go now what we're going to
- 38:00do is after after uh after a few seconds
- 38:05of uh being faded to Black let's make a
- 38:095
- 38:11Seconds let's uh we're going to fade uh
- 38:15fade back and the player and the
- 38:19neighbor will be reset to uh to specific
- 38:23locations uh let's just bring in an
- 38:25empty character just to have
- 38:29let's have the neighbor reset here so
- 38:34let's copy the uh the location the
- 38:37rotation it's just
- 38:39180 and we'll go to neigh res set
- 38:44transform paste the location set to
- 38:50180 cool and uh let's delete that
- 38:58and we'll put the player
- 39:02here copy location we don't need to copy
- 39:06the rotation because it's just 0 0
- 39:090 so now these two are primed and ready
- 39:14to use for the uh for the catching
- 39:19sequence let's delete that really
- 39:23[Music]
- 39:25quick now
- 39:28after 5 Seconds going
- 39:32to we're going to
- 39:38actually let's just have it do this
- 39:41again so we don't have to trigger a four
- 39:44loop again do
- 39:48reverse then after 5
- 39:51Seconds let's do set actor
- 39:55transform uh set actor trans
- 39:58transform and in game play neighbor
- 40:01reset
- 40:04transform and we'll do this
- 40:07again for the player
- 40:13character player reset
- 40:15[Music]
- 40:19transform so
- 40:23[Music]
- 40:25now it's going to fit f 1 2 3 4
- 40:325 there we
- 40:35go oh right I
- 40:37forgot silly me we have to set the
- 40:42control rotation see even I
- 40:46forget we're going to have to set the
- 40:48only set the players
- 40:51location set actor location nope not off
- 40:56set set actor
- 40:58location there we
- 41:03go and we're going to split this that
- 41:08that double click for reroute
- 41:10node there we
- 41:15go and we're going
- 41:19to he catches
- 41:22Us 2 three four five
- 41:27and we have re and we have both reset to
- 41:31the locations however we're going to
- 41:33want to do a few more things
- 41:36last lastly we're going to want to
- 41:39reenable the input for
- 41:47the just control
- 41:51again and we're going to want
- 41:55to set the AI State back to
- 41:59[Music]
- 42:01idle and we're gonna want to reset his
- 42:04animation mode his mesh's animation mode
- 42:07use the animation blueprint because when
- 42:10you use a uh play animation node it sets
- 42:15the the animation mode for the for the
- 42:19mesh to use animation asset so it's not
- 42:22going to be using the animation
- 42:24blueprint we want to reset that
- 42:27here with set animation
- 42:30mode cool so
- 42:35now uh actually we're going to want to
- 42:37do some things CL we're going to set cot
- 42:41player to
- 42:47balls and yeah that's that's pretty much
- 42:50it that's pretty much it for that I
- 42:53think let's see Catches Us
- 42:58[Music]
- 43:07[Music]
- 43:09excuse
- 43:10[Music]
- 43:14me
- 43:18huh I
- 43:23think okay
- 43:28let's make a delay node for
- 43:34like the freak oh I spawned right on top
- 43:38of him that's what it
- 43:40[Music]
- 43:46was there we go that's
- 43:49better so what was happening was
- 43:52uh basically the AI was was was like Reg
- 43:57string the player has
- 43:59seen uh just for a split second before
- 44:03uh
- 44:05before before uh being reset so just
- 44:10delaying this and turning off turning
- 44:12off a cop player prevented this from
- 44:14triggering
- 44:16again why was he not chasing us I have
- 44:18no freaking clue but it
- 44:21works it works completely fine he
- 44:24catches us fites to BL back bit's back
- 44:28after a few
- 44:30seconds we can move and
- 44:33everything he can chase us again I
- 44:37[Music]
- 44:38[Applause]
- 44:39[Music]
- 44:44think what's going on here oh my gosh I
- 44:49this is this this is my second time of
- 44:51re-record okay so this is my second time
- 44:53of re-recording this and I I made the
- 44:57exact same mistake twice in a
- 45:01row the reason why it's not working like
- 45:04this is
- 45:06because we're not setting the current
- 45:09state I I watch this I guarantee you
- 45:12it's going to work
- 45:14now I guarantee you it's going to work
- 45:19now so now we can go
- 45:24see see
- 45:27works now
- 45:33awesome
- 45:37so yep look at that he can chase us
- 45:41catch
- 45:43fade fade back we can move can pick up
- 45:48items and
- 45:50everything he can chase us
- 45:53again he can chase us again Fade to back
- 46:01there we go
- 46:03so we got to do one last
- 46:06thing and that is allowing the AI to
- 46:10lose the player uh but first let's
- 46:14select all
- 46:16this comment it out catching
- 46:20[Music]
- 46:32uh come with this
- 46:34[Music]
- 46:41out res set player and
- 46:46neighbor set player and
- 46:49neighbor let's actually move
- 46:53this let's actually move this down a bit
- 46:59[Music]
- 47:06there we
- 47:06[Music]
- 47:09go cool cool cool cool
- 47:12[Music]
- 47:15so
- 47:19let's
- 47:21Okay
- 47:23so actually let's go ahead and split
- 47:26this
- 47:28up if C
- 47:32flare if C player not is true then it's
- 47:37going to check
- 47:40if it's going to check cany player if
- 47:43it's
- 47:44false going to do a branch we'll
- 47:47actually put this over here and a
- 47:51reroute
- 47:52node and then we're going to get the
- 47:54current state
- 47:57check if it's equal
- 47:59to
- 48:05attack uh if it's true we're going to
- 48:11do we're going to do a retriggerable
- 48:15delay or
- 48:27actually we can there's a better way for
- 48:28us to do this we're going to use a
- 48:34gate and
- 48:36if and if the a AI can't see the player
- 48:41it's going to open
- 48:44this and it's and that's going to be
- 48:47enter but if you can't see the player
- 48:49it's going to close
- 48:52this and going do a retriggerable delay
- 48:58and we'll set this to 8 seconds this
- 48:59will Bas basically be however long you
- 49:02want the AI to wait before it can lose
- 49:05the player you can promote this to a
- 49:08variable instead it to like a I don't
- 49:10know
- 49:12it uh lose player
- 49:18time and set this to to public set it
- 49:23put this an
- 49:25AI the default is 8 seconds we're just
- 49:28going to keep this as a as a public uh
- 49:31variable just to make this uh things a
- 49:33little bit easier or just to make that
- 49:36add a little bit more
- 49:38customization for each
- 49:40level
- 49:42[Music]
- 49:45and and after 8
- 49:48seconds we're going to do
- 49:51one last
- 49:54Branch we're going to check
- 49:57if cany
- 49:59player is still
- 50:02false if it
- 50:04is if it is
- 50:06still
- 50:08[Music]
- 50:12false
- 50:14and current state is equal to attack
- 50:27we'll actually use a
- 50:29not not
- 50:34boan if both of those are true then it's
- 50:38going to set the state to
- 50:41hunt and we're going to do one last
- 50:43thing this is in regards to the chase
- 50:47music uh in
- 50:50Hunt we're actually going to
- 50:54also stop stop the chase
- 51:01music but we're also going to
- 51:04do last
- 51:06thing we're going to add an audio
- 51:09component we're going to call
- 51:12this I'm going to call this hunt
- 51:17music and we're going to use
- 51:21the where is
- 51:23it near hunt
- 51:27we're going to use near hunt
- 51:29q but we have to
- 51:32do we're we have to
- 51:35do
- 51:37uh attenuation
- 51:40distance volume
- 51:42attenuation going to override the
- 51:47attenuation
- 51:50and volume attenuation spatialization
- 51:53we're going to disable
- 51:55spatialization that that
- 51:57way uh we're actually going to uh here
- 52:06on uh let's actually make
- 52:10the make a 2,000 4 and
- 52:14400 uh 2 uh 2,000 is still really really
- 52:18far really really
- 52:23far so that
- 52:25way with uh spatialization turned
- 52:28[Music]
- 52:32off it'll get quieter and louder
- 52:36depending on how close we are to the
- 52:40AI actually that
- 52:44600 got 200 so okay yeah that seems that
- 52:48seems fine uh so now we're just going to
- 52:52turn off auto activate
- 52:56and we're going to do a couple things in
- 52:58the set State function we're going to
- 53:00first we're going to make we're going to
- 53:03make it we're going to do the same
- 53:06thing check if it is it isn't already
- 53:10playing if it isn't play
- 53:15[Music]
- 53:20it and off of Attack Mode when in attack
- 53:24mode it's going to oh not stop delayed
- 53:28stop it's just going to
- 53:34stop uh actually since actually we're
- 53:38going to fade we're actually going to
- 53:40fade
- 53:44out uh Fade Out duration think A5
- 53:51seconds
- 53:53cool so
- 53:57uh let's see is the AI able to move up
- 54:00here he can't move up here fantastic so
- 54:04what we're going to do test this let's
- 54:07go up
- 54:08[Music]
- 54:11here it should be setting to hunt after
- 54:148
- 54:21seconds oh
- 54:26[Music]
- 54:37uh you know what let's get rid of the
- 54:39gate get rid of all this
- 54:44BS get rid of all this BS instead of a
- 54:47retriggerable delay let's just do a
- 54:49regular delay
- 54:50[Music]
- 55:01so
- 55:02[Music]
- 55:06now he starts chasing
- 55:09us 3 2
- 55:14[Music]
- 55:221 now he's in Hunt mode currently
- 55:26[Music]
- 55:28but when we go back into his L
- 55:31sight what the where did I just go what
- 55:34just happened to
- 55:36me uh goodness gracious this house this
- 55:39House's model is very
- 55:42buggy
- 55:43so 5 4 3 2 1 there we go now we run back
- 55:52here he starts chasing us again
- 55:55[Music]
- 56:00cool and that is basically it uh really
- 56:05the largest and most complicated part of
- 56:08this entire thing is the catching but
- 56:12even then it's not as it's not like
- 56:15insanely complex I I would like I would
- 56:18like to think this is the uh the AI
- 56:22video uh next updated video next remas
- 56:27uh AI tutorial will be the hunt mode and
- 56:30it's not just going to be part one we're
- 56:33going to do the entire thing we're going
- 56:35to make the entire
- 56:37framewor and uh it's only going to
- 56:41consist of like one maybe two tasks I
- 56:44don't know I'll have to figure it out
- 56:46later but yeah I hope you were able to
- 56:48follow this and uh Happy programming I
- 56:52guess
- 56:56a
About this transcript
This page contains the full transcript of Hello Neighbor UE4 AI Tutorial #1 | Chase and Catch (REMAKE) by Owen Campos, generated from the public captions YouTube serves with the video. The transcript has 5,848 words across 1,033 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.