CreatorKami Posted May 11, 2015 Share Posted May 11, 2015 Hi, I'm working on tweaking the Charlie mod to have a sanity perk when Maxwell, the playable character, is nearby. How exactly would I go about this? I'm very new to modding.. Charlie has a sanity drain of -1.25/min, and I would like to offset that with Maxwell nearby at +2.25/min for a net gain of +1. The radius should be small, like that of Glommer. Thank you so much in advance for the help. ;v; Link to comment https://forums.kleientertainment.com/forums/topic/53824-adding-a-sanity-perk-to-a-lua/ Share on other sites More sharing options...
DarkXero Posted May 11, 2015 Share Posted May 11, 2015 AddPrefabPostInit("waxwell", function(inst) inst:AddComponent("sanityaura") inst.components.sanityaura.aurafn = function(inst, observer) if observer and (observer.prefab == "Charlie") then return 0.05 end return 0 end end) Link to comment https://forums.kleientertainment.com/forums/topic/53824-adding-a-sanity-perk-to-a-lua/#findComment-636550 Share on other sites More sharing options...
CreatorKami Posted May 11, 2015 Author Share Posted May 11, 2015 AddPrefabPostInit("waxwell", function(inst) inst:AddComponent("sanityaura") inst.components.sanityaura.aurafn = function(inst, observer) if observer and (observer.prefab == "Charlie") then return 0.05 end return 0 endend)Unfortunately, this appears to result in a crash.. D: Link to comment https://forums.kleientertainment.com/forums/topic/53824-adding-a-sanity-perk-to-a-lua/#findComment-636566 Share on other sites More sharing options...
DarkXero Posted May 11, 2015 Share Posted May 11, 2015 (edited) You need to put that code in the modmain.lua of the Charlie character. Edited May 11, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/53824-adding-a-sanity-perk-to-a-lua/#findComment-636568 Share on other sites More sharing options...
CreatorKami Posted May 11, 2015 Author Share Posted May 11, 2015 You need to put that code in the modmain.lua of the Charlie character.Okay, I did this, and it doesn't seem to crash, but it also doesn't seem to work either. Link to comment https://forums.kleientertainment.com/forums/topic/53824-adding-a-sanity-perk-to-a-lua/#findComment-636590 Share on other sites More sharing options...
CreatorKami Posted May 11, 2015 Author Share Posted May 11, 2015 Okay, I did this, and it doesn't seem to crash, but it also doesn't seem to work either. Nevermind, I got it working!! Thanks so much for your help! Link to comment https://forums.kleientertainment.com/forums/topic/53824-adding-a-sanity-perk-to-a-lua/#findComment-636606 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