User Tools

Site Tools


adding_an_item_to_a_spawner

Adding an item to a spawner

Spawner are game elements which can spawn items on a timely base, can request for some items to be equipped to be used and have a timeout property.
Please refer to the Spawners Modding reference for more informations on spawner properties and configuration.

In this guide you will add your newly made object to the trashbin spawner to make it findable while looking in trashbins.

Editing the Spawner Descriptor

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

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

Inside it we will have to create the Sprites folder which will hold all the spawners sprites

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

Then we have to edit our mod descriptor file spawnersFolder property to let him know that there are spawners to load in this mod:

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

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

Then we will create the trashbin.json file to add our object to the spawnables array:

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

Please note that this will overwrite the spawner with id “trashbin” present in the vanilla game mod. Edit the file that should look something like this:

{
  "spawnerId": "trashbin",
  "fullSpriteName": "thrashbin_full.png",
  "emptySpriteName": "thrashbin_empty.png",  
  "spawnerUseSound": "trash_search",
  "spawnerUseEffect": "thrash_searching_effect",
  "cooldownMinutes": 360,
  "spawnerUsageDuration": 3,
  "minItemsSpawnable": 1,
  "maxItemsSpawnable": 5,
  "spawnRadius": 2.5,
  "interactableDistance": 1.5,
  "fixedPosition": false,
  "isObstructing": true,
  "achievementsOnComplete": "SearchTrash",
  "spawnableItems": [
	{
	  "itemId": "*",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 100
	},
	{
	  "itemId": "pen",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 20
	},
	{
	  "itemId": "cardboard",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 20
	},
	{
	  "itemId": "umbrella",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 80
	},
	{
	  "itemId": "spare_cardboard_box",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "blanket",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 10
	},
	{
	  "itemId": "Empty water bottle",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Broom",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "metal_scrap",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "spring",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "rope",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "nails",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "dutch_tape",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 20
	},
	{
	  "itemId": "wood_scraps",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "wood",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 40
	},
	{
	  "itemId": "fishing_reel",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 70
	},
	{
	  "itemId": "fishing_float",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 50
	},
	{
	  "itemId": "fishing_pole_raw",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 80
	},
	{
	  "itemId": "fishing_wire",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 50
	},
	{
	  "itemId": "boot",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Newspaper",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Bleach",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 50
	},
	{
	  "itemId": "Bucket",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 30
	},
	{
	  "itemId": "Bass Guitar",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 95
	},{
	  "itemId": "Guitar",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 95
	},
	{
	  "itemId": "Cloth",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Small Cloth",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Plastic scrap",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Sewing thread",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 30
	},
	{
	  "itemId": "Sewing needle",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 30
	},
	{
	  "itemId": "church_flyier",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Dirt",
	  "itemType": "BaseItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	
	
	{
	  "itemId": "Fortune Cookie",
	  "itemType": "HintGiverItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Fortune Cookie",
	  "itemType": "HintGiverItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Fortune Cookie",
	  "itemType": "HintGiverItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Fortune Cookie",
	  "itemType": "HintGiverItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Fortune Cookie",
	  "itemType": "HintGiverItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "Fortune Cookie",
	  "itemType": "HintGiverItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	
	
	
	{
	  "itemId": "*",
	  "itemType": "FoodItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	},
	{
	  "itemId": "*",
	  "itemType": "ClothingItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 50
	}
  ]
}

Wow! Quite a long list! Everything you can find in a trashbin is listed here. You can notice each entry has some properties, which should sound familiar to you if you followed the previous guides.
Worth noting there is a “rarity” property indicating how rare is to find the concerned item in the spawner. The higher the value the less probable is to find such item.
Another thing worth noting is the use of a wildcard in the last two entries of the list. It will tell the game to get a random item from the category.
To make thing more dramatic we will remove everything from this spawnables list and replace them with our new item. So searching in trashbins will always return our new shirt. Sounds fun.
So, after our editing our trashbin file should look like this:

{
  "spawnerId": "trashbin",
  "fullSpriteName": "thrashbin_full.png",
  "emptySpriteName": "thrashbin_empty.png",  
  "spawnerUseSound": "trash_search",
  "spawnerUseEffect": "thrash_searching_effect",
  "cooldownMinutes": 360,
  "spawnerUsageDuration": 3,
  "minItemsSpawnable": 1,
  "maxItemsSpawnable": 5,
  "spawnRadius": 2.5,
  "interactableDistance": 1.5,
  "fixedPosition": false,
  "isObstructing": true,
  "achievementsOnComplete": "SearchTrash",
  "spawnableItems": [
	{
	  "itemId": "Modder Shirt",
	  "itemType": "ClothingItem",
	  "minQuality": 0,
	  "maxQuality": 2,
	  "rarity": 0
	}
  ]
}

Now we have to provide the sprites referenced in the json file to have our spawners properly rendered in game. Just save them both in

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




TEST IT OUT

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.
Just approach any trashbin in the game and look in it. And… surprise!

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_spawner.txt · Last modified: 2019/02/09 08:02 by thorfinio