Access NPC Info

Hey all,

I am starting to look into MV Scripting using js code.
Now I got my script to do something when I talk to an NPC which is a shop:

Fancy.FTrader.Scene_Shop_doBuy = Scene_Shop.prototype.doBuy;
Scene_Shop.prototype.doBuy = function(number) {
console.log(this);
Fancy.FTrader.Scene_Shop_doBuy.call(this, number);
};

so far so good. I can access this and this._item and this._actor
Now I am looking to find a reference to the NPC I am talking too, like an ID or something unique would be ideal.

Would be great if someone can give me a hint where to look or a code snippet.

Many thanks in advance!
Snap
I'm not so sure if this would go well with what you want to do, but maybe setting a var inside MV to act like a number ID (you would need to be careful with this if you make too many shops maybe) could work.
But you would need to set the number before calling your shop every time.
*Small note: it would act like an "ID", it wouldn't be an actual ID for that certain event.
Thank you Shugo, so there's no such thing like "NPC/Shop" Object to access? I am wondering how MV knows that a specific npc is selling 20 Potions while another sells Swords. I know it can be set in the Database but need it in Plugin Scope.
$gameMap._interpreter.eventId() is the one you're after.
Trihan that's exactly what I needed! Thanks guys 🙂
Yes, NPC's are just events.

Original thread: https://forums.rpgmakerweb.com/threads/access-npc-info.76037/