User Tools

Site Tools


cerea1:builders:ztk_merch

ztk_merch

Usage

This dialog is the generic dynamic merchant dialog, that will dynamically create the shop based on the variables listed on the shopkeeper creature. This is used as a conversation for the shopkeeper, and it will automatically do all things needed. The shop will be filled with items and every time the shop is opened it is checked whether refills to the shop are needed.

How to Use

  1. Create shopkeeper creature with unique tag.
  2. Set the conversation of the shopkeeper to be ztk_merch (or any other script having ztk_init_store script as a active script).
  3. Set the necessary variables on the shopkeeper:
    1. text_greetings (string) String used to greet the PC when he starts dialog.
    2. text_open_shop and text_no_shopping (string) Text selections PC can select to open shop or to indicate he is not interested in shopping. (defaults are most likely ok).
    3. shop_resref (string) Resref of shop to use as template when creating shop. Normally ztk_merch_100_1 ztk_merch_200_1 or ztk_merch_400_1.
    4. item* (string) and item*prob (int) for each item to be added. I.e. first set item1 to have the resref of first item to be added to the shop. Then add item1prob to have the probability in promils (i.e 1/10th of procent), i.e 500 means 50% change the item will be added to the shop inventory. Then set item2 and item2prob and so on. If probability is missing then it is assumed to be 1000. All items added to the shop MUST have identical resref and tag, as otherwise the script will add duplicate items to the shop (unless of course the fill_time is not set, which means the shop is not refilled).
    5. fill_time (int) Time in game seconds how often the shop receives refills. If this is not set then 10 years is assumed (i.e. items are added only once per reset). Setting this to 86400 will mean that items are added every game day and so on.

Internals

Internally this uses the ztk_init_store script to create the shop and then when the shop is openeded the OnShopOpen script ztk_fill_store is run. This also uses custom tokens 3820-3822 for the greetings, open shop selection and no shopping selection. The actual shop is stored to the Store0 and this uses _gen_openstore0 script.

cerea1/builders/ztk_merch.txt · Last modified: 2015/05/03 12:46 by 127.0.0.1