Blueprint Cast to AI node Just will not work! Help

Hey Guys, ive started looking through the Shootergame blueprints for examples. In the BOT Blueprint there is a cast to shooterAIcontroller node but i can’t find out why i can’t create one, Ive built my own example game using the AI base code from Shooter axample and get the same result in both. When branching of i don’t get offered any cast to selections, it’s driving me mental! PLEASE HELP ME!.

You have to ‘get’ your controller first and then branch off from that by typing cast to xxx. Make sure you have ‘Context Sensitive’ checked.

Ive tried that but cast still doesnt show up even with get controller, Cast to my custom player controller is listed but Cast to my custom AI controller isnt, AGGGGHHHHHHHH.

First of all, you already have a cast in there, and secondly you don’t have ‘context sensitive’ marked off.
Try dragging your mouse from the cast that says ‘As shooter AI Controller’ instead of from your event tick.

In the image i didnt have it selected but i had tried that. Secondly the cast in the image is the standard one that comes in the shooter blueprint (which can’t selected). In the following image is every single cast i have available, But no AI controller. This is very confusing, I get the feeling the shooter example was using some old script setup that has now been updated and broken this methos used for the Bot AI

Bump, Look I know Behaviour tree’s are still in Flux and all that. But AI is the hardest part of any project (Please Epic devs look at this issue). If there’s anything that needs stupidly in depth Docs it’s AI, C++ & Blue prints. I’ve mostly not touched Blueprints (i rather do things direct in code) but if the released examples (Shooter game in this situation) are not fit for purpose then people need to know one way or another. The Methods in Shooter example blueprints DO NOT WORK, it’s frustrating trying to learn and understand Blueprints when the example is broken. Cheers KB

I don’t know if your aware of this but all the examples you’ve shown are regarding the “Player”. I’ve not really touched AI but I’m pretty sure AI has nothing to do with player. Try getting the “Controller” instead of the “Player Controller”. There is a difference. :wink:

From the controller you should be able to cast to “AIController” which I believe is the UE4 base class. Hope this helps.


This is so unclear it’s a pain in my ***, Ill try the Get controller. But point being if a sample is released to learn from at least make it work if no docs are available.

Hahaha, Yeah that’s Kinda my point Bud, Unless something has changed that isnt documented why wouldn’t trying to cast to AI EVEN in the shooter example (try it your self, that’s what im asking). Open the shooter example go to the character blueprints and open the Bot shoot at (or something like that blueprint). It has a cast to Shooter AI controller that works, but for example try to pull the output from the tick to create a new node and look for cast to ShooterAIController. Even though the C++ code is there it can’t do it, Ive copied this struct for my own AI in CounterForce, it does the same thing. Something doesn’t add up, all ive heard is how Blueprints make things easier, all im finding is what a pain in the *** they can be when it come’s to AI

Edit: At Pattym, your a ******* star that’s the job. But still point being the Shooter example doesn’t work (needs updating before others get caught in this issue), if your going to release a sample for people to learn from at least get the thing working. What confused me was i thought the player controller was the controller for AI and real player (incase your in single player mode with a squad for example that could still fullfill the role). We need more documentation is i think the bottom line here, im not all about blueprints, id rather use code, if blueprints can be changed this much without documentation from epics own samples (shootergame) it’s a train crash waiting to happen.

Regarding the shooter example, I was able to get the cast to node perfectly fine. The issue it’s self is more to do with the confusion with cast to nodes and what they actually do and how you get one.

To get a cast to node you must pull from a blue dot that is an object type of actor, (aka BP (in most instances) that your want to cast to) if you can’t see them make sure your “Context Sensitive” is turned on. This then allows you to either get & set variables from that target BP as well as run functions inside the target BP, however to get these options you must pull from the blue dot on the cast to node itself. :slight_smile:

Ahhhhhhhhhhhhhh, how come to get the cast to node to work you have to pull from the blue dot rather than the top arrow that the node is actually attached too? Again this is so convoluted it’s a whole new learning curve for me, Node systems (like Blenders materials & UE4 & UE3 are no problem) they make sense, why such an unintuitive way of branching and linking within blueprints, it’s like trying to unlearn how node editors work to get this to work

I will try to explain what the arrows mean.
Computer code always executes one statement at a time. each node in the blueprint stands for one statement of code.
The blueprint does not begin executing code until it hears an event.
For example, if you have the beginGame event and you begin the game, the blueprint will hear that event and will send an execution through the arrow.
Then it will execute the node of the next arrow it reaches and then continue to the next arrow.
once it runs out of arrows, the blueprint has completed its execution.

Some nodes do not have arrows. That is because they are gathering data for an execution node.
So if your node has arrows, then it needs to be connected to the order of execution that begins with the event.

All the dots handle datatypes. The arrows handle executing nodes.

Its like this. say you are thirsty. and in front of you is a glass of water. You think about the glass of water and realize that if you drink the water it will cure your thirst.
So you decide you need to pickup the water and drink it. so you figured out the action with the dots, and you execute it by picking it up and drinking it with the arrows.

I’m not sure if you have figured this out yet, but I found this thread by having the same issue, since there was no clear answer here. I fumbled upon this fix out of pure luck. The character you are trying to cast from “AI controller” isn’t set to the right AI controller… confused yet? uh… just do this.

Click on the “top root (self)” on the componants tab, then in the details panel scroll down to pawn, then on the AI controller class, its default is AIcontroller, click the little black aarow and scroll down and find the AIcontroller you created. After selecting it, you will see a quick “building” popup. Now, in the event graph, pull off the GetAIController return pin and search your “cast to” and you will see it. Hope this helps! :facepunch: