#include "store_inc" void main() { string sNPCTag = GetTag(OBJECT_SELF); object oStore = GetNearestObjectByTag("STORE_" + sNPCTag); if (oStore == OBJECT_INVALID) oStore = GetNearestObjectByTag(GetLocalString(OBJECT_SELF, "STORE_TO_OPEN")); if (GetObjectType(oStore) == OBJECT_TYPE_STORE) { WriteTimestampedLogEntry("STOREDBG: NPC " + sNPCTag + " in " + GetName(GetArea(OBJECT_SELF)) + " opening store " + GetTag(oStore) + " for " + GetName(GetPCSpeaker())); store_Initialize(oStore); OpenStore(oStore, GetPCSpeaker()); } else { WriteTimestampedLogEntry("STOREDBG: store not found for NPC " +sNPCTag + " STORE_TO_OPEN:" + GetLocalString(OBJECT_SELF, "STORE_TO_OPEN")); ActionSpeakString("Sorry, the store is closed", TALKVOLUME_TALK); } }