State scripts are fired as heartbeats for creatures under their effect.
This 2da contains the state scripts to run under particular effects. Some are bugged:
- EffectDominated applied NPC to NPC seems to fire no event script
- EffectDazed does not fire it's script at all
For things like confusion (Random movement/attacks) or fear (moving away from enemies) it will set the person to commandable then do the action and set them to uncommandable.
For things where the creature just stands in place, Bioware uses it to have henchman heal their masters, although this isn't perfectly implemented.
You can find more information on this 2da on this wiki page.