Mode flags can be used to give actors commands. For example, setting the 0x4 mode flag would cause the actor to look for targets. Setting the 0x1 mode flag would make the actor move to his current destination. Clearing the 0x1 flag would stop him from going to his destination.
AI Mode Flags can contradict each other. Setting the 0x4 mode flag while the actor is attacking a target is useless. So remember that you may need to set or clear certain flags to make the AI do what you want.