Merchants:Scripting

From NWN1 Custom Content Guide

Jump to: navigation, search

Stores in NWN are opened with a small script, the default suits most occasions, but edits can be done to enable/disable the use of the appraise skill, or modify the markup depending on other factors, for example the dwarf who gives discounts to other dwarves and bumps the price up for elves.

The default store open script, as of HotU, and the appraise skill is:

void main()
{
    object oStore = GetNearestObjectByTag("STORE_TAG");
    if (GetObjectType(oStore) == OBJECT_TYPE_STORE)
    {
        gplotAppraiseOpenStore(oStore, GetPCSpeaker());
    }
    else
    {
        ActionSpeakStringByStrRef(53090, TALKVOLUME_TALK);
    }
}

The script looks for the nearest store which matches the tag given (see highlight), if the store is found it opens it using the new gplotAppraiseOpenStore() function, if you wish not use appraise for this store you can use the function OpenStore().

Failing this it displays from the talktable "I am sorry, but there is no store available.", the use of the ActionSpeakStringByStrRef() function allows this message to appear in the native language of the player, however you may wish to speak a more 'in character' phrase along the lines of "I'm sorry, but I'm not at work, can you talk to me later when I'm back at the shop."


Main Page | Scripting | Merchants:Scripting

Personal tools