Jump to content

Recommended Posts

Hello everyone,

 

I've recently finished my first Don't Starve mod ever. After a long and painfull proces I've figured everything out step by step and managed to make everything work as I wanted. Everything except one thing.

 

I want to make it impossible for my character Alice, to play her flute when she has her inhalation mask on. Both of these are custom items, but her unique flute is not so unique, it's mosly based on the vanilla panflute, and the mask is a hat type. 

 

I've searched the forums and couldn't find anything like it, so if anyone could be of help, I would really appreciate :)

 

 

And how do i do that exactly? I mean, I've just started learning about modding DST and have really little idea about lua scripts, so far i've been just searching for what i want in vanilla files and copied the scripts changing only essentials, so sorry if that's a stupid question :p

@FreakyGiraffe, scripts/actions.lua and scripts/componentactions.lua will have the info on how the "play" (for an instrument) action is implemented, and you can look at my guide for how to add your own action and componentaction.

Ok, so I've managed to make my own component lua and changed the custom flute prefab accordingly but now i get this error and have no idea what to do next.

 

2hwitdi.png

 

Here's the custom component

 

 

local COMPONENT_ACTIONS =

{
 INVENTORY = --args: inst, doer, actions, right
    {
        maksplay = function(inst, doer, actions)
            if doer:HasTag("player") and 
not doer:HasTag("mask") then
                table.insert(actions, ACTIONS.PLAY)
            end
        end
},
 
}

 

 

I've also added onequip addtag function to the mask of course.

@FreakyGiraffe, That's not what you should have in your component, and that's not how you add a componentaction. Look at the guide I linked... I walk through adding a component action there.

 

For your component itself, you should start by copying and renaming components/instrument.lua.

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
×
  • Create New...