I make mods in the Skyrim engine because I like tinkering with game/level/quest design. If you want to know why Skyrim runs poorly, here's an example of how the engine works.
Let's say I want to run a script on "NPCs in the vicinity of the player". For instance, if I need to know whether the NPC can see the player via that NPC's OnGainLOS event.
1. Make a quest that points to the player. This is the only way to run a script on startup: making a quest.
2. Create a cloak ability that the quest script adds to the player.
2.a. Create a magic effect on an area around the player. This is the easiest way to affect all NPCs within a certain area.
2.b. Right now, this magic effect is going to be applied every game tick, which is going to use up a lot of computational power. Add a script that toggles it on for a second, then off for four seconds or so.
2.c. Skyrim has 'brawls' where you're not allowed to use magic, but because this is technically magic, it'll break those brawls. Add conditions to the magic effect that make it stop working during brawls.
3. Create a spell. This spell is what the cloak effect casts on any NPC that comes into contact with it.
3.a. Create a magic effect for the spell that contains a script that runs AddSpell on the targeted NPC.
4. Create a spell of the 'Ability' type. This is what the AddSpell script adds to the NPCs. Normal spells expire, abilities do not.
4.a. Create the magic effect for that ability.
4.b. Put whatever script you want the NPC to run into that magic effect.
4.c. Make sure to include a special conditional statement for OnDying so that when the NPC dies, it doesn't keep running the script and bloat the save game.
So essentially you make a quest that adds a spell to you that casts a spell on any NPCs in the area that adds an ability that runs the script.
This is the easiest way the modding community has found to attach scripts to nearby NPCs.