adding_an_item_to_a_shop

Adding an item to a shop

To edit the contents of a shop in Hard Times you will have to overwrite the original Vanilla shop to add your own content to it.
Since in the last guide we created a brand new clothing item we will now add it to a shop in game.

First of all create a shops directory in your new mod:

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Shops

Inside the Shops folder we will create a Sprites folder to hold all the shops sprites:

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Shops\Sprites

Inside this folder we will have to place the sprites referenced in the shops descriptions. So lets save this file int the sprotes folder: Save it as

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Shops\Sprites\shop.png

We will also have to add the “shopsFolder” property to our mod descriptor file to let it know there are shops to load. So edit the descriptor file of the mod in:

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Descriptor.json

And lets add the proper entry:

{
  "modName": "MyMod_MODPKG",
  "author": "RadicalFiction",
  "gameVersion": "",
  "langFolder": "Lang",
  "itemsFolder": "Items",
  "shopsFolder": "Shops"
}

For simplicity we will add our item to the MetroShop, the shop inside metro stations. Se it will be easily accessible from any zone. So create the file in your shops directory

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Shops\metro_shop.json

Please note that this will overwrite the corresponding shop in the Vanilla game. Take a look in the vanilla's shops folder to see all the available shops in the base game. Edit the file that should look like this:

{
  "shopId": "Metro Shop",
  "shopSpriteName": "shop.png",
  "shopType": "Shop",
  "openHour": 00,
  "openMinute": 00,
  "closeHour": 23,
  "closeMinute": 59,
  "refillIntervalMins": 30,
  "robberyDuration": 5,
  "robberyRecoveryMins": 480,
  "effectNeededToRob": "crowbar_effect",
  "shoppables": [
	{
	  "itemId": "Metro Ticket",
	  "itemType": "BaseItem",
	  "price": 2,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "food_coffee",
	  "itemType": "FoodItem",
	  "price": 2.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Water Bottle",
	  "itemType": "FoodItem",
	  "price": 1.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Light the Bob Stout",
	  "itemType": "FoodItem",
	  "price": 3.5,
	  "minQuality": 3,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Old Goat liquor",
	  "itemType": "FoodItem",
	  "price": 10,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Smoking Papers",
	  "itemType": "BaseItem",
	  "price": 2.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Cigarette pack",
	  "itemType": "ContainerItem",
	  "price": 6,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 2,
	  "itemsContainedIfBought": "Cigarette|DrugItem*20"
	}
	
  ]
}

Please refer to the Shops Modding Reference for more informations of all the shop's properties exposed in this file.
For this tutorial's sake we will just add a new item to the shop's shoppables list.
So we will create a new shoppable item for our clothing item:

	{
	  "itemId": "Modder Shirt",
	  "itemType": "ClothingItem",
	  "price": 1.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 2
	}

We specified the itemId, the item type, the price we want it to be sold at this shop, minimum and maximum quality of the object sold, and quantities found. It's pretty straightforward.
Next step is to add this item to the shop's shoppables list:

{
  "shopId": "Metro Shop",
  "shopSpriteName": "shop.png",
  "shopType": "Shop",
  "openHour": 00,
  "openMinute": 00,
  "closeHour": 23,
  "closeMinute": 59,
  "refillIntervalMins": 30,
  "robberyDuration": 5,
  "robberyRecoveryMins": 480,
  "effectNeededToRob": "crowbar_effect",
  "shoppables": [
	{
	  "itemId": "Metro Ticket",
	  "itemType": "BaseItem",
	  "price": 2,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "food_coffee",
	  "itemType": "FoodItem",
	  "price": 2.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Water Bottle",
	  "itemType": "FoodItem",
	  "price": 1.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Light the Bob Stout",
	  "itemType": "FoodItem",
	  "price": 3.5,
	  "minQuality": 3,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Old Goat liquor",
	  "itemType": "FoodItem",
	  "price": 10,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Smoking Papers",
	  "itemType": "BaseItem",
	  "price": 2.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 1
	},
	{
	  "itemId": "Cigarette pack",
	  "itemType": "ContainerItem",
	  "price": 6,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 2,
	  "itemsContainedIfBought": "Cigarette|DrugItem*20"
	},
	{
	  "itemId": "Modder Shirt",
	  "itemType": "ClothingItem",
	  "price": 1.5,
	  "minQuality": 2,
	  "maxQuality": 4,
	  "minQuantity": 1,
	  "maxQuantity": 2
	}
	
  ]
}

And we're done, the new item will be sold at this shop.

If everything went well you should now be able to start again the game with no errors(!). Be sure you have your new mod active and start a new game.
Now we should go to a metro station and look for our newly created item to be available for sale. Keep in mind that not all shoppables of a shop are for sale at any moment. The list refreshes every once in a while so you might have to wait and retry to find your item in the shop.

If you have problems or find errors in this guide please get in touch at info@tempi-duri.net.

You could leave a comment if you were logged in.
  • adding_an_item_to_a_shop.txt
  • Last modified: 2019/02/09 07:50
  • by thorfinio