add_a_paperbin_spawner_to_the_new_scene

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

add_a_paperbin_spawner_to_the_new_scene [2019/02/19 11:48] (current)
thorfinio created
Line 1: Line 1:
 +====== Add a paperbin spawner to the new scene ======
  
 +Now we will add a brand new spawner for the game: a paperbin spawning spare paper items. It will behave a lot like the regular trashbin but will contain different items and will have a differend sound effect.
 +
 +===== Edit the Mod Descriptor =====
 +
 +If you followed the previous guides you should not need to modify the mod descriptor!\\
 +Anyway the mod descriptor file is located in:
 +  C:​\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Descriptor.json
 +And, to load new spawners, you should make sure the spawnersFolder property is set:
 +   "​spawnersFolder":​ "​Spawners",​
 +
 +===== Add the new spawner =====
 +
 +To add a new spawner we will have to create a new file in the spawners folder:
 +  C:​\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Spawners
 +We will create a file called paper_bin.json in there. Edit the file and put this content inside it:
 + {
 +   "​spawnerId":​ "​paper_bin",​
 +   "​fullSpriteName":​ "​paper_bin.png",​
 +   "​emptySpriteName":​ "​paper_bin_empty.png",  ​
 +   "​spawnerUseSound":​ "​paper.ogg",​
 +   "​spawnerUseEffect":​ "​thrash_searching_effect",​
 +   "​cooldownMinutes":​ 10,
 +   "​spawnerUsageDuration":​ 6,
 +   "​minItemsSpawnable":​ 5,
 +   "​maxItemsSpawnable":​ 10,
 +   "​spawnRadius":​ 2.5,
 +   "​interactableDistance":​ 1.5,
 +   "​fixedPosition":​ true,
 +   "​isObstructing":​ true,
 +   "​spawnableItems":​ [
 + {
 +   "​itemId":​ "​cardboard",​
 +   "​itemType":​ "​BaseItem",​
 +   "​minQuality":​ 0,
 +   "​maxQuality":​ 2
 + },
 + {
 +   "​itemId":​ "​spare_cardboard_box",​
 +   "​itemType":​ "​BaseItem",​
 +   "​minQuality":​ 0,
 +   "​maxQuality":​ 2
 + },
 + {
 +   "​itemId":​ "​Newspaper",​
 +   "​itemType":​ "​BaseItem",​
 +   "​minQuality":​ 0,
 +   "​maxQuality":​ 2
 + },
 + {
 +   "​itemId":​ "​*",​
 +   "​itemType":​ "​BookItem",​
 +   "​minQuality":​ 0,
 +   "​maxQuality":​ 2
 + },
 + {
 +   "​itemId":​ "​Smoking Papers",​
 +   "​itemType":​ "​BaseItem",​
 +   "​minQuality":​ 0,
 +   "​maxQuality":​ 2
 + }
 +   ]
 + }
 +Please refere to the [[spawners_modding_reference|Spawner Modding Reference]] for a full explanation of all the properties exposed in there.
 +
 +===== Add spawner sprites =====
 +
 +Our spawner is referrencing two sprites for its two states: empty and full.
 +So let's put the two needed sprites in the Sprites folder under your Spawners folder:
 +  C:​\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Spawners\Sprites
 +{{ :​paper_bin.png?​direct |}}
 +(this is the full sprite)\\
 +{{ :​paper_bin_empty.png?​direct |}}
 +(this is the empty sprite)\\
 +
 +===== Add spawner sound =====
 +
 +Our spawner is referrencing a sound to be played while searching it:
 +   "​spawnerUseSound":​ "​paper.ogg",​
 +So let's put the needed sound clip (required in ogg format) in the Sounds folder under our mod base folder: ​
 +  C:​\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Sounds
 +{{ :paper.ogg |}}
 +(soundclip credits:​[[https://​freesound.org/​people/​oscarurbon/​sounds/​180809/​|oscarurbon @ freesound.org]])
 +
 +===== Add the spawner to an existing scene =====
 +
 +Now that we have our spawner defined, we have to put it in an existing scene for us to test it.\\
 +Let's go and open our new mod scene descriptor file:
 +  C:​\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Scenes\Mod_Scene\Descriptor.json
 +Edit the "​spawners"​ list and make it as it follows:
 + "​spawners":​ [
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ -40,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ -38,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ -20,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ -18,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ 20,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ 10,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ 40,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 + {
 + "​modSpawnerId":​ "​paper_bin",​
 + "​modSpawnerPositionX":​ 38,
 + "​modSpawnerPositionY":​ -8,
 + "​modSpawnerRotation":​ 0,
 + "​spawnerColliderRadius":​ 0.5
 + },
 +   ],
 +We added a number of paper_bin spawnes scattered through the map.
 +
 +===== 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.\\
 +In the new modded scene you will now find paper bin spawners scattered through the map!
 +{{ :​paper_bin_shot.png?​direct |}}
 +\\
 +If you have problems or find errors in this guide please get in touch at [[mailto:​info@tempi-duri.net|info@tempi-duri.net]].\\
  • add_a_paperbin_spawner_to_the_new_scene.txt
  • Last modified: 2019/02/19 11:48
  • by thorfinio