XaiJu
Megan Fox
Megan Fox

patreon


Making an Unreal navlink that can make NPCs jump gaps

This isn't even just making NPCs jump. This is the tech you need for making NPCs use ladders, or do power teleports across gaps, or any navmesh-ignoring point to point traversal verb you can think of. And you CAN do it in Blueprint!

Sort of. Mostly. You do need some C++, but don't worry I gotcha:

.h - https://pastebin.com/rBiMDv8h

.cpp - https://pastebin.com/uaghr3m1

You can just straight copy-paste those into your project's Source, (Public folder) SurfaceableCustomNavLinkComponent.h, and (Private folder) SurfaceableCustomNavLinkComponent.cpp, and do the compilation process and that's it you're done. What this does is surfaces the handful of bits we need from CustomNavLink up to where the BP can touch them. Turns out you only need a few!

After that, it's pretty much just "make a Blueprint Actor with that as a component"

Like, seriously, everything else here is just arguments,

Only other odd thing you have to do is a tiny bit of setup in the Construction Script, but that's just, passing your arguments in.

Then uh, tada? You're done? This is it! This is the custom jump logic!

Unfortunately Patreon doesn't let you click images to expand them (WTF), so here: https://imgur.com/a/DO8Aj1X

EDIT: OH! One more thing. Don't forget to set Show3DWidget on your Start/End arguments. Like this:

That gets you the nice drag in-editor handles for placing the two ends of your navlink.

Anyways, you probably shouldn't copy how I'm doing this directly. You should probably make your NPCs smart enough to, internally, jump themselves across arbitrary points, and all this AI node does is tell them to jump from point A to B, instead of the navlink itself jumping them. But whatever. This works!

It really is that simple, ONCE you have the dumb C++ layer. Sigh. They took it like 95% of the way there, then just didn't bother surfacing the last few bits you needed to make the BP work. Whatever. Now you've got it!

Making an Unreal navlink that can make NPCs jump gaps

More Creators