Spawner Component

From wiki
Revision as of 07:04, 14 December 2017 by DeamonHunter (Talk | contribs) (Update Page.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Category:Component Modding are all optional properties that can be added to any file. Components are useful in extending the original files with even more information, such as the cost of the item or whether the block can be broken by a weapon.

On this page, we go over the Spawner component, signified by the following;

"spawner": {
  =Content=
},

Spawner components are components which specify something that should be spawned. These components have a couple different things they can spawn;

  • Villagers
  • Treasure
  • Farm Animals

It also specifies extra aesthetic affects to go along with the spawning animation.


When and How to use

Spawner component is needed whenever you want to spawn any of the things listed aboce. A Spawner component is specifically used whenever a Tile has it Tile#"tileStateKind" equal to "staxel.tileState.SpawningCrate". Otherwise Spawner component will do nothing.

To start off with first, you will need to create a Tile with Tile#"tileStateKind" equal to "staxel.tileState.Spawner". Once that is done, you can add the following below the last property of the file;

"spawner": {
  "suppressRendering": true,
  "spawnParticles": "",
  "spawnEmote": "",
  "spawnDelay": 0,
  "destroyDelay": 1000000,
  "villager": {
    "code": "staxel.village.character.Maximilian"
  }
}

This particular section spawns a Villager however it is fairly easy to specify and/or a FarmAnimal as well.

Firstly, the universal properties. #"suppressRendering" is used to stop the tile from rendering in the world. This is often used for things already placed in the world as part of a building. #"spawnParticles" is the Particles that it will play while spawning. #"spawnEmote" is the Emote that will play while spawning. #"spawnDelay" is how much delay, in microseconds after activation, there will be before any items or entities spawn. #"destroyDelay" is how much delay, in microseconds after activation, there will be before the tile destroys itself.

After there are three different properties depending on what you want to spawn. #"farmAnimalCode" is used to spawn a Farm Animal. #"treasure" is used to spawn items from a Treasure Pool. Finally, #"villager" is used to spawn a Villager. There are two different ways for "villager", the first and simplest is using the #"code" value and using a code of a Villager NPC file. The second is to specify "personality", "design", "outfit" and a #"name". Each of these need their respective codes, although "name" is just whatever you want to name this villager.

With that you have specified everything needed to spawn something.


Config Options

All config options must be inside the body of;

"spawner": {
  =Config Here=
}

"destroyDelay"

Valid options (Integer): A positive integer value.

Default Value: No default value is specified. Always need to provide your own.


This is the amount of microseconds that will need to pass before destroying the original tile.


"farmAnimalCode"

Valid options (String): A string which points to a Farm Animal code.

Default Value: If not specified, will not spawn any farm animals.


This is the Farm Animal that will spawned.


"spawnDelay"

Valid options (Integer): A positive integer value.

Default Value: No default value is specified. Always need to provide your own.


This is the amount of microseconds that will need to pass before anything is spawned.


"spawnEmote"

Valid options (String): A string which points to a Emote code.

Default Value: No default value is specified. Always need to provide your own.


This is the emote that will be used when spawning. Having no value (i.e. Using "") will mean that no emote plays.


"spawnParticles"

Valid options (String): A string which points to a Particle System code.

Default Value: No default value is specified. Always need to provide your own.


These are the particles that will be used when spawning. Having no value (i.e. Using "") will mean that no particles play.


"suppressRendering"

Valid options (Bool): True or False

Default Value: If not specified, will be false.


This will be whether or not the tile will be visible. This is useful for hiding the spawning tiles of Villagers and similar that are in the village already.


"treasure"

Valid options (Bool): A string which points to a Treasure Pool code.

Default Value: If not specified, will not spawn any treasure.


This is the Treasure pool that will be used to spawn items.


"villager"

This specifies a villager that is to be spawned. There are two major types of spawning. The first is as follows;

"villager": {
  "code": "staxel.village.character.Maximilian"
}

This specifically calls for a Villager NPC code, and will spawn that NPC.

The second is as follows;

"villager": {
  "personality": "staxel.village.personilty.whatever",
  "design": "staxel.village.design.whatever",
  "outfit": "staxel.village.outfit.whatever",
  "name": "Villager 1"
}

This specifies each individual trait of a villager. This is mainly kept as backwards compatibility. Try using the Villager NPC method first.


"code"

Valid options (String): A string which points to a Villager NPC code.

Default Value: If not specified, will not use an already made file, but will use the other properties specified below.


This is the already created villager that it will spawn.


"design"

Valid options (String): A string which points to a Villager Design code.

Default Value: Only used when #"code" is not specified. Otherwise if not specified, may lead to a random design.


This is the design of the villager that is to be spawned. As mentioned already, if "code" is specified this will not be used.


"name"

Valid options (String): Any string.

Default Value: Only used when #"code" is not specified. Otherwise if not specified, may not spawn a villager.


This is the name of the villager that is to be spawned. As mentioned already, if "code" is specified this will not be used.


"personality"

Valid options (String): A string which points to a Villager Personality code.

Default Value: Only used when #"code" is not specified.


This is the personality of the villager that is to be spawned. As mentioned already, if "code" is specified this will not be used.


"outfit"

Valid options (String): A string which points to a Villager Outfit code.

Default Value: Only used when #"code" is not specified. Otherwise if not specified, may lead to a random ourfit.


This is the outfit of the villager that is to be spawned. As mentioned already, if "code" is specified this will not be used.