Battle Enemy ID in common event

I'm trying to create a skill which adds enemies in a current battle to the monster book. I can do this by adding 

$game_variables[8]=b.idto the damage formula and then calling a common event, but since I don't want this ability to do damage it means a "0" pops up for damage dealt. Is there a way to fill a variable with the enemy IDs using a common event so I can do this without putting it in the damage formula?

Original thread: https://forums.rpgmakerweb.com/threads/battle-enemy-id-in-common-event.49291/