Jump to content

[Help request] Script - Prevent from using item

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 :)



Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.




Here's the custom component




 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)



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

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

  • Create New...