Life_For_Dead Posted August 17, 2020 Share Posted August 17, 2020 Hello, I build a prefab NightClub in coop & with a single party I try to set a music to the block speaker who everybody will be able to heard it... But in game nothing happen & I don't get any console error... So is it possilbe to do it without build a ressource Unity3D or I write a bad code, please?! blocks.xml <block name="Speaker Music Mix"> <property name="CreativeMode" value="Player"/> <property name="CustomIcon" value="speaker"/> <property name="CustomIconTint" value="ff00ff"/> <property name="Class" value="Speaker"/> <property name="PlaySound" value="Music Mix"/> <property name="Material" value="Mmetal_weak"/> <property name="Shape" value="ModelEntity"/> <property name="Model" value="Entities/Electrical/loudspeakerPrefab"/> <property name="HandleFace" value="South"/> <property name="ImposterDontBlock" value="true"/> <property name="Collide" value="movement,melee,bullet,arrow,rocket"/> <property name="LootList" value="7"/> <property name="RequiredPower" value="11"/> <property name="DisplayType" value="blockElectrical"/> <property name="Group" value="Science"/> <property class="RepairItems"> <property name="resourceForgedIron" value="3"/> <property name="resourceElectricParts" value="2"/> </property> <drop event="Harvest" name="terrStone" count="0" tool_category="Disassemble"/> <drop event="Harvest" name="resourceElectricParts" count="0,2" tag="salvageHarvest"/> <drop event="Harvest" name="resourceScrapIron" count="5,10" tag="allHarvest"/> <drop event="Destroy" count="0"/> <drop event="Fall" name="scrapMetalPile" count="1" prob="0.75" stick_chance="1"/> <property name="TakeDelay" value="1"/> <property name="EconomicValue" value="72"/> <property name="FilterTags" value="fdecor,felectrical"/> <property name="SortOrder1" value="70a0"/> </block> sounds.xml <SoundDataNode name="Music Mix"> <AudioSource name="Sounds/AudioSource_VO_Announce"/> <AudioClip ClipName="#@modfolder:Music/Music Mix.wav" Loop="true"/> <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="0"/> </SoundDataNode> Link to comment Share on other sites More sharing options...
Gouki Posted August 17, 2020 Share Posted August 17, 2020 5 hours ago, Life_For_Dead said: Hello, I build a prefab NightClub in coop & with a single party I try to set a music to the block speaker who everybody will be able to heard it... But in game nothing happen & I don't get any console error... So is it possilbe to do it without build a ressource Unity3D or I write a bad code, please?! blocks.xml <block name="Speaker Music Mix"> <property name="CreativeMode" value="Player"/> <property name="CustomIcon" value="speaker"/> <property name="CustomIconTint" value="ff00ff"/> <property name="Class" value="Speaker"/> <property name="PlaySound" value="Music Mix"/> <property name="Material" value="Mmetal_weak"/> <property name="Shape" value="ModelEntity"/> <property name="Model" value="Entities/Electrical/loudspeakerPrefab"/> <property name="HandleFace" value="South"/> <property name="ImposterDontBlock" value="true"/> <property name="Collide" value="movement,melee,bullet,arrow,rocket"/> <property name="LootList" value="7"/> <property name="RequiredPower" value="11"/> <property name="DisplayType" value="blockElectrical"/> <property name="Group" value="Science"/> <property class="RepairItems"> <property name="resourceForgedIron" value="3"/> <property name="resourceElectricParts" value="2"/> </property> <drop event="Harvest" name="terrStone" count="0" tool_category="Disassemble"/> <drop event="Harvest" name="resourceElectricParts" count="0,2" tag="salvageHarvest"/> <drop event="Harvest" name="resourceScrapIron" count="5,10" tag="allHarvest"/> <drop event="Destroy" count="0"/> <drop event="Fall" name="scrapMetalPile" count="1" prob="0.75" stick_chance="1"/> <property name="TakeDelay" value="1"/> <property name="EconomicValue" value="72"/> <property name="FilterTags" value="fdecor,felectrical"/> <property name="SortOrder1" value="70a0"/> </block> sounds.xml <SoundDataNode name="Music Mix"> <AudioSource name="Sounds/AudioSource_VO_Announce"/> <AudioClip ClipName="#@modfolder:Music/Music Mix.wav" Loop="true"/> <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="0"/> </SoundDataNode> The sound has to be in the unity.3d file and you have it in Wav and a bit needs to be added in the code : <AudioClip ClipName="#@modfolder:Music/Music Mix.wav" Loop="true"/> Example: <AudioClip ClipName="#@modfolder:Resources/backpack.unity3d?close_backpack-1"/> You can ask doughtphunghus or xyth, they know better. Link to comment Share on other sites More sharing options...
doughphunghus Posted August 18, 2020 Share Posted August 18, 2020 Just happened past and saw this Here's a post that might help using Unity to put sounds into unity.3d files: adding-a-new-sound-to-game I made a very lengthy post on page 2 that might cover a lot of pitfalls. I never use Unity (and I'm not on Windows) so I suffered greatly until I just got a windows system and installed everything on it, which was most of my issues. As Guppycur has said several times on the forums, adding sounds "is easy". It really is. once you get it to work 1 time you go "ahhhh". Also: I have a modlet that adds sounds in the unity.3d files to the game. Its the "Add more common sounds" modlet on my main modlet page Feel free to use all/any of it (or any of my stuff. Steal from me freely!) if you want to add your own sounds. Also: It appears you are trying to add sounds to a "block" in the game. I have not done that but it seems it should be do-able, especially with the speaker prefab it appears you're using. Good luck! Link to comment Share on other sites More sharing options...
Life_For_Dead Posted August 18, 2020 Author Share Posted August 18, 2020 Oky, it was as I thought, thanks both of you, I follow this tuto & seem like it's oky in game! But need first edit the music volume in externe before to insert it (ReplayGain 77), I saw many video on youtube how to do in Unity but seem like hard to do so I will only use the easy way... & in fact it's really weird, to add a music/song, must encode it into a unity "rar/zip"... Because my code was good but just the game or unity don't want to read a simple easy file .wav Link to comment Share on other sites More sharing options...
doughphunghus Posted August 18, 2020 Share Posted August 18, 2020 Hmmm. The game won’t normally load a .wav for a custom sound (everyone says the wav must be converted to the unity.3d format using Unity, I have not seen or heard another way around this) but I have not heard of Unity not allowing you to load in a .wav (as an “asset” I believe). All the videos (and my own experience) is you can just drag and drop the .wav file into Unity and it allows it without need to convert it to rar/zip. You do need to load a special script into Unity to allow Unity to export sounds into the unity.3d format (script is talked about in the post I wrote, and in the forums). also: I have no experience trying this, but I believe most sounds by default will just play 1 time and then stop and not “loop”. There are some sounds in the game that “loop” like the campfire sounds. I believe there might be some special xml tags/properties you will also need to add to get your music to loop and play continuously, which is what I believe you are trying to do. also: once again, I’m just guessing at this because I don’t know if it’s required, but if you use the speaker block to play your sounds, you’ll likely have to apply power to it in the game to get it to play. Link to comment Share on other sites More sharing options...
Life_For_Dead Posted August 19, 2020 Author Share Posted August 19, 2020 10 hours ago, doughphunghus said: Hmmm. The game won’t normally load a .wav for a custom sound (everyone says the wav must be converted to the unity.3d format using Unity, I have not seen or heard another way around this) but I have not heard of Unity not allowing you to load in a .wav (as an “asset” I believe). All the videos (and my own experience) is you can just drag and drop the .wav file into Unity and it allows it without need to convert it to rar/zip. You do need to load a special script into Unity to allow Unity to export sounds into the unity.3d format (script is talked about in the post I wrote, and in the forums). also: I have no experience trying this, but I believe most sounds by default will just play 1 time and then stop and not “loop”. There are some sounds in the game that “loop” like the campfire sounds. I believe there might be some special xml tags/properties you will also need to add to get your music to loop and play continuously, which is what I believe you are trying to do. also: once again, I’m just guessing at this because I don’t know if it’s required, but if you use the speaker block to play your sounds, you’ll likely have to apply power to it in the game to get it to play. I'm a noob so I said that because when I insert the music by the way of the tuto, Unity just can convert to vorbis or pcm so I deduced the game or Unity can read a .wav & yes, need to apply power who that's not a problem for me or just set <property name="RequiredPower" value="0"/> but need a switch because I don't build a speaker block directly to have on/off, maybe one day with more experience with Unity to build a DJ Station LOLLL By default of the original speaker block, the sound is plays in loop with the code Loop="true" but no problem if was set true/false by using a switch... Anyway, thanks again... Link to comment Share on other sites More sharing options...
Alexandrine Posted August 21, 2020 Share Posted August 21, 2020 Have you installed the music track on your phone. And is your music unique. Thanks You are interested in the themes of music and phone ringtones download phone ringtones at sonnerie telephone mp3 gratuite offers free phone ringtones. Link to comment Share on other sites More sharing options...
hegmannkris Posted October 12, 2020 Share Posted October 12, 2020 I see your code has no problem. Why isn't it working? Link to comment Share on other sites More sharing options...
hegmannkris Posted October 14, 2020 Share Posted October 14, 2020 Maybe you should play around with a few different audio formats. Here is a sound source that you can refer to: https://sonnerieportable.com/ Link to comment Share on other sites More sharing options...
IrishManJMo Posted December 6, 2020 Share Posted December 6, 2020 I also tried to do something similar to this in the ways of cloning the Trader POI speaker hoping to get it to make an alarm sound at 21:50 aka Trader closed announcement but I couldn't figure out what powers these and makes them function as intended to achieve what I had hoped Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.