Just a little workaround, mayby it helps:
I use c_scan for detecting, too. But also for collecting items, Share Xp, ... in my game. So I needed "different" c-scans. For this I use a gobal variable "indicator".
For every "scan-event" I define a other indicator, eg. int ind_detecting_enemies = 1; int ind_collecting_gold = 2; ....
Before every scan, i set the global indicator equal to the reason I scan: indicator = ind_detecting_enemies;
In the event of the NPC, I check, if the indicator was detecting_enemies - otherwise I would detect them if i collect gold :-)