Config
SoundAPI can generate config files that allow the end user to choose which sounds are replaced.
To do this, you need to add the following to a Condition
(Learn more about conditions).
The condition will activate if true
unless otherwise specified!
(Click for Example)
json5
{
"condition": {
"type": "config",
"config": "Category:Option",
},
"replacements": [
{
"matches": "*:ZombieAttackPlayer",
"sounds": [
{
"sound": "Enemies/Zombie/MyAttackPlayerSound.ogg"
}
]
}
]
}
We also need to modify sound_pack.json
and add further information about what this config does
(Click for Example)
json5
{
"name": "MySoundMod",
"config": {
"Category:Option": {
"description": "Enable Zombie attack sound?",
"default": true
}
}
}
You can modify the Category
and Option
lines freely, but as before, try to organize them!
(Click for Example)
json5
{
"name": "MySoundMod",
"config": {
"Enemies:ZombieAttackSounds": {
"description": "Enable Zombie attack sound?",
"default": true
}
}
}
Configs can also be used to switch between alternative sounds.
To do this, we need to use the Value
property. If the config is the same as whatever you wrote in Value
, the Condition
will be activated.
Make sure to include available variation names in the description!
(Click for Example)
json5
{
"name": "MySoundMod",
"config": {
"Enemies:ZombieAttackSound": {
"description": "Enable Zombie attack sound? (Type1 / Type 2)",
"default": "Type1"
}
}
}
json5
{
"replacements": [
{
// This checks for when the Zombie enemy attacks the Player
"matches": "*:ZombieAttackPlayer",
"sounds": [
{
"sound": "Enemies/Zombie/MyAttackPlayerSoundType1.mp3",
"condition": {
"type": "config",
"config": "Enemies:ZombieAttackSound",
"value": "Type1"
},
"weight": 1
},
{
"sound": "Enemies/Zombie/MyAttackPlayerSoundType2.mp3",
"condition": {
"type": "config",
"config": "Enemies:ZombieAttackSound",
"value": "Type2"
},
"weight": 1
},
]
}
]
}
You can also use true
or false
here.
(Click for Example)
json5
{
"replacements": [
{
// This checks for when the Zombie enemy attacks the Player
"matches": "*:ZombieAttackPlayer",
"sounds": [
{
"sound": "Enemies/Zombie/MyAttackPlayerSoundType1.mp3",
"condition": {
"type": "config",
"config": "Enemies:ZombieAttackSound",
"value": true
},
"weight": 1
},
{
"sound": "Enemies/Zombie/MyAttackPlayerSoundType2.mp3",
"condition": {
"type": "config",
"config": "Enemies:ZombieAttackSound",
"value": false
},
"weight": 1
},
]
}
]
}