Tutorials/Creating Custom Spawns: Difference between revisions

(Updated conditions links to use wiki page instead)
 
(2 intermediate revisions by the same user not shown)
Line 64: Line 64:


=== Step 2: Create your spawn files ===
=== Step 2: Create your spawn files ===
There's a lot of data that can go into a <code>[[Spawn Pool World|spawn file]]</code>. The data in spawn files can be rather self-explanatory. These files can be as simple as "spawn in the forest", or as complicated as "spawn at 2:30AM-3:00AM on top of clay during the new moon in an ocean biome that is south of spawn." The possibilities are limited by your creativity and understanding of [https://gitlab.com/cable-mc/cobblemon/-/wikis/Spawner/Spawn-Condition spawn conditions.]
There's a lot of data that can go into a <code>[[Spawn Pool World|spawn file]]</code>. The data in spawn files can be rather self-explanatory. These files can be as simple as "spawn in the forest", or as complicated as "spawn at 2:30AM-3:00AM on top of clay during the new moon in an ocean biome that is south of spawn." The possibilities are limited by your creativity and understanding of [[Spawn_Condition| spawn conditions]]
 
Keep in mind that the sort of "economy" of local spawns will affect the rarity of the Pokémon you are making spawn files for. For example, if you made spawn conditions for a Kyogre to spawn on the ocean surface in the ultra-rare pool with a really low weight, it will actually spawn more frequently than you intended despite the low weight. This is because there aren't many ultra-rare water surface spawns to begin with. If this example Kyogre is the only ultra-rare spawn in this local ultra-rare pool, then whenever the game decides to spawn an ultra-rare Pokémon, it will be Kyogre 100% of the time. Kyogre would have no other ultra-rare spawn to compete with so it will always be the chosen spawn.  


Here is a list of options that some of the spawn properties can use:  
Here is a list of options that some of the spawn properties can use:  
Line 71: Line 73:
* '''"bucket"''': The rarity pool of the Pokémon. You can choose <code>"common"</code>, <code>"uncommon"</code>, <code>"rare"</code>, or <code>"ultra-rare"</code>
* '''"bucket"''': The rarity pool of the Pokémon. You can choose <code>"common"</code>, <code>"uncommon"</code>, <code>"rare"</code>, or <code>"ultra-rare"</code>
* '''"weight"''': This determines how common the Pokémon will be inside of the assigned rarity pool. Generally, you can treat it like a scale of 0.1 to 10 on how rare it will be in that pool. You can use numbers higher than 10 if you really want that Pokémon to spawn more often.  
* '''"weight"''': This determines how common the Pokémon will be inside of the assigned rarity pool. Generally, you can treat it like a scale of 0.1 to 10 on how rare it will be in that pool. You can use numbers higher than 10 if you really want that Pokémon to spawn more often.  
* '''"condition"''': You can use any of the conditions listed [https://gitlab.com/cable-mc/cobblemon/-/wikis/Spawner/Spawn-Condition here] to make Pokémon spawn
* '''"condition"''': You can use any of the conditions listed [[Spawn_Condition| here]] to make Pokémon spawn
* '''"anticondition"''': You can use any of the conditions listed [https://gitlab.com/cable-mc/cobblemon/-/wikis/Spawner/Spawn-Condition here] to '''PREVENT''' a Pokémon from spawning
* '''"anticondition"''': You can use any of the conditions listed [[Spawn_Condition| here]] to '''PREVENT''' a Pokémon from spawning
* '''"biomes"''': A subcategory of conditions and anticonditions. You can use biome ids or any [https://docs.google.com/document/d/1iB0EJSc2r6mRJXIo1n3XpHbZ5udwJVnrh2pXdhTyH8c/edit biome tags]. Should work with modded biome id's too!
* '''"biomes"''': A subcategory of conditions and anticonditions. You can use biome ids or any [https://docs.google.com/document/d/1iB0EJSc2r6mRJXIo1n3XpHbZ5udwJVnrh2pXdhTyH8c/edit biome tags]. Should work with modded biome id's too!


Line 107: Line 109:
# Check if your target Pokémon spawns where you assigned it to. You can use <code>/checkspawn <rarity></code> when in the assigned biome.  
# Check if your target Pokémon spawns where you assigned it to. You can use <code>/checkspawn <rarity></code> when in the assigned biome.  
#* You can run the command <code>/locate biome <assigned biome></code> to get coordinates to the assigned biome. You can then click on the coordinates it gave you and be teleported instantly.  
#* You can run the command <code>/locate biome <assigned biome></code> to get coordinates to the assigned biome. You can then click on the coordinates it gave you and be teleported instantly.  
#* You can also use the command <code>/locate structure <assigned structure></code> if you used a structure condition.
# Ensure that your target Pokémon at least appears in the <code>checkspawn</code> list after meeting its conditions.
# Ensure that your target Pokémon at least appears in the <code>checkspawn</code> list after meeting its conditions.
#* If your Pokémon appears in this checkspawn list, then it will spawn in the area eventually! It's always a matter of time and RNG.
# Make any desired edits to the data files and save. '''You need to quit to main menu, and load the world again if you want to see those changes.'''
# Make any desired edits to the data files and save. '''You need to quit to main menu, and load the world again if you want to see those changes.'''
#* The command for <code>/reload</code> does not work with Cobblemon addons unfortunately.  
#* The command for <code>/reload</code> does not work with Cobblemon addons unfortunately.  

Latest revision as of 13:52, 19 May 2024

Preface

This tutorial will show you how to create your own custom Pokémon spawns. The JSONs in the spawn pool world folder control how a Pokémon will spawn naturally. You can create or edit files for each Pokémon to give them new spawn conditions. Writing some extra data in the pack.mcmeta of a datapack can also nullify the spawns from the base mod. You can use this to have total control over Pokémon spawns.

Some third party tools exist to help with the mass production of spawn files. Help with mass spawn file production can be found on the Cobblemon Discord server.

Step 1: Arrange the folders for this addon

Depending on the kind of addon you want to make, you may want to make some slight adjustments to your folder structure of your spawn files. Generally, you can arrange your custom spawn files the same way other addons do. Your spawn files can have their own namespace if you don't want them to be affected by other mods.

Create a pack.mcmeta to suit your needs

Your pack.mcmeta can affect how your addon will work with other addons loaded before yours. A normal pack.mcmeta will have no affect on other addons, but adding some extra lines of data to it can completely nullify files in a specified folder.

Use one of the following pack.mcmeta examples below. Unless you have plans to negate all other spawns, like making your own custom region for something, then just make an addon friendly pack.mcmeta file!

  • The addon friendly pack.mcmeta - This one wont affect other addon files
    1. Create a new text file and name it pack.mcmeta
      • Ensure that it doesn't end in other file extensions like .txt
    2. Open the file and insert the following data:
{
 "pack": {
   "pack_format": 15,
   "description": "Example datapack description"
 }
}
  1. Save the file and prepare to place it in your addon folders.


  • The pack.mcmeta that negates all other spawns - Will prevent spawns in the base mod or addons loaded before it from working.
    1. Create a new text file and name it pack.mcmeta
      • Ensure that it doesn't end in other file extensions like .txt
    2. Open the file and insert the following data:
{
 "pack": {
   "pack_format": 15,
   "description": "Example datapack description"
 },
   "filter": {
     "block": [
       {
         "namespace": "cobblemon",
         "path": "spawn_pool_world"
       }
     ]
   }
}
  1. Save the file and prepare to place it in your addon folders.

Now, you can create the folders to place your files into.

Folder Structure

Now you can create the folder structure for your addon. Create a series of folders arranged like the following example. Don't forget to place your pack.mcmeta that you just made. You can create your own namespace instead of using the cobblemon namespace if you don't want your spawn files to be affected from folder blocking.

Folder Structure

  • (addon name)
    • pack.mcmeta
    • data
      • cobblemon
        • spawn_pool_world
          • <sub_folders> (optional)


All of the spawn files will be placed somewhere in the spawn pool world folder!

Step 2: Create your spawn files

There's a lot of data that can go into a spawn file. The data in spawn files can be rather self-explanatory. These files can be as simple as "spawn in the forest", or as complicated as "spawn at 2:30AM-3:00AM on top of clay during the new moon in an ocean biome that is south of spawn." The possibilities are limited by your creativity and understanding of spawn conditions

Keep in mind that the sort of "economy" of local spawns will affect the rarity of the Pokémon you are making spawn files for. For example, if you made spawn conditions for a Kyogre to spawn on the ocean surface in the ultra-rare pool with a really low weight, it will actually spawn more frequently than you intended despite the low weight. This is because there aren't many ultra-rare water surface spawns to begin with. If this example Kyogre is the only ultra-rare spawn in this local ultra-rare pool, then whenever the game decides to spawn an ultra-rare Pokémon, it will be Kyogre 100% of the time. Kyogre would have no other ultra-rare spawn to compete with so it will always be the chosen spawn.

Here is a list of options that some of the spawn properties can use:

  • "presets": You can use any of these presets listed on the Gitlab or you can make your own presets.
  • "context": You can choose between "grounded" for land spawns, "submerged" for underwater spawns, and "surface" for spawns on the surface of water or lava.
  • "bucket": The rarity pool of the Pokémon. You can choose "common", "uncommon", "rare", or "ultra-rare"
  • "weight": This determines how common the Pokémon will be inside of the assigned rarity pool. Generally, you can treat it like a scale of 0.1 to 10 on how rare it will be in that pool. You can use numbers higher than 10 if you really want that Pokémon to spawn more often.
  • "condition": You can use any of the conditions listed here to make Pokémon spawn
  • "anticondition": You can use any of the conditions listed here to PREVENT a Pokémon from spawning
  • "biomes": A subcategory of conditions and anticonditions. You can use biome ids or any biome tags. Should work with modded biome id's too!


To keep things simple, this part of the guide will show you how to create a spawn file from a template.

  1. Obtain a JSON to use as a template from the Gitlab.
    • Buneary is a great example template. The file is short, but Buneary is very common due to having 3 biome groups it can spawn in.
  2. Rename the file to anything you want. The name must be different than the original.
    • Example: bunearyspawn2
    • If the file name and folder path are exactly the same as the base mod, then it will replace the base mod's spawn file instead. This is only recommended if you want to tune existing spawn files to your liking.
  3. Open the file and locate all the strings for "id" and "pokemon"
  4. Edit the Pokémon's name and replace it with the Pokémon you want to make custom spawns for.
    • If you stop after this step, then the replacement Pokémon will now spawn in the exact same conditions as the previous Pokémon.
  5. Replace the list of "presets" if desired
    • A list of available presets can be found on the Gitlab
  6. Replace the value for "context" if desired.
  7. Replace the value for "bucket" if desired.
  8. Change the values for "level". This is the minimum and maximum level it will spawn at.
  9. Replace the value for "weight" if desired.
    • Treat the number like a scale of 0.1 to 10 for its rarity bucket. This will keep your spawns balanced with other spawn files.
  10. Change the"condition" values if desired.
    • Most of the time, you'll want to change the list of "biomes"
  11. Change the"anticondition" values if desired.
    • Sometimes you might even want to delete this section if it exists in the template.
  12. Save the file.
  13. Place this new spawn file in the spawn_pool_world folder of your addon
  14. Repeat the whole process for any other spawn files you want to make!

Step 3: Test your addon in game

Load your addon in game to see if your custom spawn files are working. You can have your preferred file editor open to edit any relevant JSON files in the datapacks folder if needed.

  1. Copy your addon folder and place it in the "datapacks" folder of your world in the Minecraft root directory.
  2. Start up Minecraft.
  3. Load/create a Creative world save that contains your addon in the "datapack" folder.
  4. Check if your target Pokémon spawns where you assigned it to. You can use /checkspawn <rarity> when in the assigned biome.
    • You can run the command /locate biome <assigned biome> to get coordinates to the assigned biome. You can then click on the coordinates it gave you and be teleported instantly.
    • You can also use the command /locate structure <assigned structure> if you used a structure condition.
  5. Ensure that your target Pokémon at least appears in the checkspawn list after meeting its conditions.
    • If your Pokémon appears in this checkspawn list, then it will spawn in the area eventually! It's always a matter of time and RNG.
  6. Make any desired edits to the data files and save. You need to quit to main menu, and load the world again if you want to see those changes.
    • The command for /reload does not work with Cobblemon addons unfortunately.

You should now have new natural Pokémon spawns!