Jump to content

[Tutorial] Creating a "handslot-equippable-item" from scratch


Malacath
 Share

Recommended Posts

No, Wendy is voiced by an alto flute. Woodie is voiced by a cello, which is sorta close to a violin but not really. The unimplemented character wallace would use a violin, but he isn't actually implemented.

About wallace, I found a .fsb file in the games files called 'wallace'. how could i use this in my mod? (it was in dont starve> data> sound)

EDIT: So do you know how to rid of the panflute animation at the start? could i make my own custom one for moving the violin on his shoulder or not?

EDIT2: Well ive got the sound working its just that it plays the panflute sound aswell. (I used wallace's voice for the sound) And the wallace sound never stops, even though the kill all sounds thing is there. (the panflute sound still stops)

(sorry, been away for a while)

 

Hm, I've never had any of my sounds loop before. Can you show me how you're calling the sounds? Can you paste the code of the function that activates when you play the violin?

 

also, I have not touched anything DST before, so I wouldn't know.

Link to comment
Share on other sites

(sorry, been away for a while)

 

Hm, I've never had any of my sounds loop before. Can you show me how you're calling the sounds? Can you paste the code of the function that activates when you play the violin?

 

also, I have not touched anything DST before, so I wouldn't know.

Here is the function:

local function HearViolin(inst, musician, instrument)    if inst.components.sleeper then        inst.components.sleeper:AddSleepiness(5, 20)    end    musician.AnimState:SetBank("violin_anim")    musician.AnimState:SetBuild("violin_anim")    musician:SetStateGraph("SGviolin_anim")	musician.SoundEmitter:PlaySound("dontstarve/characters/wallace/talk_LP")	--now for some time things	musician:DoTaskInTime(2, function(musician) musician.SoundEmitter:KillAllSounds() end)    musician:DoTaskInTime(2, function(musician) musician.AnimState:SetBank("wilson") end)      musician:DoTaskInTime(2, function(musician) musician.AnimState:SetBuild("wilfred") end)    musician:DoTaskInTime(2, function(musician) musician:SetStateGraph("SGwilson") end) end

And the mod is not for DST, just DS. (my question about the not putting players to sleep has been answered)

EDIT Also, didn't you want to know where the list of all the sounds is? It's located in:

steamapps> common> dontstarve> data> sounds

In the sounds folder there is a text file called dontstarve which is a list of all the sounds.

Edited by NeddoFreddo
  • Like 1
Link to comment
Share on other sites

Here is the function:

local function HearViolin(inst, musician, instrument)    if inst.components.sleeper then        inst.components.sleeper:AddSleepiness(5, 20)    end    musician.AnimState:SetBank("violin_anim")    musician.AnimState:SetBuild("violin_anim")    musician:SetStateGraph("SGviolin_anim")	musician.SoundEmitter:PlaySound("dontstarve/characters/wallace/talk_LP")	--now for some time things	musician:DoTaskInTime(2, function(musician) musician.SoundEmitter:KillAllSounds() end)    musician:DoTaskInTime(2, function(musician) musician.AnimState:SetBank("wilson") end)      musician:DoTaskInTime(2, function(musician) musician.AnimState:SetBuild("wilfred") end)    musician:DoTaskInTime(2, function(musician) musician:SetStateGraph("SGwilson") end) end

And the mod is not for DST, just DS.

 

hmmm, I feel like that should work... That's like how mine was set up, but mine works fine.

uh...Maybe try replacing the "musician"s with "inst" for the sound?... (leave the animation code as it is though)

 

maybe inst.SoundEmitter:KillAllSound will stop the panflute noise.

 

Also, maybe the sound you're using is a looping sound? idk. at some point, try replacing his voice sound with this "dontstarve/creatures/deerclops/taunt_howl" which i know for sure doesn't loop (its a bit quiet though) and tell me if that sound loops or not.

 

 

anyone else got an input on this?

Link to comment
Share on other sites

hmmm, I feel like that should work... That's like how mine was set up, but mine works fine.

uh...Maybe try replacing the "musician"s with "inst" for the sound?... (leave the animation code as it is though)

 

maybe inst.SoundEmitter:KillAllSound will stop the panflute noise.

 

Also, maybe the sound you're using is a looping sound? idk. at some point, try replacing his voice sound with this "dontstarve/creatures/deerclops/taunt_howl" which i know for sure doesn't loop (its a bit quiet though) and tell me if that sound loops or not.

 

 

anyone else got an input on this?

Hm.. replacing musician with inst just crashes the game when the violin stops playing, even when you replace the musician on the line that plays the sound. I tried uing the deerclops toaunt howl sound and yeah, that worked. (i think it worked because it is not a looping sound, all the characters voices are loopped right?)

 

---------------

 

Also, does your item/character show the start of the panflute animation when you play it/him/her/? When the violin is played, it plays the first second or so of the panflute animation. Then when the pan flute touhes the characters lips, the violin animation starts. Does this happen with you? Just wondering.

Link to comment
Share on other sites

Hm.. replacing musician with inst just crashes the game when the violin stops playing, even when you replace the musician on the line that plays the sound. I tried uing the deerclops toaunt howl sound and yeah, that worked. (i think it worked because it is not a looping sound, all the characters voices are loopped right?)

---------------

Also, does your item/character show the start of the panflute animation when you play it/him/her/? When the violin is played, it plays the first second or so of the panflute animation. Then when the pan flute touhes the characters lips, the violin animation starts. Does this happen with you? Just wondering.

Hm, it shouldn't crash. You might not have replaced them all correctly?

There is probably a way to stop the sound. Take a look in the game's stategraph files and look for SGwilson.lua and look for the state where he starts talking, there has to be something in there that tells it to stop playing that you can apply to your code.

Well mine is no longer an instrument, but yes, it still plays an animation beforehand and I have not been able to get rid of it.

Perhaps you could at least change the animation to a different instruments by changing the "flute" tag to something else? I don't know what other instruments there are though

Link to comment
Share on other sites

Hm, it shouldn't crash. You might not have replaced them all correctly?

There is probably a way to stop the sound. Take a look in the game's stategraph files and look for SGwilson.lua and look for the state where he starts talking, there has to be something in there that tells it to stop playing that you can apply to your code.

Well mine is no longer an instrument, but yes, it still plays an animation beforehand and I have not been able to get rid of it.

Perhaps you could at least change the animation to a different instruments by changing the "flute" tag to something else? I don't know what other instruments there are though

As far as i know, there are only 2 intruments in DS, the panflute and the one man band. When I gave the violin the onemanband tag, it just crashed. When I have it both the panflute tag ("flute") and the onemanband tag ("band") it does nothing to the animation.

Haven't looked at SQWilson yet will do so soon.

EDIT: looked at SGwilson (what a great acievement) and couldn't make that much sense of it (im not That great @ coding ;p). The onlty thing i could find about speech was: 

local function DoTalkSound(inst)    if inst.talksoundoverride ~= nil then        inst.SoundEmitter:PlaySound(inst.talksoundoverride, "talk")        return true    elseif not inst:HasTag("mime") then        inst.SoundEmitter:PlaySound((inst.talker_path_override or "dontstarve/characters/")..(inst.soundsname or inst.prefab).."/talk_LP", "talk")        return true    endend

So yeah, hope you can make some sense of that. (not to be discouraging or anything :razz:)

EDIT: discovered that the beefalo horn is an instrument as well. That does work with the violin however!

Edited by NeddoFreddo
Link to comment
Share on other sites

As far as i know, there are only 2 intruments in DS, the panflute and the one man band. When I gave the violin the onemanband tag, it just crashed. When I have it both the panflute tag ("flute") and the onemanband tag ("band") it does nothing to the animation.

Haven't looked at SQWilson yet will do so soon.

EDIT: looked at SGwilson (what a great acievement) and couldn't make that much sense of it (im not That great @ coding ;p). The onlty thing i could find about speech was: 

local function DoTalkSound(inst)    if inst.talksoundoverride ~= nil then        inst.SoundEmitter:PlaySound(inst.talksoundoverride, "talk")        return true    elseif not inst:HasTag("mime") then        inst.SoundEmitter:PlaySound((inst.talker_path_override or "dontstarve/characters/")..(inst.soundsname or inst.prefab).."/talk_LP", "talk")        return true    endend

So yeah, hope you can make some sense of that. (not to be discouraging or anything :razz:)

EDIT: discovered that the beefalo horn is an instrument as well. That does work with the violin however!

 

Hm, I really have no idea. Maybe take a look at the talker component? did you try googling it?

Does anyone else have any ideas? 

Link to comment
Share on other sites

@yildirim, From the folder you uploaded, it looks as though your missing a few files and your folder structure is messed up a bit. First off, your folder doesn't seem to have a main.lua or a modinfo.lua (maybe you just didn't upload it in the folder?). Secondly, in your swap_cutehat folder you should have another folder with the same name in which you put your .png but the .scml should stay where it is.

 

So your folder structure should look like this:

 

mymod
        exported
        |->     myitem
                |->     ground_myitem
                        |->        ground_myitem.png
                                    ground_myitem.scml
 
                        swap_myitem
                        |->     swap_myitem
                                |->        swap_myitem.png
                                swap_myitem.scml
        images
        |->     inventoryimages
                |->        myitem.png
        scripts
        |->     prefabs
                |->        myitem.lua
        modmain.lua
        modinfo.lua
 
You also forgot to put your prefab file in the proper folder structure as well. In addition to all that, in your swap_myitem.scml file you MUST name your animation as "BUILD" or it will not be recognized. You put "idle" but that should only be for the ground .scml file.

 

EDIT: I was also just looking through your prefab file and I am pretty sure in the onequip() function, where you override the symbol, you should have:

owner.AnimState:OverrideSymbol("swap_object", "swap_cutehat", "swap_cutehat")

instead of

owner.AnimState:OverrideSymbol("swap_object", "swap_cutehat", "cutehat")
Edited by BaconAndRibs
  • Like 1
Link to comment
Share on other sites

Yes, you're right. I didn't upload all the files. And yeah, my folder structure seems wrong.

 

I thought the reason why my item doesn't appear is anim.bin which is inside cutehat.zip. I don't how to create or edit it, so just copy pasted from the Dana's mod which I used as base.

 

Anyway, I will try to fix the points that you made. Thanks!

Link to comment
Share on other sites

You can create the anim.bin file by putting your mod in the mods folder under the game system files. When you run the game, it should automatically compile your exported folder and create an anim folder (but only if you have the don't starve mod tools installed). The anim folder will contain your ground_myitem and swap_myitem zipped folders which have all the anim.bin files and what not.

Edited by BaconAndRibs
Link to comment
Share on other sites

Ok so i followed your tutorial and i must say i didn't understand very much, maybe because i am a total beginner. Everytime when i try to enable the mod, my game just crashes, and i don't understant what is the problem, some help would be great.

Link to comment
Share on other sites

Hello I have a problem with my mod

I can't see my weapon in my hand when I grab it but i can see this item in invtentory and when it's lying on the ground.

https://www.dropbox.com/s/5vzhel72b1142q9/HELP.rar?dl=0

Please help me

(Sorry for my english)

 

P.S It's for DST

I just tried to make my first weapon mod myself for DST and I have the exact same problem.

 

I've properly aligned the pivot and set it to overwrite the default pivot, tried different sizes of the same image, everything, and the item is still invisible when my character is holding it, but visible when not in use.

 

Does anyone know the possible cause behind this problem, by any chance? 

Link to comment
Share on other sites

I just tried to make my first weapon mod myself for DST and I have the exact same problem.

I've properly aligned the pivot and set it to overwrite the default pivot, tried different sizes of the same image, everything, and the item is still invisible when my character is holding it, but visible when not in use.

Does anyone know the possible cause behind this problem, by any chance?

Ah, never mind, I looked back a couple of pages and pinpointed my problem out. Thanks, anyways.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...