Make sure you have qglobals enabled on the NPC.
Also you shouldn't need to use all of that other code. The plugin handles the instance tracking, if the instance doesn't exists it creates it. If there is already an instance based on the criterion it should direct you back to the appropriate one.
|