I wondered this recently. I ended up doing what Yacoby suggested, but I also looked into the "GetFight" function. From MWSFD:
When an Actor’s fight setting hits 100, they will attack the PC.
Player actions will increase (or decrease) an Actor’s fight setting. These are...
Attack Actor 100
etc.
However, I found that attacking an NPC actually had no effect on their Fight setting :wacko:
I also wonder, does an NPC holding a torch count as them having a weapon drawn...?