My code should work but it doesnt do anything, I’m simply setting a variable within my character BP from a behavior tree task (via casting). Then I’ll get this same variable in my level blueprint to use in a branch node.
branch node in my level blueprint, getting the variable that has just been set in behavior tree. This code is working but does not execute because the variable isn’t being set during gameplay.
‘SpawnToStartConvo’ is a character blueprint and also the controlled pawn of my behavior tree. The class setting is set to type ‘character’ and it’s running the behavior tree as well:
Should I set it to type ‘pawn’ instead?
There is no code inside the character BP except for the variable I want to set.
Do you mean to put a print string before the cast? anything before the cast executes if that’s what you’re wondering, I have no errors so I don’t understand why the cast is failing.
Here’s the rest of the behavior tree, not sure if that might have something to do with it. The task with yellow around it is the task containing the cast in question.
can you explain this further? I don’t understand what you mean by ‘print string and see what it is’? can you be more specific and tell me how to do this exactly.
don’t I need to call finish execute though? how else would I do it?
yep so that tells you either the task is never being called or the pawn is invalid which is why the cast fails. remove the get display name, if it prints hello ‘default’ the the task is being called at least
Does the blueprint type I’m casting to have to be of type ‘pawn’ it cannot be anything other than type pawn?
Yes I already said the task is running at the very start of the thread though, so how do I fix the invalid pawn? the code in this task should work though I’m assuming, it might be something to do with the way my tree is set up.