rosalovesyou Posted June 9, 2019 Share Posted June 9, 2019 hello~! i'm in the process of making my very first character mod. i've already completed a lot of perks i'd like to add, and i found a very great source that's been helping me immensely along the way! not only have i been using the linked post, but i've also been googling specific things if there's something more hidden i want - that's how i found out how to multiply cooking speed! however, i'm having a lot of trouble with one thing in specific. i was going to skip it for last, but i think it may be best to make a post about it, so it's out there and about to hopefully gather a solution by the time this becomes my last perk to add. i want to remove the damage done by roses, completely. it doesn't have to apply to the "thorns" tag - in fact, i want the damage there for things such as cacti. hopefully this is possible!! this was THE very first thing i've tried to accomplish completely on my own - being a beginner to LUA - and failed. even with the experience i have now from digging into the game's scripts and sources online, i couldn't achieve anything that worked (searched in tuning.lua and flower.lua). i've looked around a lot online for a lead but to no avail - i found one single source, but shared in a way i don't know how to build from scratch. is there anyone out there who has any idea how to achieve this? i'll love you so very much! i hope it's not something dumb i've been overlooking lol. if anyone knows what to do, PLEASE let me know if it needs placed in modmain or the prefab file; i ask of this because i've seen confusion on where something like this would go in the failed leads i had. Link to comment Share on other sites More sharing options...
CarlZalph Posted June 9, 2019 Share Posted June 9, 2019 The easiest route I'm seeing is to add a prefab post init to the flower prefab, and in its callback do a prehook to the inst.components.pickable.onpickedfn. In the prehook function change inst.animname to something else like "f1" only if the picker.prefab is your character's prefab name, then call the original function. Link to comment Share on other sites More sharing options...
rosalovesyou Posted June 10, 2019 Author Share Posted June 10, 2019 31 minutes ago, CarlZalph said: The easiest route I'm seeing is to add a prefab post init to the flower prefab, and in its callback do a prehook to the inst.components.pickable.onpickedfn. In the prehook function change inst.animname to something else like "f1" only if the picker.prefab is your character's prefab name, then call the original function. thank you VERY much for your response!! <3 unfortunately, i'm not exactly sure how to go about even starting to build this code tbh ^^;; i recognize the labels and terms you're using, but idk how to put it all together. could you explain that part to me a bit, if it isn't a burden? Link to comment Share on other sites More sharing options...
CarlZalph Posted June 10, 2019 Share Posted June 10, 2019 10 hours ago, rosalovesyou said: thank you VERY much for your response!! <3 unfortunately, i'm not exactly sure how to go about even starting to build this code tbh ^^;; i recognize the labels and terms you're using, but idk how to put it all together. could you explain that part to me a bit, if it isn't a burden? -- Given: data = {} data.a = 2 function hookthisfunction(data, other, arguments, here) if data.a == 2 then return "Danger zone!" end return "Safe zone." end -- Do: local hookthisfunction_old = hookthisfunction hookthisfunction = function(data, ...) --[[ prehook here Can modify function arguments before calling the original function. Or just not call the original function at all! ]]-- local retval = hookthisfunction_old(data, ...) --[[ posthook here Can modify the return value. Or just force a static return value and forgo calling the original function at all! ]]-- return retval end -- Debug: print(hookthisfunction(data)) Link to comment Share on other sites More sharing options...
rosalovesyou Posted June 10, 2019 Author Share Posted June 10, 2019 (edited) @CarlZalph oh thank SO very much for this!! i'll definitely be working with it right away, you're a life saver! so which file would i add this to with the modifications, exactly? my character's modmain or prefab? Edited June 10, 2019 by rosalovesyou Link to comment Share on other sites More sharing options...
CarlZalph Posted June 10, 2019 Share Posted June 10, 2019 @rosalovesyou Modmain, since it'll hook into every pickable component initialized. Link to comment Share on other sites More sharing options...
rosalovesyou Posted June 10, 2019 Author Share Posted June 10, 2019 (edited) 37 minutes ago, CarlZalph said: Modmain, since it'll hook into every pickable component initialized. got it! thanks a bunch for your feedback on this, i highly appreciate it! <3 if i need any help on this going forward, i'll be sure to post here again! Edited June 10, 2019 by rosalovesyou Link to comment Share on other sites More sharing options...
rosalovesyou Posted July 8, 2019 Author Share Posted July 8, 2019 posting a followup here for anyone who's looking on how to do this!! i had another thread with flower related questions and asked it there!! working code provided!!https://forums.kleientertainment.com/forums/topic/108454-how-to-increase-the-sanity-upon-picking-flowers/?do=findComment&comment=1221504 Link to comment 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