You should look at Slapper's source code before creating a thread. Its so much easier to learn from another plugin that does exactly what you want than waiting for replies here.
/slapper <mob> <name> Eg: slapper bat abcd Color: slapper bat {color}2Test Add a command to the NPC: Assuming your NPC is named 'abc1' Go to the config.yml Add these lines: abcd1: - tell {player} Hey, it's me, the fake guy! If you used colors for your 'slapper' npc, there's no need to add the § or the {color} tag in the config. Suppose your NPC is named: §bFan§eC You config.yml must look like this... FanC: - say command...
He wants code NOT a plugin. He even said he already knows there's a plugin called Slapper, read carefully next time.
"ok i know there is a plugin called slapper but how can i spawn and a NPC and run a command via it?" He used: 'How can I spawn' 'Run A Command' 'VIA it' it = Slapper VIA it= through slapper When he says 'How can I spawn and a NPC and run a command via it", he means, "How can I spawn a NPC and run a command through Slapper". This is primarily known as English.
Learn to read CAREFULLY before posting. If he wanted a npc plugin then why would he post it in the Plugin Development section and not the Plugin Request section? He wants code for a Command to Spawn NPCS and Running Commands with Them, not a plugin.
Why not check out Slapper's source code and try to figure it out? Off-topic. It's our choice whether we want to help you or completely ignore you. In this case, I'm ignoring you. It's no use telling him, for some people it goes in one ear and comes out the other. You really think you're helping? He already knows how to use the plugin, he wants to know how to spawn NPC(s), which is a totally different topic. For some people, when you tell them something, it goes in one ear and comes out the other. Save your breath(or in this case typing), because they'll repeat that mistake.