Jump to content

Reign of Giants Piano


Recommended Posts

Essentially in the new DLC, there is an item called a Tumbleweed that plays a small note when you pass it, similar to the sound Maxwell makes. According to SethR, this is based on a script(Which I will be checking out later today) that executes a random sound from a folder containing the sounds it can play. This thread essentially brought the idea up.

 

There are two basic ways I could do this 'piano'.

 

The first way is similar to the TumbleWeeds, where as you pass certain objects it makes a sound. And if you lined up the objects you could make a tune from it.

 

The second way it to make an actual game object that plays certain sounds from the game in a way similar to a piano in real life.

 

Essentially, I want to know; what you think of the idea, and if you have any suggestions before I begin coding. I'm assuming all the knowledge I need to delve into the DS files, and the how too's are all on this forum, or somewhere on google. (I do know how to code, but I won't know the differences between what languages I've learned and the DS files until I look.)

 

That's basically it. As soon as I return to my home/cave I'll begin researching and coding.

Link to comment
Share on other sites

Ok, I went looking at the files, and it seems more or less like any other object oriented language, so I decided to make a very small edit to test it.

 

Essentially I changed one line in Wilson's talking lua.

 

GENERIC = "For Science!",

 I did not edit anything outside the quotation marks, and the mod seems to be registering, however I'm pretty sure I'm misfiling it.

 

So let's say you have a .lua file, that is found in the 'scripts' folder. Do you just add the lua to a folder called 'scripts' in the 'mod' folder, or do you have to convert it to a different format? Is there something I'm missing?

 

My apologies if I'm asking a stupid question.

 

I'm using notepad++, nothing special. Should I use a different program?

Link to comment
Share on other sites

Whenever you're modifying how the game functions, overwriting game files (meaning copying an existing game script into your mod folder and editing it so that your mod's version gets loaded instead of the default game's version) should be used as an absolute last resort.

Instead, you always want to try to modify the bare minimum for whatever you want to do, leaving the default behavior intact so that your mod is more likely to be compatible with other mods.

For example, if you want to change one of Wilson's strings, you should only modify that specific table entry. Example code (this would be in your modmain.lua, which is automatically run whenever your mod is loaded):

-- grab the STRINGS table from the global environmentSTRINGS = GLOBAL.STRINGS-- modify the inspect string for seedsSTRINGS.CHARACTERS.WILSON.DESCRIBE.SEEDS = "Don't make me overwrite you."
I'd highly suggest downloading and checking out the API Examples mod to get familiar with the modding API. You will need to get comfortable with how things work in Don't Starve, and get very comfortable with digging around the game's scripts for variables/functions/etc because there's not a whole lot of documentation out there.

Also note that this only applies when you are modifying default game code. When you are adding brand new stuff, you don't really have to worry about this sort of thing (except for potential component name clashes and whatnot).

For your specific task, you'll want to add a new prefab (see the Sample Mods) and then check out how the tumbleweed (dont_starve/data/DLC0001/scripts/prefabs/tumbleweed.lua) uses the playerprox component (lines 258-260 and 52-57 are the relevant ones) to play a sound when a player comes near it. It's pretty simple.

Link to comment
Share on other sites

Ok, so I delved into the files to learn more about the tumbleweeds, and found where the sound files are stored according to the code.

 

local function onplayerprox(inst)
    if not inst.last_prox_sfx_time or (GetTime() - inst.last_prox_sfx_time > SFX_COOLDOWN) then
       inst.last_prox_sfx_time = GetTime()
       inst.SoundEmitter:PlaySound("dontstarve_DLC001/common/tumbleweed_choir")
    end
end

However, I can't find a common folder in my DS files, and searching tumbleweed_choir turns up no file. I searched the entire DS file, and made sure 'hidden' was checked so I could see hidden files, and still no 'common folder' despite finding the DLC001 folder.

 

My second question is if I actualy need to know where those files are or I just type in the item, like with the test file:

 

RemapSoundEvent("dontstarve/creatures/bat/flap", "soundexample/creatures/bat/pop")

 

And type something like:

 

RemapSoundEvent("don'tstarve/entities(Unsure if this is it, maybe it's 'anim'?)/tumbleweed/tumbleweed_choir","folder/folder/newsoundfile")

 

Please and thank you for the help ^_^'

 

Also please excuse my constant edits, I kept thinking of more information to add.

Link to comment
Share on other sites

Unfortunately, I know absolutely nothing about how sounds are handled in Don't Starve, but it seems like the tumbleweed_choir sound should be in one of the files in dont_starve/data/DLC0001/sound.

You should check out the Sound Mod Tutorial and %5BTutorial%5D Adding Custom Sound To Your Custom Character

Nope, I checked both the sound and DLC01 sound and there is no tumbleweed_choir. I might have to see if I can get a quick answer from SethR or someone else when they're not busy being awesome.

 

I saw those, but they both mention FMOD-Designer and I was hoping to not have to touch it if at all possible. I might have to though, still thanks for pointing them out.

Link to comment
Share on other sites

I saw those, but they both mention FMOD-Designer and I was hoping to not have to touch it if at all possible. I might have to though, still thanks for pointing them out.

I'm not sure there's a way around it. The sounds definitely don't seem to be stored in playable sound files, but rather they are compiled into sound libraries of sorts (.fsb files, it looks like).
Link to comment
Share on other sites

I'm not sure there's a way around it. The sounds definitely don't seem to be stored in playable sound files, but rather they are compiled into sound libraries of sorts (.fsb files, it looks like).

Yeah, seems like it.

Damn. Looks like I've got another program to learn tomorrow. <_< Oh well.

Once I've change the tumbleweed sounds(My first experiment in 'the living piano'), I'll probably start making a proper piano. I wanted to start smallish, but I have a feeling I've gone backwards XD oh well, It'll get done one way or the other.

Thanks again for the help.

Link to comment
Share on other sites

Yeah, seems like it.

Damn. Looks like I've got another program to learn tomorrow. <_< Oh well.

Once I've change the tumbleweed sounds(My first experiment in 'the living piano'), I'll probably start making a proper piano. I wanted to start smallish, but I have a feeling I've gone backwards XD oh well, It'll get done one way or the other.

Thanks again for the help.

I think that extracking sounds from existing fsb files are difficult and you need orginal .fdp file for this. I suggest you to create your own .fsb file with piano notes.

Link to comment
Share on other sites

I think that extracking sounds from existing fsb files are difficult and you need orginal .fdp file for this. I suggest you to create your own .fsb file with piano notes.

Alright. But how would I make it so insead of the tumbleweed_choir it played Piano-tune? Would I use something like:

 

RemapSoundEvent("don'tstarve/entities(Unsure if this is it, maybe it's 'anim'?)/tumbleweed/tumbleweed_choir","folder/folder/newsoundfile")

Link to comment
Share on other sites

Alright. But how would I make it so insead of the tumbleweed_choir it played Piano-tune? Would I use something like:

 

RemapSoundEvent("don'tstarve/entities(Unsure if this is it, maybe it's 'anim'?)/tumbleweed/tumbleweed_choir","folder/folder/newsoundfile")

Probably yes. But I wondering why you want use "RemapSoundEvent". For playing piano sounds normal SoundEmitter:PlaySound should be enough.

Link to comment
Share on other sites

Probably yes. But I wondering why you want use "RemapSoundEvent". For playing piano sounds normal SoundEmitter:PlaySound should be enough.

Oh! okay! I'm still learning all the components so I only know a few of them.

I'm not sure if that would work though, I'm trying to change a single event, when close to tumbleweeds, not simply play a sound.

It could, but it might be more lines of code. I'll see what I can do, thanks again.

Link to comment
Share on other sites

Oh! okay! I'm still learning all the components so I only know a few of them.

I'm not sure if that would work though, I'm trying to change a single event, when close to tumbleweeds, not simply play a sound.

It could, but it might be more lines of code. I'll see what I can do, thanks again.

It would be great if you post results here. Im very interested in new ways to play around with sound :)

Link to comment
Share on other sites

EUREKA! BY JOVE IT WORKS!

 

Changing one line has now made the tumbleweeds play a sound file.(I tried replace first, and got lucky with the source) I used the bat replacement pop sound example for testing purposes and...

 

 

Whenever I change the sound file it stops playing sound, but it is definitely going through. One step closer to being done!

 

(It's probably due to the recycling of the items for testing purposes. I'll try making it more from scratch, modifying names, and a few other things.)

 

Edit:

And thus, an error foils me again.

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...