Creating a custom decorator using blueprint
We should add one more decorator to the parent selector node before we continue. Even though there is an acceptance radius that we specified on the AIMoveTo
node within the BMMoveTo
task, we should add a decorator that will only call this event if the AI is outside a certain range to the player. Unfortunately, this check does not already exist so we have to again create our own. We can do this by clicking the New Decorator button in the BT editor. This will generate a blueprint decorator and open the blueprint editor. Be sure to rename this decorator to BMCloseEnough
.
The editor for tasks, services, and decorators is all the same. However, this time we are going to be overriding a different function. This time we need to override PerformConditionCheck
. Unlike EventReceiveExecute,
this function has a return type. As all decorators need to report success or failure, this function returns a boolean that represents just that.
The purpose of this decorator...