Someone already made a post about putnpc2 some days ago, try to search before make a new post, anyway, you can also use
join inside the putnpc2 brackets. I consider good to use join when the script is too big, so it will make your code shorter and readable.
NPC Code:
putnpc2 x,y,{
join <class name>;
};