cosmicdreams Posted May 21, 2017 Share Posted May 21, 2017 I'm currently making a mod for a friend and I, but I'm not sure how to add custom perks for my character! I have no idea how to code and I don't know how to add these ones: - No sanity drain for dusk and night - Loses 2 sanity per min (Like how maxwell gains sanity, but instead for my character, he loses sanity) - Max health 200 will decrease according to sanity: (sanity;health) 100-81;190, 80-61;180, 60-41;170, 40-21;160, 20-0;150 - Does less damage according to sanity: (sanity;damage) 100-81;2, 80-61;1.75, 60-41;1.25, 40-21;1, 20-0;0.75 - Takes more damage from freezing and overheating - Takes very small amounts of damage from wetness Please help! Link to comment Share on other sites More sharing options...
AkaiNight Posted May 21, 2017 Share Posted May 21, 2017 try this for no sanity lose dusk and night inst.components.sanity.night_drain_mult =0 inst.components.sanity.dusk_drain_mult =0 into master_postinit and this for lose 2 sanity per min inst.components.sanity:StartRegen(-2, 60) into master_postinit and this for 2x damage from overheating this may work for freezing i don't know local function IncreaseHurtRate(inst) inst.components.temperature.hurtrate = inst.components.temperature.hurtrate * 2 end local function DecreaseHurtRate(inst) inst.components.temperature.hurtrate = inst.components.temperature.hurtrate / 2 end into character.lua also put this master_postinit inst:ListenForEvent("startoverheating", IncreaseHurtRate) inst:ListenForEvent("stopoverheating", DecreaseHurtRate) Link to comment Share on other sites More sharing options...
cosmicdreams Posted May 24, 2017 Author Share Posted May 24, 2017 On 5/22/2017 at 3:31 AM, AkaiNight said: try this for no sanity lose dusk and night inst.components.sanity.night_drain_mult =0 inst.components.sanity.dusk_drain_mult =0 into master_postinit and this for lose 2 sanity per min inst.components.sanity:StartRegen(-2, 60) into master_postinit and this for 2x damage from overheating this may work for freezing i don't know local function IncreaseHurtRate(inst) inst.components.temperature.hurtrate = inst.components.temperature.hurtrate * 2 end local function DecreaseHurtRate(inst) inst.components.temperature.hurtrate = inst.components.temperature.hurtrate / 2 end into character.lua also put this master_postinit inst:ListenForEvent("startoverheating", IncreaseHurtRate) inst:ListenForEvent("stopoverheating", DecreaseHurtRate) On 5/22/2017 at 3:31 AM, AkaiNight said: try this for no sanity lose dusk and night inst.components.sanity.night_drain_mult =0 inst.components.sanity.dusk_drain_mult =0 into master_postinit and this for lose 2 sanity per min inst.components.sanity:StartRegen(-2, 60) into master_postinit and this for 2x damage from overheating this may work for freezing i don't know local function IncreaseHurtRate(inst) inst.components.temperature.hurtrate = inst.components.temperature.hurtrate * 2 end local function DecreaseHurtRate(inst) inst.components.temperature.hurtrate = inst.components.temperature.hurtrate / 2 end into character.lua also put this master_postinit inst:ListenForEvent("startoverheating", IncreaseHurtRate) inst:ListenForEvent("stopoverheating", DecreaseHurtRate) I tried it, but an error appears everytime I launch a server with the mod I'm not sure what to do, so I'll paste it here and maybe someone can explain this I'm using the Extended Sample Character mod to make my character by the way Thanks for the help though Link to comment Share on other sites More sharing options...
AkaiNight Posted May 28, 2017 Share Posted May 28, 2017 On 24.05.2017 at 0:24 PM, TotalTrashDream said: I tried it, but an error appears everytime I launch a server with the mod I'm not sure what to do, so I'll paste it here and maybe someone can explain this I'm using the Extended Sample Character mod to make my character by the way Thanks for the help though can you send candy.lua? I think i can fix it but english is not my main language so i can't explain it to you :/ Link to comment Share on other sites More sharing options...
MorickClive Posted May 28, 2017 Share Posted May 28, 2017 (edited) Sanity:StartRegen() doesn't exist like Health:StartRegen(), which why it's stating the method is a nil value. Try adding this (in respective locations) instead: -- if you're not dapper you're: local Scruffy(inst, pertick) -- Madness is a symptom of being alive right? if not inst.components.health:IsDead() then inst.components.sanity:DoDelta(pertick, 0) end end -- MasterInit -- DoTask every: (20 seconds, function name, initialdelay) inst:DoPeriodicTask(20, Scruffy(-2), nil) -- Alternatively you could just set in MasterInit inst.components.sanity.dapperness = -0.1 -- natural state is to constantly lose sanity, though I can't fully state how -- much you'd lose. ---- -- Side notes ---- -- Night drain also impacts during the evening, there's read for a dusk value sadly. -- [[ However be careful, this also means that the penalty for moving into the edge of darkness is lost too.]] inst.components.sanity.night_drain_mult = 0 If you get issues with how "pertick" is being sent then just call Scruffy in periodic task(without additional brackets) and remove the parameter from the local function; substituting the parameter value in "dodelta" for the sanity damage. Edited May 28, 2017 by MorickClive Link to comment Share on other sites More sharing options...
cosmicdreams Posted June 2, 2017 Author Share Posted June 2, 2017 On 5/29/2017 at 6:00 AM, MorickClive said: Sanity:StartRegen() doesn't exist like Health:StartRegen(), which why it's stating the method is a nil value. Try adding this (in respective locations) instead: -- if you're not dapper you're: local Scruffy(inst, pertick) -- Madness is a symptom of being alive right? if not inst.components.health:IsDead() then inst.components.sanity:DoDelta(pertick, 0) end end -- MasterInit -- DoTask every: (20 seconds, function name, initialdelay) inst:DoPeriodicTask(20, Scruffy(-2), nil) -- Alternatively you could just set in MasterInit inst.components.sanity.dapperness = -0.1 -- natural state is to constantly lose sanity, though I can't fully state how -- much you'd lose. ---- -- Side notes ---- -- Night drain also impacts during the evening, there's read for a dusk value sadly. -- [[ However be careful, this also means that the penalty for moving into the edge of darkness is lost too.]] inst.components.sanity.night_drain_mult = 0 If you get issues with how "pertick" is being sent then just call Scruffy in periodic task(without additional brackets) and remove the parameter from the local function; substituting the parameter value in "dodelta" for the sanity damage. Oh thanks! Sorry for late reply, I haven't worked on the mod lately so I didn't bother to check for any replies. Sorry to also disappoint but, I already found out how to do the sanity loss. I just copied waxwell's dapperness into my character's lua and changed it. I do appreciate the help though. On 5/29/2017 at 5:27 AM, AkaiNight said: can you send candy.lua? I think i can fix it but english is not my main language so i can't explain it to you :/ I kinda lost candy.lua while sending my whole mod file to a friend of mine who was going to do the artwork for me. It disappeared as soon as it was uploaded to dropbox, and I don't know how to get it back. Do you know how I could regain it? Link to comment Share on other sites More sharing options...
MorickClive Posted June 2, 2017 Share Posted June 2, 2017 (edited) Np dream, glad to hear it's working! I just noticed a typo on my end - or a missing word at least: -- Night drain also impacts during the evening, there's read for a dusk value sadly. -- [[ However be careful, this also means that the penalty for moving into the edge of darkness is lost too.]] inst.components.sanity.night_drain_mult = 0 "There's no read for the dusk value"* - it's all based from your night multiplier, so be careful how you set the night sanity multiplier. ^^ Edited June 2, 2017 by MorickClive 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