# How to call AI Controller function from Player Controller

**URL:** <https://forums.unrealengine.com/t/how-to-call-ai-controller-function-from-player-controller/439154>\
**Category:** AI\
**Tags:** move-to-location, ai-controller, unreal-engine, question\
**Created:** [December 9, 2018, 10:34am UTC](https://forums.unrealengine.com/t/how-to-call-ai-controller-function-from-player-controller/439154 "2018-12-09T10:34:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![US\_Economy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@US\_Economy](https://forums.unrealengine.com/u/US_Economy)\
**Post date:** [December 9, 2018, 10:34am UTC](https://forums.unrealengine.com/t/how-to-call-ai-controller-function-from-player-controller/439154/1 "2018-12-09T10:34:57Z")

</div>

Right now I am using a Player Controller with my character to take in right-clicks for movement like a top-down game.  
After right-clicking on a certain spot, I need to use a Player Controller to get the Hit Result from “Get Hit Result Under Cursor By Channel.” However, I am then trying to call “Move To Location or Actor” which requires an AI Controller. I used Simple Move to Location at first, but I was unable to access things like Acceptance Radius, pathfinding, and On Move Finished that “Move To Location or Actor” has.

I currently have my character’s “Auto Possess Player” disabled and set AI Controller Class to my AI Controller.  
I read in the hierarchy here: [RTS Movement and behaviors on UE4 - Melting Logic](http://blog.meltinglogic.com/2015/04/unreal-rts-rpg-movement-behaviors/)  
that the Player Controller should only take in inputs and only have the AI Controller hooked up to the player, and that’s what it seems like I have. Yet when my Player Controller calls Get Player Character(0) → Get AIController → Move To Location or Actor, there is no movement. And my print statements show that it gets the Player Character fine, but fails at the Get AIController step.

I am new to Unreal and have already spent countless hours just trying to get movement working. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![US\_Economy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@US\_Economy](https://forums.unrealengine.com/u/US_Economy)\
**Post date:** [December 9, 2018, 1:39pm UTC](https://forums.unrealengine.com/t/how-to-call-ai-controller-function-from-player-controller/439154/2 "2018-12-09T13:39:17Z")

</div>

I included this in my AI Controller as well, but it doesn’t print anything out.

> **[Gyazo](https://gyazo.com/e006e473e8e567429a0e32b7769dfd18)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.
