Jump to content

Recommended Posts

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

ErrorDSC.png

@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.

@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.

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!

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...