User Tools

Site Tools


cerea2:build:shops

Shops

Simplified

To set up a shop you will need to do the following:

  • Place down “shop” object waypoint
  • change its tag to shop_buildertag_unique (no other _ in the name)
  • Change the variable WillBuy on the shop to include the item categories the shop will buy.(default=all)
  • Create shopkeeper npc.
  • Attach cd_g_defaultshop conversation.
  • Change the tag to the tag of the shop+“_keep”
  • Place a shop container placeable
  • Add objects to sell into the placeables inventory. Note that theese must be Cerea type objects with price and base item type set.
  • Change the tag to shoptag+“_A”
  • Place Buy Container
  • Change the tag to shoptag+“_buy”
  • Add the ShopExit trigger to block exit from shop
  • Change the tag to shoptag+“_exit”

For more advanced options read below

on building bars and similar

Note that for building many simple “Shops” like a bar or something that is actually meant to only have few items and allways have them in stock a simple conversation where the pc can buy the things is usually a better solution.

a simplief bar convo: {}=conditional, []=action taken, !{} = the not flag selected in conditional, →(<x>) link to point (<x>)

  • npc: hello, want some booze?
    • pc: sure
      • npc: What is your poison? (<start>)
        • {cc_g_m_hasmoney(1)} pc: some ale(1cp) [ca_g_i_makeitem(“ale”) ca_g_m_takemoney(1) ] → (<start>)
        • {cc_g_m_hasmoney(5)} pc: some good ale(5cp) [ca_g_i_makeitem(“goodale”) ca_g_m_takemoney(5) ] → (<start>)
        • {cc_g_m_hasmoney(5)} pc: some wine(5cp) [ca_g_i_makeitem(“wine”) ca_g_m_takemoney(5) ] → (<start>)
        • pc: nothing at the moment

The links to the main question makes so that player stays in the dialog and can buy more items with simple actions, and does not need to trigger the conversation multiple times.

Create the shop object

Place down the shop object to the location you want the pc to walk to when talking with the shopkeeper. It is a waypoint with the following values:

  • int BuyRate = the starting % when the shop buys things
  • int SellRate = the starting % when the shop sells things
  • int Appraise = the effective appraise skill of the shop
  • int Money = total ammount of money the shop has in the begining.
  • int MaxBuy = the highest price item the shop will buy.
  • string WillBuy = Comma Separated list ofitem categories that the shop will buy.

There is default shop object in the builder package under waypoint blueprints.

Change it to unique tag: shop_buildertag_unique (no other _ in the name)

Create shopkeeper

change tag to same as the shoptag with “_keep” appended.

He will need a conversation with two options.

Somewhere in the conversation you should have an option with conditional: cc_g_i_thingstobuy that has the text for “I want to buy the things I have picked” or something similar. That script sets the custom tokens. 1100 the value of all items from the shop that are carried.
1101 List of all item names from the shop that the pc is carrying
Then you should finally have an option that is “buy” with conditional: cc_g_i_moneytobuythings and action taken: ca_g_i_buythings. 1110 Is the buy price of the items 1111 Is the failure reason when the shop is to buy the items.

You also need to create a second branch for when the shop buys things. it should have conditional: cc_g_i_itemstosell that will initiate the sell items part. then the NPC should check for possible errors with the following scripts:
cc_g_i_shophasmoney return true if the shop has enough money to buy the item.
cc_g_i_righttype return true if the items are right type. and finally an option with action taken:ca_g_i_sellthings.

a simplified convo: {}=conditional []=action taken !{} = the not flag selected in conditional

  • npc: hello
    • pc: hello I want to buy
      • npc: {cc_g_i_thingstobuy} you have things for total of <CUSTOM1100>
        • pc: what all things are those?
          • npc: <CUSTOM1101>
            • pc: I {cc_g_i_moneytobuythings}I want to buy them [ca_g_i_buythings]
            • pc: Maybe later
        • pc: I {cc_g_i_moneytobuythings}I want to buy them [ca_g_i_buythings]
        • pc: maybe later
      • npc: Look around, pick up what you want to buy and come talk to me.
        • pc: ok
  • pc: hello I want to sell things.
    • {cc_g_i_itemstosell} npc: <CUSTOM1111>
      • pc: Allright
    • npc: I will buy those for <CUSTOM1110>
      • pc: allright [ca_g_i_sellthings]
      • pc: I changed my mind.

You can copy the cd_g_defaultshop conversation and make the edits to what the npc says and save with your own tag. That conversation is the same as the above one. You can even use the conversation directly for simple shops.

Create one or more shop containers

Shop containers are placeables with the following attributes, they should have an inventory, be nonstatic and usable.
change the tag to the same as the shop object with a “_A” “_B” and so on appended. (each one higher letter)
Additionally you can create containers with shoptag+“_#” where # is the itemcategory of the item. thus shoptag_1 shoptag_2 and so on Further containers with shoptag+“__#” to create containers for specific base item numbers.

on open script: cp_g_shopopen

variables: If wished:
string Restock = comma separated list of tags of items to restock the container with.
string Fill = comma separated list of tags of items that should be plantifull in the shop (allways will have minimum of 1 in stock)
string Time = comma separated list of times that restocking each item.

Note that all the items should thus use the standard cerea naming of having the tag and resref the same.

Items can be put either directly in the container or be given as items in the above lists to be automatically regenerating.

There is a default “shop container” under placeables. You can just take it and change its tag,name and visual look.

Create the buy items container

Should be a placeable with the same tag as the shopkeeper with “_buy” appended. Must be usable, not static, have inventory.

Place triggers to block exits

Place a trigger to block the exit from the shop.

Change the tag to shoptag+“_exit”.

The trigger should have the script: ce_g_i_leaveshop in the onenter slot

There is a template in the triggers named ShopExit

cerea2/build/shops.txt · Last modified: 2015/05/03 12:32 by 127.0.0.1