Thebrettstoner Posted June 7, 2017 Share Posted June 7, 2017 Elloh there, I want my character to start oveheating as his sanity starts to drop, he has a max of 80 sanity so he's fine when full but burns up at 0. If anyone knows how i can do this please let me know. Link to comment https://forums.kleientertainment.com/forums/topic/79655-making-my-character-overheat-when-insane/ Share on other sites More sharing options...
Lumina Posted June 7, 2017 Share Posted June 7, 2017 You could probably look at willow code, she does something similar, no ? Link to comment https://forums.kleientertainment.com/forums/topic/79655-making-my-character-overheat-when-insane/#findComment-929562 Share on other sites More sharing options...
MorickClive Posted June 7, 2017 Share Posted June 7, 2017 (edited) You should investigate Willow's file for this, she does the same for a lack of sanity but freezes instead. Willow's specific code: -- as part of the easing functionality, please include: local easing = require("easing") -- This is the called from function (un-modified from willows) -- Search in the TUNING.lua file found in the data folder of DST to find references to the values such as "TUNING.WILLOW_CHILL_START" local function UpdateSanityTemperature(inst) --Don't chill all the way to 0, or temperature --update fluctuations can still cause freezing if TheWorld.state.temperature > 1 then local sanity = inst.components.sanity:GetPercent() if sanity < TUNING.WILLOW_CHILL_START then inst.components.temperature:SetModifier( "sanity", math.max( 1 - TheWorld.state.temperature, sanity > TUNING.WILLOW_CHILL_END and easing.outQuad(sanity - TUNING.WILLOW_CHILL_END, TUNING.WILLOW_SANITY_CHILLING, -TUNING.WILLOW_SANITY_CHILLING, TUNING.WILLOW_CHILL_START - TUNING.WILLOW_CHILL_END) or TUNING.WILLOW_SANITY_CHILLING ) ) return end end inst.components.temperature:RemoveModifier("sanity") end --[[ -- inst.components.temperature:SetModifier() -- the function that you should handle -- if the function states return - it ends the function (if condition isn't met "sanity modifier" is removed) math.max( 1 - TheWorld.state.temperature, sanity > TUNING.WILLOW_CHILL_END and easing.outQuad(sanity - TUNING.WILLOW_CHILL_END, TUNING.WILLOW_SANITY_CHILLING, -TUNING.WILLOW_SANITY_CHILLING, TUNING.WILLOW_CHILL_START - TUNING.WILLOW_CHILL_END) or TUNING.WILLOW_SANITY_CHILLING ) ]] ---- -- Main master fn for your character --- local function master_postinit(inst) -- from Willow's inst:DoPeriodicTask(.1, UpdateSanityTemperature, 0) end Edited June 7, 2017 by MorickClive Link to comment https://forums.kleientertainment.com/forums/topic/79655-making-my-character-overheat-when-insane/#findComment-929565 Share on other sites More sharing options...
Thebrettstoner Posted June 7, 2017 Author Share Posted June 7, 2017 3 hours ago, MorickClive said: You should investigate Willow's file for this, she does the same for a lack of sanity but freezes instead. Willow's specific code: -- as part of the easing functionality, please include: local easing = require("easing") -- This is the called from function (un-modified from willows) -- Search in the TUNING.lua file found in the data folder of DST to find references to the values such as "TUNING.WILLOW_CHILL_START" local function UpdateSanityTemperature(inst) --Don't chill all the way to 0, or temperature --update fluctuations can still cause freezing if TheWorld.state.temperature > 1 then local sanity = inst.components.sanity:GetPercent() if sanity < TUNING.WILLOW_CHILL_START then inst.components.temperature:SetModifier( "sanity", math.max( 1 - TheWorld.state.temperature, sanity > TUNING.WILLOW_CHILL_END and easing.outQuad(sanity - TUNING.WILLOW_CHILL_END, TUNING.WILLOW_SANITY_CHILLING, -TUNING.WILLOW_SANITY_CHILLING, TUNING.WILLOW_CHILL_START - TUNING.WILLOW_CHILL_END) or TUNING.WILLOW_SANITY_CHILLING ) ) return end end inst.components.temperature:RemoveModifier("sanity") end --[[ -- inst.components.temperature:SetModifier() -- the function that you should handle -- if the function states return - it ends the function (if condition isn't met "sanity modifier" is removed) math.max( 1 - TheWorld.state.temperature, sanity > TUNING.WILLOW_CHILL_END and easing.outQuad(sanity - TUNING.WILLOW_CHILL_END, TUNING.WILLOW_SANITY_CHILLING, -TUNING.WILLOW_SANITY_CHILLING, TUNING.WILLOW_CHILL_START - TUNING.WILLOW_CHILL_END) or TUNING.WILLOW_SANITY_CHILLING ) ]] ---- -- Main master fn for your character --- local function master_postinit(inst) -- from Willow's inst:DoPeriodicTask(.1, UpdateSanityTemperature, 0) end Thanks for the quick reply i shall experiment with this first thing in the morning. ^_^ Link to comment https://forums.kleientertainment.com/forums/topic/79655-making-my-character-overheat-when-insane/#findComment-929618 Share on other sites More sharing options...
Thebrettstoner Posted June 8, 2017 Author Share Posted June 8, 2017 On 2017-6-7 at 8:58 PM, MorickClive said: You should investigate Willow's file for this, she does the same for a lack of sanity but freezes instead. Willow's specific code: -- as part of the easing functionality, please include: local easing = require("easing") -- This is the called from function (un-modified from willows) -- Search in the TUNING.lua file found in the data folder of DST to find references to the values such as "TUNING.WILLOW_CHILL_START" local function UpdateSanityTemperature(inst) --Don't chill all the way to 0, or temperature --update fluctuations can still cause freezing if TheWorld.state.temperature > 1 then local sanity = inst.components.sanity:GetPercent() if sanity < TUNING.WILLOW_CHILL_START then inst.components.temperature:SetModifier( "sanity", math.max( 1 - TheWorld.state.temperature, sanity > TUNING.WILLOW_CHILL_END and easing.outQuad(sanity - TUNING.WILLOW_CHILL_END, TUNING.WILLOW_SANITY_CHILLING, -TUNING.WILLOW_SANITY_CHILLING, TUNING.WILLOW_CHILL_START - TUNING.WILLOW_CHILL_END) or TUNING.WILLOW_SANITY_CHILLING ) ) return end end inst.components.temperature:RemoveModifier("sanity") end --[[ -- inst.components.temperature:SetModifier() -- the function that you should handle -- if the function states return - it ends the function (if condition isn't met "sanity modifier" is removed) math.max( 1 - TheWorld.state.temperature, sanity > TUNING.WILLOW_CHILL_END and easing.outQuad(sanity - TUNING.WILLOW_CHILL_END, TUNING.WILLOW_SANITY_CHILLING, -TUNING.WILLOW_SANITY_CHILLING, TUNING.WILLOW_CHILL_START - TUNING.WILLOW_CHILL_END) or TUNING.WILLOW_SANITY_CHILLING ) ]] ---- -- Main master fn for your character --- local function master_postinit(inst) -- from Willow's inst:DoPeriodicTask(.1, UpdateSanityTemperature, 0) end Thanks a lot, i forgot about willow. i just copied her code and changed some numbers around. it wokrs now. Link to comment https://forums.kleientertainment.com/forums/topic/79655-making-my-character-overheat-when-insane/#findComment-929920 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