Ibfolk2c Posted December 2, 2017 Share Posted December 2, 2017 hi i'm new, i'm a friend of olivebread and im creating a character that cant take freezing dmg, and takes it as a buff with sanity can you help me with this topic? Link to comment Share on other sites More sharing options...
verdago7 Posted December 2, 2017 Share Posted December 2, 2017 Are you saying that you still freeze, but while frozen you don't take damage and instead gain sanity? And the frozen animation would still remain on screen? Link to comment Share on other sites More sharing options...
Ibfolk2c Posted December 2, 2017 Author Share Posted December 2, 2017 yea, pretty much Link to comment Share on other sites More sharing options...
verdago7 Posted December 2, 2017 Share Posted December 2, 2017 Trying to find the coding having to do with damage when cold... Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted December 3, 2017 Share Posted December 3, 2017 (edited) Put this in your character lua file: local function sane (inst)    if inst.components.temperature.current <= 0 then    inst.components.sanity:DoDelta(1,1) --change it to your values (value1 is the amount restored, value2 when to do this every x seconds)  --else if inst.components.temperature.current >= 70 then --optional if you want to get hurt in the summer this will do the trick  --inst.components.health:DoDelta(-1,1) --end    end end local master_postinit = function(inst)    -- Stats of the character    inst.components.health:SetMaxHealth(185) --just reference don't put this its just reference    inst.components.hunger:SetMax(185)    inst.components.sanity:SetMax(200)    inst.components.temperature.hurtrate = 0 --well you'll be immune to freezing damage but what about overheating damage?     inst:DoPeriodicTask(1, sane, nil, inst) -- put this in the master_postinit       inst.OnLoad = onload    inst.OnNewSpawn = onload end Edited December 3, 2017 by K1NGT1GER609 it was 70 when you die from overheating Link to comment Share on other sites More sharing options...
Ibfolk2c Posted December 3, 2017 Author Share Posted December 3, 2017 would this work for freezing?  AddPrefabPostInit("CHARACTER", function(inst)   if inst.components.freezable then     inst:RemoveComponent("freezable")   end end) possibly this?  inst.components.temperature.hurtrate = 0else if inst.components.temperature.current >= 75 then inst.componets.temperture.hurtrate = 30 Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted December 3, 2017 Share Posted December 3, 2017 Its a bit simpler than that, you can put this in the master_postinit: inst:RemoveComponent("freezable") I don't use addprefabpostinit as I don't know how to use it or it gave me more of an headache so I didn't bother with it. as for the last part of the code you could put the hurtrate at one and it'll be fine, putting it to 30 will most likely kill your character in seconds. Plus there's a certain limit on how high you can go on those rates and cause a crash since the value was way too high for the game to run. Link to comment Share on other sites More sharing options...
verdago7 Posted December 3, 2017 Share Posted December 3, 2017 Well if he adds that component he won't get the freeze animation, will he? I think he wants the freeze animation... Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted December 3, 2017 Share Posted December 3, 2017 Er... I'm not sure what you want, removing the component just keeps the character from being frozen in ice. It doesn't stop freezing...but I'd advise you to explain exactly what your looking for cause I don't follow the logic atm. Link to comment Share on other sites More sharing options...
verdago7 Posted December 3, 2017 Share Posted December 3, 2017 He wants to freeze, and instead of taking damage, gain sanity. So in winter, when he reaches 0, he will take "sanity freezing" effects. Correct me if I'm wrong , I thought your earlier post made sense... didn't test it, but looked like it was on the right track to stop damage but not stop freezing Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted December 4, 2017 Share Posted December 4, 2017 Well test it then, it should fit the description. Link to comment Share on other sites More sharing options...
Ibfolk2c Posted December 7, 2017 Author Share Posted December 7, 2017 the screen freeze if fine, i wouldn't prefer it tho also could the shivering animation be removed? thx for the help Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted December 8, 2017 Share Posted December 8, 2017 Shivering animation can be removed but itll be more trouble than worth. Itll have to do with editing stategraphs and they change every so often, requiring fixing everytime its updated. Last i cant really edit the hud i dont have enough experience for that. 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