How to create a shopkeeper / merchant npc

Hi

I’m in the middle of creating a ragnarok online style rpg and I would like to create a merchant npc shop. I see this a many games and can’t wrap my head around the code. I would really appreciate it if anyone could post a tutorial or sample code that would explain how to create a merchant npc. I added a link to a video showing the effect I’m looking for.

Thanking you in advance