FreakyGiraffe Posted February 19, 2015 Share Posted February 19, 2015 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 https://forums.kleientertainment.com/forums/topic/51156-help-request-script-prevent-from-using-item/ Share on other sites More sharing options...
_Q_ Posted February 19, 2015 Share Posted February 19, 2015 You could add new action, or edit exising one, for playing the flute and include equip check in it. Link to comment https://forums.kleientertainment.com/forums/topic/51156-help-request-script-prevent-from-using-item/#findComment-614468 Share on other sites More sharing options...
FreakyGiraffe Posted February 19, 2015 Author Share Posted February 19, 2015 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 Link to comment https://forums.kleientertainment.com/forums/topic/51156-help-request-script-prevent-from-using-item/#findComment-614471 Share on other sites More sharing options...
rezecib Posted February 19, 2015 Share Posted February 19, 2015 @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. Link to comment https://forums.kleientertainment.com/forums/topic/51156-help-request-script-prevent-from-using-item/#findComment-614563 Share on other sites More sharing options...
FreakyGiraffe Posted February 19, 2015 Author Share Posted February 19, 2015 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 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. Link to comment https://forums.kleientertainment.com/forums/topic/51156-help-request-script-prevent-from-using-item/#findComment-614595 Share on other sites More sharing options...
rezecib Posted February 20, 2015 Share Posted February 20, 2015 @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. Link to comment https://forums.kleientertainment.com/forums/topic/51156-help-request-script-prevent-from-using-item/#findComment-614793 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now