# Project Akemi - Prototype | Incomplete AI MoveTo node/invalid target pin

**URL:** <https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [December 7, 2024, 8:03am UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139 "2024-12-07T08:03:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sr\_Beelz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sr_beelz/32/1004355_2.png) [@Sr\_Beelz](https://forums.unrealengine.com/u/Sr_Beelz)\
**Post date:** [December 7, 2024, 8:03am UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/1 "2024-12-07T08:03:21Z")

</div>

I want my roaming NPC to run towards another NPC—in the world—when it spots the player.

Below I have a blueprint that should work in theory, as in, it shouldn’t relay on it’s PawnSensing to run towards the authority NPC, it should just know where it is.

I’m only missing that Object pin in `Cast to PB_Authority`, I don’t know how to fix.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/0/1/b0121403eb329306fc1366747930777cb3aeb461.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [December 7, 2024, 9:32am UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/2 "2024-12-07T09:32:21Z")

</div>

> [@Sr\_Beelz](#):
>
> I’m only missing that Object pin in `Cast to PB_Authority`, I don’t know how to fix.

Imagine there are 10 authorities. How does the citizen know which one? How do they decide?

---

<div class="post-metadata">

**Author:** ![Sr\_Beelz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sr_beelz/32/1004355_2.png) [@Sr\_Beelz](https://forums.unrealengine.com/u/Sr_Beelz)\
**Post date:** [December 7, 2024, 10:49am UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/3 "2024-12-07T10:49:48Z")

</div>

That’s a good question, I don’t know.

I guess I would need some reference to a particular `BP_Authority`, I just don’t know what node that would be.

So far I’ve tried adding `Add Child Actor Component: Actor Class BP_Authority` node but that gave me the “does not inherit” error.

I’ve also tried giving it the Pawn pin from `On See Pawn (Peripheral)`

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/9/669e7f4372092133df2852844df884bbae56d7e5.jpeg)  
but I guess that also doesn’t tell it which `BP_Authority` to go to; it didn’t work.

I’ve also tried detaching `Cast To BP_Authority` and just have `Call Authority` connect to `AI MoveTo` directly (white wire).

Maybe my Blueprints are all wrong and should approach this a different way.

What if I had a Boolean—set to `FALSE` by default—that becomes `TRUE` when player is spotted and a second `On See Pawn` that always fails unless Boolean was set to `TRUE`? Is there a simpler solution?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [December 7, 2024, 8:42pm UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/4 "2024-12-07T20:42:08Z")

</div>

> [@Sr\_Beelz](#):
>
> That’s a good question, I don’t know.

You’re the designer, how would you like it to work? Ignore the technicalities for now. Which cop does the citizen run to? The closest one? The tallest one? The toughest one? The handsome one? The favourite one? A random one? Perhaps there is only one?

> [@Sr\_Beelz](#):
>
> Maybe my Blueprints are all wrong and should approach this a different way.

There sure is a misunderataning here regarding what `Cast To` does. It does not **find** an actor - that’s your job. Cast is just a conversion; in order to cast, you need an instance of the authority. So, which one do we run to for help? What makes the citizen choose one over another? Chances are we do not even need to cast anything.

---

<div class="post-metadata">

**Author:** ![Sr\_Beelz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sr_beelz/32/1004355_2.png) [@Sr\_Beelz](https://forums.unrealengine.com/u/Sr_Beelz)\
**Post date:** [December 7, 2024, 11:17pm UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/5 "2024-12-07T23:17:02Z")

</div>

As of right now, I want my citizen to run to the only cop in the world. I’ll later worry about it running to the closest cop it can see.

I still haven’t found the answer, every attempt to find either a node to fill in the `Cast To` requires another reference I don’t have, or every other attempt to replace the `Cast To` node left me wondering how to even use the node.

I’m turning Google and other forums upside down at this point trying to find an answer.

---

<div class="post-metadata">

**Author:** ![Sr\_Beelz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sr_beelz/32/1004355_2.png) [@Sr\_Beelz](https://forums.unrealengine.com/u/Sr_Beelz)\
**Post date:** [December 7, 2024, 11:58pm UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/6 "2024-12-07T23:58:27Z")

</div>

> [@Everynone](#):
>
> Chances are we do not even need to cast anything

You were right, I found a solution on a reddit post that uses the `Get All Actors of Class` node, a really cleaver solution.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/e/1aea6393d0f4c62f18007b11033b1d4694e8eaa6.png)

Now clearly this is a rough solution and can definitely be approved upon. So far I’ve added the `LENGTH` node, now I just need it to collect the distance between `Self` and all `BP_Authority` and `GET` the lowest value.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [December 8, 2024, 8:10am UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/7 "2024-12-08T08:10:58Z")

</div>

> [@Sr\_Beelz](#):
>
> So far I’ve added the `LENGTH` node, now I just need it to collect the distance between `Self` and all `BP_Authority` and `GET` the lowest value.

If you want it to work via proximity:

- sphere overlap actors instead of Get All Actors of Class - you immediately get results that are already within certain distance
- for all your sorting needs:

> [@Sorting algorithms in Blueprints](https://forums.unrealengine.com/t/sorting-algorithms-in-blueprints/1135992):
>
> It is common knowledge that blueprints do not include sorting functions. In my previous experiences, I have been able to create simple sorting functions easily. However, during my current project, I faced the challenge of sorting large data arrays and found that the sorting process was either very slow or unsuccessful. Since I wanted to avoid using C++ code or third-party development, I independently researched this issue. After conducting some research, I have decided to share my findings in t…

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 7, 2025, 8:11am UTC](https://forums.unrealengine.com/t/project-akemi-prototype-incomplete-ai-moveto-node-invalid-target-pin/2179139/8 "2025-01-07T08:11:24Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
