Behavior Tree Tutorial: failure to cast

I was working on the Behavior Tree Tutorial provided by the Unreal Engine Documentation and I got to this point:
https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/13/index.html

I cannot find anything different about my code, yet I see this and I am sure it is why my AI never stops chasing me:

Does anyone know why it is giving me this note and/or why my AI never gives up chasing no matter how far away I am?

2 Different issues here. That error is because the function you wrote is expecting a return, however there is a path that could lead to possible case where nothing is return. To fix this, just connect cast failed also into the return exec node (and maybe include a debug print message like ‘cast failed’ or something).

The reason this may never be triggering may have to do with your ‘TargetToFollow’ variable. Have you verified that this variable is actually set in game? When you run your behavior tree in game, check the details panel of the tree to see what was assigned to that variable. You may have already done this, but hard to say what else could be the issue without seeing the tree.

I tried connecting like you said:

But now i’m seeing this error:

Do you know what the error is? Where should i be looking? I can’t find anything i’m doing differently than the tutorial…

As paradoc said, you should connect the “Cast Failed” pin directly to the return node, not to the “Set Variable” node. The “Print String” may stay but when it is connected to the “Set Variable” node, it tries to set the variable on the object that could not be cast to a “Follower_AI_CON” and thus the variable cannot be set on that object resulting in an error.

I connected Cast Failed to return node and I’m still getting the error. If you look back at the error list image the problem seems to be the GetBlackboardValueAsActor node, which is only connected to TargetToFollow, not the AI_CON_Ref, so i’m beginning to think that the cast failing or not is not the issue.

check out the next page of that tutorial and verify your decorator ‘Close Enough’ actually has something assigned to it in ‘TargetToFollow’ (part 2 of the original answer above). the error your getting means it can’t find any value for that blackboard key. here’s the link:
Blackboard Data
notice how in that image ‘TargetToFollow’ is set to ‘TargetToFollow’ from their blackboard data.

(but also include what slarti says above as well in terms of casting)

In addition you may want to use the “Is Valid” blueprint node and a branch to check if the return value of GetBlackboardValueAsActor returns a valid value or ´null´. This does not fix the problem that the value is null in the first place but you can add an error message to the non-valid branch to see whats going on there.

this is what I see when I click on the Close Enough node:

77480-errorimage4.jpg

I did as you suggested:

and it is in fact printing out “is not valid” from the print statement a couple of times once it gets far enough away. Does that help pinpoint what i need to change?