‫Hello and welcome.
‫In this lecture, we're going to be seeing how we can add a tag to our gargoyle actor that makes it
‫be the only actor acceptable to our secret door.
‫Let's dive in and see how this actor tagging system works.
‫Now.
‫We don't want our trigger to be responding to every single case where we get an overlap.
‫No, we want it to be responding very specifically only to one actor, the gargoyle.
‫So how do we go about configuring this trigger so that the gargoyle is the only thing it responds to?
‫Well, fortunately, there is a mechanism for tagging certain actors with certain strings to say that
‫it has a specific property.
‫So if you go and select the Gargoyle actor and scroll down in the details pane, you're going to find
‫and in fact, you can probably just search for it.
‫You can search for tags.
‫In particular, we're looking not for component tags, but actor tags.
‫You can see that there is an array element.
‫Now we understand what arrays are.
‫So you can have multiple tags.
‫It's an array of strings.
‫So the first thing in this array is you can add it with the add button.
‫You can delete elements from it with the delete button, and then you can add in a string.
‫So for example, we might want to put in a string that says it's going to unlock door one.
‫So we'll put in a string that says unlock one, for example.
‫And then what we want to do is check whether that string matches unlock one over in our trigger component
‫CP.
‫So what we can do here is we can query the actor when we're going over the overlapping actors in our
‫for loop and we can check whether it has a particular actor tag.
‫It's very easy to do.
‫There is a function for it.
‫So we do.
‫Actor, Arrow, actor has tag and then you just have to pass in the name, the f name of the tag, which
‫you can actually just use a string to put this in.
‫So what we can do is we can put in unlock one like so and we can put a semicolon at the end of the line
‫and we can wrap this in an if statement.
‫So saying if the actor has tag unlock one, then let's print out a log message which is going to basically
‫be that log message saying that we're overlapping, we can say actually unlocking instead so that it's
‫clear that there's a difference.
‫And otherwise, if it doesn't find anything to unlock it, it's not going to print anything out.
‫And let's remove the use of actor name so that all the log message says is that we are unlocking now
‫let's recompile.
‫And once that's done, let's open up our output log and dock it to the layout so that we can see the
‫results.
‫Let's go and start near our gargoyle.
‫Hit play, pick up the gargoyle, take it to the alcove.
‫I just want to show you that if I step in, there is no log message.
‫There's a log message coming from the beep player.
‫We could remove that log, but there's nothing coming from our trigger.
‫Now let's take the gargoyle and stick it in the alcove.
‫And they go it can see that it is unlocking because of the tag that we have applied.
‫So let's challenge you to make the tag that we've got there configurable at the moment.
‫We've just hardcoded it into our code.
‫So you're going to create a new editable you property.
‫That type should be an F name so that it matches what the actor tag is expecting.
‫And you're going to replace your fixed string with this in the code and configure it in the level instead,
‫which is the right place so that we can reuse this trigger in multiple places.
‫Pause a video and have a go.
‫Okay.
‫Welcome back.
‫So we're going to go over to the header file for our trigger components.
‫We're going to go in to the bottom and create a new private section and put a new property edit anywhere.
‫And it's going to be a type F name, not a pointer to an F name and actual F name, which we're going
‫to call the I didn't tell you what to call it, but hopefully you try to think up a good name.
‫I'm going to call this the acceptable actor tag, give it no default at the moment and go over into
‫our trigger component, CBP.
‫And instead of using unlocking in here as the actor tag we're checking for, we're going to check for
‫the acceptable actor tag.
‫I'm going to go ahead and compile this.
‫Then I'm going to go and find our secret door.
‫I'm going to go and find the trigger components.
‫And you can see that I'm still got the search for TAG.
‫So acceptable act tag shows up straightaway and we're going to put unlock one to make sure it matches
‫the gargoyle.
‫Exactly.
‫The string has to match perfectly and that should have exactly the same result.
‫Do go ahead and test it for yourself, but I'm not going to in the video.
‫Great stuff.
‫So now we've seen how we can tag actors with strings to give them certain game play meanings and do
‫that reasonably configurable and flexibly from within.
‫The editor.
‫I'll see you in the next video.