Download

Top Down Stealth Toolkit

Alright, got it. On the character side, that should be it. Since the AI system recognizes targets through the component, it doesn’t really care about anything else about the character other than collision for detection.

On the game mode front, I’ll do some tests and get back to you.

With Game Mode, you’ll have to copy most of the existing functions (see screenshot below) + Event Graph over to your new Game Mode. Apart from that, you’ll have to do a blueprint search to find all instances where these functions are being called from other classes, and then replace that with a call to your new game mode functions.

That should be enough to get the AI working on a different project. But let me know if you run into any issues.

1 Like

New one, not related to a different project only TDS kit:

Have a grapple animation, but the ultra AI of yours is alerted and kills me during the animation. I want to set up an Event on Initiate to stop or pause these super soldiers. Not sure which to go at and stop or even how to. Was thinking this way, but not sure how to pause the perception or if I did it with alert level not sure how to pause or stop that?

also, its a funny happening, but how do I stop them from their patrol routes when they’re in an animation like this? Theyll be tackled but theyre just carrying on with their routes haha

I was thinking this would work, but isn’t firing a deactivate even though it compiles fine. Any insight?

Hi Dresyn, I think you won’t have to turn off the AI perception in this case since it only tells the AI about potential stimuli. How the AI responds to them is all handled within the Behavior Tree BT_PatrolGuardAI.

If you take a look at the extreme left of the tree, you’ll see the flow for AI Melee attacks. Since the Animation Starter Pack doesn’t have any melee animations, I’ve used a placeholder anim delay and attack player task here. Try replacing these with a Play Animation node.

I used the Sprint animation from ASP for testing. So in this scenario, what happens is that once the AI catches up to the player, it will execute the Sprint animation sequence. And if the animation completes, it attacks the player. If the player manages to run away, it’ll go back to chasing. Else, it’ll continue playing the sprint animation and attack again. Regarding the grappling, does it happen everytime the AI melee attacks? If not, it might require adding some extra checks in the tree to determine which animation has to be played.

Alternatively, you can remove the Attack task shown above and use an animation notify instead to tell the AI to damage the player when a certain part of the animation has been reached instead of waiting till the end.

Also, both of the above approaches will stop the patrolling behavior because its handled by the rightmost section of the tree which will execute only if there are no higher priority tasks (like chasing target or investigating an interest).

1 Like

Awesome. On it.

Alright just gonna be honest, have no idea how to implement it haha
Was thinking of adding the check like you said, but don’t know where to begin.
Was creating a new task but in that BP can’t get a reference to the grapple component. Was thinking a decorator could help?

Also, I know this question is a lot of brain power already, but on a separate issue: applying damage. Right now it’s set to anything greater than 0, calls player death. I tried switching that to something more, but they’re just hitting him forever and he’s never dying. Any direction on that?

Alright, so working with both of you, but defaulting to you since this is yours. He had suggested setting up a new service and adding his component to it to get that IS GRAPPLE SEQ ACTIVE code, and stop it from there-- but which task or node would I use for what you have to accomplish that?

I ask, because as well going your route and throwing in a check tasks in the right most sequence, I don’t know how to set up an animation notify for it, but really couldn’t there just be something that stops or pauses the check list once I reference the Is Grapple node?


I’m assuming that your grapple component is added to the Patrol Guard at start. If so, then you can use the Event Receive Execute AI event to get your controlled pawn. Just cast it to the required AI class and you should be able to get all the components.

Regarding the damage application, I’m assuming that you have implemented your own Health system in the player character blueprint. When the health reaches 0.0, you’d have to call the ReportPlayerDeath function from Game Mode. That should bring the game over screen.

Regarding the service, it’s the same as what I mentioned with the task earlier. You’d have to use the Owner actor to cast it to the Guard AI and then access the grapple component/data.

I’m guessing that he’s asking you to use Event Receive Tick AI in the service to get the grapple component through Controlled Pawn and then storing the information about whether the grapple is active or not in a Blackboard key.

As for the implementation, there’s not much I can give on that without knowing more details about the execution flow. If you can share a flow chart sort of setup showing all the logical steps involved in the the grapple mechanic, including what causes the AI to trigger it, and how the player can respond, whether it’s always a grapple or is it sometimes a melee attack and what determines the distinction, etc, then I might be able to provide a more clear answer

So it’s only the Player, for the time being, triggering the grapple. AI will never do it, but it may be something I want them to do later on. I just want the AI to kill all logic while I’m doing the grapple. Stop killing me, and stop going on their routes haha.

This is what I currently have, this stops them from killing me during the grapple, but when they get up theyre not killing me, and if I grapple them during a route they’re still going through the route.

And here are the basic steps to the grapple attempt input. Tons of functions, but works just fine with TDS. And again, the TDS Keyboard pawn when I place him on the map and do the grapple attempts shown, they go exactly as instituted. So the play rate etc, plays just fine.

But the AI specifically marches to it’s own drum. It will play the animations, but theyll try and kill me during, they’ll literally move during the grapple to the next point, and they’re not adhering to the playrate. If I can get this taken care of, I’d be set.


Oh alright, I had assumed that the AI was trying to grapple the player to prevent them from escaping. Since it’s the other way around, you can just add a BT Service at the top of the tree like he mentioned. In the Event Receive Tick AI for this service, you can check if its Controlled Pawn is in Grappled state and store that in a Boolean Blackboard entry.

Now add a new separate branch at the very left end of the BT, and use a Decorator to check if the Boolean Blackboard value is True. If it is, then you can play the Grapple animation. If not, it should automatically switch to the lower priority tasks on the right. I believe that should prevent the AI from taking any other actions while being grappled with.

1 Like

Oh man, I don’t even know how to set this up haha So this is how I would imagine that service would be set up, but just wanna make sure I’m referencing it correctly. Currently this stops all processes for them moving. The alerts are fine theyre just not doing anything. I did have a false set up for being grapple being false as well, but same thing. Not sure how to correctly implement this.

Well, in the first screenshot, you’ve got the logic right. But instead of storing the value in a normal variable, here we have to store it in a Blackboard (set BB value when True and clear when false) . That way, the Behavior Tree can access this value directly. Also, if you haven’t used Behavior Trees before, then I’d first suggest getting familiar with it since it’s quite different from how regular blueprints work. Specifically for Blackboards, this video should provide you a good idea of what they are and how to use them:

As for the second screenshot, you’d want to put the Service in the topmost node in the tree. Basically the Selector node right below the ROOT node. And within the left tree, you will need a basic Blackboard Decorator (like the ones you see on the right showing Blackboard Based Condition).

So if our Blackboard value is set, the decorator will allow the Play Animation node below to execute. If not, it’ll fail and the execution will move on to the next branch on the right. Again, like the previous case, this will be a lot easier once you go through the basics of Behavior Trees. Otherwise, it’s going to feel quite unintuitive. On that note, here are some more resources which should get you started:

1 Like

Thanks will work on it for the next couple days and get back to you if I have any issues.

Alright, finally got it thanks to some help.

1 Like

Yup, that should do it. Now you can use the Blackboard type decorator to check if this value is Set. So it will go down the new branch to play the grapple animation only if this value is set to True.