all units have attributes, such as skill, or weapons, or side, or face, etc. these attributes can be set, and they can also be detected.
one of those attributes is behaviour, another is combatmode. you can look both of these up in the comref.
i also suggest you take a look through the faq, because a lot of the questions you've been asking recently have answers in there.