View Single Post
Old 04-20-2011, 02:04 AM   #14
Mostly dormant
stoffe's Avatar
Status: Administrator
Join Date: Apr 2002
Posts: 5,850
Helpful!  10 year veteran!  Notable contributor 
Originally Posted by Dak Drexl View Post
I'm sorry, I just don't get it I'm scripting retarded and I just observed that the store wouldn't open when I had the exclamation point in there. When I took it out, it opens.
Originally Posted by Qui-Gon Glenn View Post
The only reason why the script wouldn't work with the "!" is if you had already spawned the store earlier, perhaps in an OnEnter script via script injection. In that case, it would not create a second shop of the same tag, as that is what the !GetIs... does... it makes sure that such a thing is NOT already in existence.
Pretty much. The only situation I can think of off the top of my head where it would work as DD described would be if there is another non-store object in the area already with the same tag as the store. In that case the script would find an existing object and not spawn a new store instance, but since the existing object isn't a store it would be unable to open it, and thus nothing would happen.

In preudo-code, the script essentially does:
void main() 
    object oStore = Get existing store object identified by its Tag value
    object oSpeaker = Get the object (player, usually) that I'm in dialog with
    if (there is no object in the area matching the specified Tag)
        oStore = Create a new store object at my location from the UTM template with the Resref set here

    if (there is now a oStore object, either previously existing or just created)
        open the store with the person I'm in dialog with after 0.5 seconds.

stoffe is offline   you may: quote & reply,