SecondQuill Posted February 24, 2020 Share Posted February 24, 2020 (edited) Hi I'm new to modding and I've tried a few tutorials but it always gives an error message. I'm trying to give my character a sanity boost when he holds the pan flute. I can't seem to figure out what code to use or exactly where. I've tried a few options but can't figure it out. Here is the code I've been trying to use. AddPrefabPostInit(“panflute”, function(inst) if GetPlayer().prefab == “character” then inst:AddComponent("sanityaura") inst.components.sanityaura.aura = TUNING.SANITYAURA_LARGE end end) Edited February 24, 2020 by SecondQuill Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/ Share on other sites More sharing options...
CarlZalph Posted February 25, 2020 Share Posted February 25, 2020 Is this for DS singleplayer or DST? 'Cause GetPlayer() function is for DS, and with DST the code will look all sorts different comparably. Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1310702 Share on other sites More sharing options...
SecondQuill Posted February 25, 2020 Author Share Posted February 25, 2020 It's for DST multiplayer. Using the DS code is probably one of my problems then hah. Any suggestions on how to set up for DST instead? I haven't been able to find any specific tutorials Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1310724 Share on other sites More sharing options...
CarlZalph Posted February 25, 2020 Share Posted February 25, 2020 Well with DST it's a lot simpler, since Klei did a similar thing with Wurt and carrying a fish in the inventory: inst:AddComponent("itemaffinity") inst.components.itemaffinity:AddAffinity("hutch_fishbowl", nil, TUNING.DAPPERNESS_MED, 1) inst.components.itemaffinity:AddAffinity(nil, "fish", TUNING.DAPPERNESS_MED, 1) inst.components.itemaffinity:AddAffinity(nil, "fishmeat", -TUNING.DAPPERNESS_MED_LARGE, 2) inst.components.itemaffinity:AddAffinity(nil, "spoiled_fish", -TUNING.DAPPERNESS_MED_LARGE, 2) So tune as desired and repurpose for the flute prefab name. Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1310729 Share on other sites More sharing options...
SecondQuill Posted February 26, 2020 Author Share Posted February 26, 2020 (edited) Tried adding to the code. It keeps crashing. Tried in the character file and modmain.lua and haven't had any luck. I'm a super noob. Sorry xP This is the code I used. inst:AddComponent("itemaffinity") inst.components.itemaffinity:AddAffinity(“panflute”, nil, TUNING.DAPPERNESS_MED, 1) UPDATE: I got it to not crash but the effect doesn't work. Fiddled around and got it to do the opposite of what I wanted but reversing it doesn't make a positive reaction. Edited February 27, 2020 by SecondQuill Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1310764 Share on other sites More sharing options...
FurryEskimo Posted September 2, 2020 Share Posted September 2, 2020 This code is used to tune dapperness, yes? I tried looking up that stat, but found nothing. What does dapperness do, and how does this code affect it? inst.components.itemaffinity:AddAffinity(“panflute”, nil, TUNING.DAPPERNESS_MED, 1) Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1368577 Share on other sites More sharing options...
DecDuck Posted September 2, 2020 Share Posted September 2, 2020 Dapperness is like a personal sanity aura, just for yourself. Maxwell is very "dapper", so he has a very large, passive, sanity gain. Dapperness (I think) is defined in player_common.lua, and look at Maxwell's character file and you can see that Klei set this dapperness very high. Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1368635 Share on other sites More sharing options...
FurryEskimo Posted September 3, 2020 Share Posted September 3, 2020 OHHHHHHHH!!!!! So that's what dapperness is! I tried googling it, and I read the code, but I couldn't make heads or tails of it. I think I saw it factoring into the heat code, and that's when I just gave up trying to understand it at all. Ok, so it's your personal sanity aura, ok. My guess is that dapperness tuning is like favorite food tuning, where it multiples an existing value. I'll try using similar code to affect my player's favorite item stat. This is Maxwell's dapperness code: inst.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1368750 Share on other sites More sharing options...
DecDuck Posted September 4, 2020 Share Posted September 4, 2020 On 2/26/2020 at 1:58 PM, SecondQuill said: I got it to not crash but the effect doesn't work. Fiddled around and got it to do the opposite of what I wanted but reversing it doesn't make a positive reaction. How did you get the opposite reaction? Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1369069 Share on other sites More sharing options...
DecDuck Posted September 8, 2020 Share Posted September 8, 2020 @SecondQuill have you fixed the problem? Link to comment https://forums.kleientertainment.com/forums/topic/115994-need-help-item-grants-sanity-when-heldusedin-inventory/#findComment-1370029 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