This is what I did in one of my mods. This is a quest script an should be an ok starting point for you. It checks if the player enters a new cell; if so, it adds a token to every nearby actor. Note that you'd have to create a quest to attach this script to, and make sure the quest is active (either use the StartQuest function or set the quest as "Start Game Enabled").
scn QUESTSCRIPTref cellref actorbegin gamemodeif cell == player.getparentcell returnelse set actor to getfirstref 69 1label 10 if actor if actor.getitemcount token == 0 actor.additem token 1 endif set actor to getnextref goto 10 endif set cell to player.getparentcellendifend
Of course you'd need to create a token (weightless, slotless, valueless, unplayable item) and attach a script that forces the token's carrier to attack the player if the player gets too close. In this script I used a distance of 150, which is the default activation distance.
scn TOKENSCRIPTref actorbegin onaddset actor to getcontainerendbegin gamemodeif actor.getdistance player < 150 actor.startcombat playerendifend