Jump to content

[Question] How to get/change sound effects for mod


Recommended Posts

Hello.

I made mod and changed animation ("modfridge_kanim" in code). I used tools described  here.

But buildings are silenced now.

I left sound from old animation ("fridge_kanim" in code) and it's not worked.

Spoiler

 


        public override BuildingDef CreateBuildingDef()
        {
            string id = "ModifiedRefrigerator";
            int width = 1;
            int height = 2;
            string anim = "modfridge_kanim";
            int hitpoints = 30;
            float construction_time = 10f;
            float[] tier = BUILDINGS.CONSTRUCTION_MASS_KG.TIER4;
            string[] raw_MINERALS = MATERIALS.RAW_MINERALS;
            float melting_point = 800f;
            BuildLocationRule build_location_rule = BuildLocationRule.OnFloor;
            EffectorValues tier2 = NOISE_POLLUTION.NOISY.TIER0;
            BuildingDef buildingDef = BuildingTemplates.CreateBuildingDef(id, width, height, anim, hitpoints, construction_time, tier, raw_MINERALS, melting_point, build_location_rule, TUNING.BUILDINGS.DECOR.BONUS.TIER1, tier2, 0.2f);
            buildingDef.RequiresPowerInput = true;
            buildingDef.EnergyConsumptionWhenActive = 60f;
            buildingDef.ExhaustKilowattsWhenActive = 0.5f;
            buildingDef.Floodable = false;
            buildingDef.ViewMode = OverlayModes.Power.ID;
            buildingDef.AudioCategory = "Metal";
            SoundEventVolumeCache.instance.AddVolume("fridge_kanim", "Refrigerator_open", NOISE_POLLUTION.NOISY.TIER1);
            SoundEventVolumeCache.instance.AddVolume("fridge_kanim", "Refrigerator_close", NOISE_POLLUTION.NOISY.TIER1);
            return buildingDef;
        }

What I'm doing wrong? How to get sound effects?

 

Link to comment
Share on other sites

Hello in the game currently sounds are tied to the animation so when you use your new animation it will lose any sounds. If you want to add sounds to a custom animation you will need to create a custom state machine that forces the playing of some sounds that exist in the game. For example at this link https://github.com/daviscook477/ONI-Mods/blob/master/src/CrystalBiome/src/Buildings/Mineralizer.cs a building uses the sounds of the aquatuner to give it sound when it is running.

It's unfortunately not a terribly straightforward process and it is currently impossible to add any new sounds to the game. Only reusing existing sounds is possible.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...