durant313 Posted September 20, 2016 Share Posted September 20, 2016 (edited) Hello I want the code for gaining sanity at night . With 1 sanity per minut. I want it to not gain or drop sanity at day or dawn. Thanks Edited September 20, 2016 by durant313 Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/ Share on other sites More sharing options...
durant313 Posted September 20, 2016 Author Share Posted September 20, 2016 (edited) I have also tried this but it seems not to work. local function sanityfn(inst, phase) if phase == "day" then inst.components.sanity.day.dapperness = (tunning.DAPPERNESS_LARGE + 0) elseif phase == "night" then inst.components.sanity.night.dapperness = (tunning.DAPPERNESS_LARGE + 3) elseif phase == "dusk" then inst.components.sanity.dusk.dapperness = (tunning.DAPPERNESS_LARGE + 0 ) end end I don't get any errors so on , only it aint working. Edited September 20, 2016 by durant313 Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/#findComment-816090 Share on other sites More sharing options...
Serpens Posted September 20, 2016 Share Posted September 20, 2016 (edited) do you want it for your characer, or for everyone? If for everyone it is easy, the other is more complicated. edit: I guess you want it for your mod character so: I took a look at the code and I found only one way to mod this so far: Put in your master_postinit(inst) function this:inst.components.sanity.night_drain_mult = -1 This will reverse the sanity gain at night. So instead of loosing sanity, you will get that amount in the dark. Edited September 20, 2016 by Serpens Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/#findComment-816102 Share on other sites More sharing options...
durant313 Posted September 21, 2016 Author Share Posted September 21, 2016 Hello thanks , but it didnt work... Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/#findComment-816179 Share on other sites More sharing options...
Serpens Posted September 21, 2016 Share Posted September 21, 2016 (edited) 14 minutes ago, durant313 said: Hello thanks , but it didnt work... you really should start giving a bit more information, otherwise I can't help you ... If it would work, is it what you asked for? Or do you want a complete different thing? What does not work? Is there an error message? What error? Please upload client_log.txt file with the error in it. Since I don't have your files, I can't test it, so you have to test it and report the problem precisly. Edited September 21, 2016 by Serpens Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/#findComment-816180 Share on other sites More sharing options...
durant313 Posted September 21, 2016 Author Share Posted September 21, 2016 (edited) oh sorry bro , I don't see your reply it is so slow... Well I will messenge you privatly u instead and show you everything. Edited September 21, 2016 by durant313 Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/#findComment-816184 Share on other sites More sharing options...
CarlZalph Posted September 22, 2016 Share Posted September 22, 2016 On 9/20/2016 at 10:09 PM, durant313 said: oh sorry bro , I don't see your reply it is so slow... Well I will messenge you privatly u instead and show you everything. It's really not in the spirit of the modding community to keep the code private. Klei's entire game logic is all out in the open for anyone to go by, dissect, reuse, and improve upon. For instance now instead of having multiple people able to help you, you've delegated your help to one individual. Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/#findComment-816733 Share on other sites More sharing options...
Serpens Posted September 22, 2016 Share Posted September 22, 2016 19 minutes ago, CarlZalph said: It's really not in the spirit of the modding community to keep the code private. Klei's entire game logic is all out in the open for anyone to go by, dissect, reuse, and improve upon. For instance now instead of having multiple people able to help you, you've delegated your help to one individual. the code I gave him was correct. he just had inst.components.sanity.night_drain_mult = 1.3 somewhere else, so this was overriding my -1, so that's why it did not work. Since there is only this multiplier for night, I was not able to help him with changing it for day/dusk. I also gave him code to loose 10 sanity for any attacked damage: Quote so if it should be -10 regardless of the damage amount (so you will also get -10 if you have a 100% armor equipped), add this to your master_postinit: inst:ListenForEvent("attacked",function(inst,data) inst.components.sanity:DoDelta(-10) end) Link to comment https://forums.kleientertainment.com/forums/topic/70292-gain-sanity-at-night/#findComment-816738 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