JenjenParibou Posted May 11, 2022 Share Posted May 11, 2022 Hello, I've ran into a roadblock and I can't really find any solutions. Basically, I'm making an item for a custom character that, if used on a tool (Like an axe) will increase it's maximum number of uses, so it'll take longer for the axe to break, but it won't necessarily "fix" the axe. It's kinda like how Wes' tools take longer to break when he uses them, without his drawback of making the tool less effective. How would one go about making a custom item that does that? Any help would be appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/140169-increasing-a-tools-number-of-uses-with-a-custom-item/ Share on other sites More sharing options...
HarryPPP Posted May 12, 2022 Share Posted May 12, 2022 As you didn't really specify how to restore the durability, I wrote down 3 ways of doing it. -- Method 1: "Add a Flat Value" inst.components.finiteuses.current = math.min(inst.components.finiteuses.current + 5, inst.components.finiteuses.total) -- Restores 5 uses. -- This is a work-around to make a stat delta. -- Method 2: "Set to Total" inst.components.finiteuses.current = inst.components.finiteuses.total -- Fix tool completely. -- Method 3: "Keep Percentage" local percent = inst.components.finiteuses.current / inst.components.finiteuses.total -- Put this before max uses are increased. inst.components.finiteuses.current = inst.components.finiteuses.total*percent -- Put this after the increase. I hope this helps. Link to comment https://forums.kleientertainment.com/forums/topic/140169-increasing-a-tools-number-of-uses-with-a-custom-item/#findComment-1569816 Share on other sites More sharing options...
JenjenParibou Posted May 12, 2022 Author Share Posted May 12, 2022 (edited) Thank you for your time. The first and second one aren't really what I'm looking for, but the third one might work. I'll be sure to try it out and let you know. As for specifying "How to restore the durability." I'm afraid I didn't understand what you meant. Could you clarify? Thanks a lot. EDIT: I finally got what you meant, Id want the item to be used like you'd use a sewing it, by that I mean selecting it, then right-clicking on a tool to fix it properly. Edited May 16, 2022 by JenjenParibou Link to comment https://forums.kleientertainment.com/forums/topic/140169-increasing-a-tools-number-of-uses-with-a-custom-item/#findComment-1569846 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