Magalise Posted February 28, 2018 Share Posted February 28, 2018 Hello! I am making my first character mod, but I have some issues with introducing the character´s perks (damage boost when insane) What i want is the character to get a damage multiplier when at 30 sanity (out of 100). I am going for wilson´s base damage multiplier, so it would be a X2 multiplier when at 30 or less sanity. I also want the character to announce when they reach the 30 or less sanity ("I am the madness!"), and also say something again when above 40 sanity. Is this possible at all? I have found a few strings for DST, but when i paste them into the prefab.lua of my character for DS it crashes the game. the string i found was: Spoiler local function lowsanity(inst) inst.components.combat.damagemultiplier = 2 end local function highsanity(inst) inst.components.combat.damagemultiplier = 1 end local function onsanitychange(inst, data) if inst.components.sanity.current <= 30 then if not inst.isBody then lowsanity(inst) inst.components.talker:Say("I am the madness!") inst.isBody = true end elseif inst.components.sanity.current >= 40 then if inst.isBody then highsanity(inst) inst.components.talker:Say("have i gone mad?",3) inst.isBody = false end end inst.isBody = false inst:ListenForEvent("sanitydelta", onsanitychange) end I would greatly appreciate it if anyone could help me with this. thank you in advance. Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted March 1, 2018 Share Posted March 1, 2018 Here: local function onsanitychange(inst) if inst.components.sanity:GetPercent() <= .30 then inst.components.combat.damagemultiplier = 2 inst.components.talker:Say("I am the madness!") elseif inst.components.sanity:GetPercent() >= .40 then inst.components.combat.damagemultiplier = 1 inst.components.talker:Say("have i gone mad?") else inst.components.combat.damagemultiplier = 1 end end local fn = function(inst) --reference on where it goes this is your main for your character inst:DoPeriodicTask(5, onsanitychange, nil, inst) --the 5 is in seconds, its change-able Link to comment Share on other sites More sharing options...
Magalise Posted March 1, 2018 Author Share Posted March 1, 2018 @K1NGT1GER609 thank you so much! It works like a charm! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.