Custom blueprint node for AI patrol behavior

I’m trying to wrap our AI code in a nice way for the level designers (they’re using blueprint) to configure AI behavior.

We’d like a nice and neat blueprint node which is more specific to our game and I’ve done the following considerations:

  1. For the node to be really powerful it should also wrap events like the “AIMoveTo” node which wraps events like “OnMoveSuccess” and “OnMoveFail”.
  2. Macros are the only thing which comes close to what I want to do, and they cannot wrap custom events (see:

My mock-up idea of a macro which would look somewhat like what I want to do is like the below:

So, I know that I could probably make this work by using delays inside the macro, which would poll a STATE variable and then fire the appropriate execution path on the output node, but I would really like to try to extend a k2node, async task or whatever.

I’ve taken a look a the two links below describing the creation of custom k2node’s, but I can’t get it to compile/work at all.

If anyone has:

  • any comment
  • an example Visual Studio sln workspace that can compile
  • a link to a guide

It would be greatly appreciated. I know adding a custom blueprint latent node involves:

  • Creating a new editor module
  • with a new Build.cs file
  • adding this to the uproject file

But I just can’t get it to work.


You really should be using a behavior tree for this. Blueprints aren’t that useful for AI (or rather, not as performant and not really very debuggable either).

Thanks for your answer! I’ll start looking at that also. I’m trying all possibilities, but behavior trees are definitely something I should look at!

If anyone has tried implementing a custom k2node (maybe extending the asyc ai task node) I’d really like to hear from you :).