How to do "If in some state( in statemachine) and do some task " in Behavior Tree?

My pawn has some states in state machine (idle, run, hop, standby…)
I want it to execute some tasks when it is in some specified states such as run.
Which API or function should I use?

need help~

custom events from state

In terms of behavior tree, you could set a specified blackboard key off the back of the custom event and use it as a decorator to control execution.