What's wrong with my attempt to overwrite the attack sound?

Place to get help with not working mods / modding interface.
Post Reply
Begovere
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Mar 01, 2019 12:17 pm
Contact:

What's wrong with my attempt to overwrite the attack sound?

Post by Begovere »

I'm currently trying to create a mod that allows the user to overwrite the sound that's played when friendly structures are attacked by biters. My mod folder currently contains a folder named "sound" with the new soundfile named "alert-destroyed.ogg" and my data-updates.lua currently looks like this:

Code: Select all

data:extend(
{
  ["utility-sounds"] = {
    default = {
      alert_destroyed = {
        {
          filename = "__CustomAttackSound__/sound/alert-destroyed.ogg"
        }
      }
    }
  }
})
When starting the game, I get this error message: Image

Can you please help me and tell me what I'm doing wrong and what I need to fix?

asdff45
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sun Aug 07, 2016 1:23 pm
Contact:

Re: What's wrong with my attempt to overwrite the attack sound?

Post by asdff45 »

You are trying to create a new prototype with data:extend.
What you want to do, is override it. That is possible, by editing the data.raw table. https://wiki.factorio.com/Data.raw

So, in your case:

Code: Select all

data.raw["utility-sounds"].default.alert_destroyed = {
    filename = "__CustomAttackSound__/sound/alert-destroyed.ogg"
}

Begovere
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Mar 01, 2019 12:17 pm
Contact:

Re: What's wrong with my attempt to overwrite the attack sound?

Post by Begovere »

Thank you for the helpful advice, it fixed my problem and it works now. :D

Post Reply

Return to “Modding help”