BigCSniper Posted February 3, 2022 Share Posted February 3, 2022 I was attempting to create a character that has buffs when cold and de-buffs when hot and found a way to check temperature on the forums however I needed it modified to work for both hot and cold. This is my first attempt at trying to code myself so of course... the game crashed. going back through the code I can not find any issues with it but as I said, I am inexperienced. This is the code: local function CheckTemperature(inst) if inst.components.temperature then local t = inst.components.temperature if t:GetCurrent() > 15 and t:GetCurrent() < 60 and not inst:HasTag("tempy") then inst:AddTag("tempy") inst:RemoveTag("tempz") and RemoveTag("tempx") inst.components.sanity.dapperness = 0 inst.components.health:StartRegen(0, 0) inst.components.hunger.burnrate = 1 inst.components.health.absorb = 0.10 inst.components.combat.damagemultiplier = 1 inst.components.locomotor.walkspeed = 4 inst.components.locomotor.runspeed = 6 end if t:GetCurrent() < 15 and not inst:HasTag("tempz") then inst:AddTag("tempz") inst:RemoveTag("tempy") inst.components.sanity.dapperness = 2 inst.components.health:StartRegen(1, 1) inst.components.hunger.burnrate = 0.5 inst.components.health.absorb = 0.20 inst.components.combat.damagemultiplier = 1.25 inst.components.locomotor.walkspeed = 4.5 inst.components.locomotor.runspeed = 7 end if t:GetCurrent() > 60 and not inst:HasTag("tempx") then inst:AddTag("tempx") inst:RemoveTag("tempy") inst.components.sanity.dapperness = -2 inst.components.health:StartRegen(-1, 1) inst.components.hunger.burnrate = 2 inst.components.health.absorb = 0 inst.components.combat.damagemultiplier = 0.75 inst.components.locomotor.walkspeed = 3.5 inst.components.locomotor.runspeed = 5 end end end inst:DoPeriodicTask( 0.0, function(inst) CheckTemperature(inst) end) Link to comment https://forums.kleientertainment.com/forums/topic/137318-temperature-check-character-mod-help/ Share on other sites More sharing options...
Leonidas IV Posted February 4, 2022 Share Posted February 4, 2022 First, it's good that you post the log.txt so we can have a look. Secondly, 0 seconds in DoPeriodicTask is not valid I think. Link to comment https://forums.kleientertainment.com/forums/topic/137318-temperature-check-character-mod-help/#findComment-1537831 Share on other sites More sharing options...
BigCSniper Posted February 4, 2022 Author Share Posted February 4, 2022 Here is the txt file and the base code I used for this is from this forum: Here they teach about temperature and the code has DoPeriodicTask at 0 client_log_2022-02-03-22-29-02.txt Link to comment https://forums.kleientertainment.com/forums/topic/137318-temperature-check-character-mod-help/#findComment-1537879 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