Adzm Posted May 30, 2016 Share Posted May 30, 2016 Hi, I've created a custom character using a tutorial which has worked perfectly, however I need help with creating a custom item for him. I've uploaded the modmain.lua and the script.lua, I can upload more if needed. Basically, I'm attempting to create an inventory item that cannot be equipped, which can be used an unlimited amount of times though the inventory or a recipe to turn logs into sticks. As far as I'm aware, no other items currently do this, although I could be wrong. Currently, I have managed to get the item to appear in the crafting menu (although the description doesn't appear, the name and picture do) and when attempting to craft the penknife, it gives an error message. I'm aware theres likely to be alot wrong with my files, so any help to learn more about it would be great, thanks! modmain.lua penknife.lua Link to comment https://forums.kleientertainment.com/forums/topic/67772-help-with-custom-item-penknife/ Share on other sites More sharing options...
rezecib Posted May 30, 2016 Share Posted May 30, 2016 @Adzm The immediate cause of your crash is that you provided "penknife_placer" to the recipe. That should be nil instead, because it's not something you place like a structure. As for making it do what it's supposed to, I think the easiest method is probably to give the penkife the "activatable" component, and then have that trigger a function that looks for logs and converts them to twigs. But it would make a bit more intuitive sense to me as an item that you pick up on the cursor, and then right-click logs to slice them. This would require making your own action and componentaction. I did an example of something a lot like this in the Maxwell imbuing mod. Link to comment https://forums.kleientertainment.com/forums/topic/67772-help-with-custom-item-penknife/#findComment-778274 Share on other sites More sharing options...
Battal Posted May 30, 2016 Share Posted May 30, 2016 (edited) I'm far from being a modder, but doesn't the machete do something similar with coconuts? Edited May 30, 2016 by Battal Link to comment https://forums.kleientertainment.com/forums/topic/67772-help-with-custom-item-penknife/#findComment-778277 Share on other sites More sharing options...
rezecib Posted May 30, 2016 Share Posted May 30, 2016 3 minutes ago, Battal said: doesn't the machete do something similar with coconuts? It does, and it uses the same action system that I used for imbuing. But the action code is a little different in DST. Link to comment https://forums.kleientertainment.com/forums/topic/67772-help-with-custom-item-penknife/#findComment-778280 Share on other sites More sharing options...
Adzm Posted May 31, 2016 Author Share Posted May 31, 2016 @rezecib That fixed the issue of it crafting and crashing, thank you. However it doesn't appear to use the images I've created, so I'll try and figure out how to fix that next. Your imbuing files look interesting, hopefully I'll be able to make it work for the penknife. I don't have the Shipwrecked DLC so I haven't heard of the machete, but I'll take a look at that as well for some ideas. Link to comment https://forums.kleientertainment.com/forums/topic/67772-help-with-custom-item-penknife/#findComment-778329 Share on other sites More sharing options...
Adzm Posted June 1, 2016 Author Share Posted June 1, 2016 My mistake was attempting to create this with a prefab structure template rather than an item such as rope, which has now caused it to no longer work. I'll have to start again to ensure I don't use a wrong template this time, but could someone point me in the direction to create a non-equip-able item? Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/67772-help-with-custom-item-penknife/#findComment-778731 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