BillBobJoy Posted February 18, 2014 Share Posted February 18, 2014 I have a custom character that I created and I recently I realized he would lose health in the winter from freezing damage but the freezing animation that is supposed to show in the winter never happened. I was wondering if anyone has ever experienced a bug like this or has any idea on how to fix it. I have included the mod for anyone who wished to look at the code or test for themselves. I appreciate the help. Full Mod:mrgmview.zip Link to comment Share on other sites More sharing options...
BillBobJoy Posted February 20, 2014 Author Share Posted February 20, 2014 If someone knows what event causes the Freezing animations that would be help me out because it would give me a place to look. Link to comment Share on other sites More sharing options...
NikMik Posted February 21, 2014 Share Posted February 21, 2014 inst.components.temperature.inherentinsulation = 210 caused problems with my character mod, like feezing when the character's temperature was still 20-12. Link to comment Share on other sites More sharing options...
BillBobJoy Posted February 21, 2014 Author Share Posted February 21, 2014 Yeah I was testing and saw it just changed the temperature but not when you actually get cold. I was about to post my findings and I saw you lol. Do you know of way to make it so my character actually stays warmer longer? That was the original intent, I will continue to look into it. Thanks again. My most recent attempt was to add insulation of Wilson's full beard to the character directly with the insulator component but this didn't work. local fn = function(inst) -- character sound and icon inst.soundsname = "mrgmview" inst.entity:AddMiniMapEntity() inst.MiniMapEntity:SetIcon( "mrgmview.tex" ) -- Extra Components inst:AddComponent("dapperness") inst:AddComponent("seasonmanager") inst:AddComponent("insulator") -- Stats. inst.components.health:SetMaxHealth(200) inst.components.hunger:SetMax(125) inst.components.sanity:SetMax(200) inst.components.combat.damagemultiplier = 1.25 inst.components.combat:SetAttackPeriod(0.4) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.85) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.85) inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 0.75) -- Beard Warmth inst.components.insulator.insulation = (TUNING.INSULATION_PER_BEARD_BIT * 9) -- Well learned Sanity Buff inst.components.sanity.neg_aura_mult = 2.75 inst.components.sanity.night_drain_mult = 0 inst.components.dapperness.mitigates_rain = true -- Not Wearing Hat Nervious Sanity Debuff inst.components.sanity.dapperness = (TUNING.DAPPERNESS_MED * -3.0) -- Was a Hat Equiped inst:ListenForEvent("equip", hat) inst:ListenForEvent("unequip", hat) inst:ListenForEvent("itemlose", hat) -- Is It Winter Weakness inst:ListenForEvent("newcombattarget", weak) -- Was Food Eaten inst:ListenForEvent("oneat", good_cook) -- If die put somewhere inst:ListenForEvent("LuaWallUpdate", dummy) end Link to comment Share on other sites More sharing options...
Fidooop Posted February 21, 2014 Share Posted February 21, 2014 inst:AddComponent("insulator") inst.components.insulator.insulation = 75 that's what I got on my hat for smiley... that should give a little more than breezy vest giveshope it works! Link to comment Share on other sites More sharing options...
BillBobJoy Posted February 21, 2014 Author Share Posted February 21, 2014 I was able to get this to work with items, like the hat in my mod, but when I apply it to the character directly it makes no difference. Thanks for the input though. Link to comment Share on other sites More sharing options...
BillBobJoy Posted February 21, 2014 Author Share Posted February 21, 2014 I have found out that the temperature component only checks if an inventory item has the insulation component, if an inventory item has the heater component, or if the player has the beard component but not if the player has a the insulator component. Is there a way to alter this? --figure out our insulation local total_insulation = 0 total_insulation = total_insulation + self.inherentinsulation if self.inst.components.inventory then for k,v in pairs (self.inst.components.inventory.equipslots) do if v.components.heater then local heat = v.components.heater:GetEquippedHeat() if heat > self.current and not v.components.heater.iscooler then ambient_delta = ambient_delta + (heat - self.current) elseif heat < self.current and v.components.heater.iscooler then ambient_delta = ambient_delta + (heat - self.current) end end if v.components.insulator then total_insulation = total_insulation + v.components.insulator.insulation end end for k,v in pairs(self.inst.components.inventory.itemslots) do if v.components.heater then local heat = v.components.heater:GetCarriedHeat() if heat > self.current and not v.components.heater.iscooler then ambient_delta = ambient_delta + (heat - self.current) elseif heat < self.current and v.components.heater.iscooler then ambient_delta = ambient_delta + (heat - self.current) end end end if self.inst.components.inventory.overflow and self.inst.components.inventory.overflow.components.container then for k,v in pairs(self.inst.components.inventory.overflow.components.container.slots) do if v.components.heater then local heat = v.components.heater:GetCarriedHeat() if heat > self.current and not v.components.heater.iscooler then ambient_delta = ambient_delta + (heat - self.current) elseif heat < self.current and v.components.heater.iscooler then ambient_delta = ambient_delta + (heat - self.current) end end end end end if self.inst.components.beard then total_insulation = total_insulation + self.inst.components.beard:GetInsulation() end Link to comment Share on other sites More sharing options...
BillBobJoy Posted February 21, 2014 Author Share Posted February 21, 2014 I was able to give him an inherent warmth by giving him a beard the instantly grows back (after day 1) the only problem is I cannot figure out a way to stop him form shaving. Currently I can shave infinity after day 1, I wouldn't mind because I set the drops from shaving to nothing but you get a sanity boost from shaving, which is a problem. Link to comment Share on other sites More sharing options...
BillBobJoy Posted February 21, 2014 Author Share Posted February 21, 2014 @Mr. Tiddles I think I solved the issue removed:inst:AddComponent("temperature") I took this component out the the character prefab because I found out it comes preincluded with a character. changed:inst.components.temperature.inherentinsulation = 210 to inst.components.temperature.inherentinsulation = (TUNING.INSULATION_PER_BEARD_BIT * 9) This seems to be working, if it isn't too much trouble can you verify this for me? Thank you for your time! Resulting code: local fn = function(inst) -- character sound and icon inst.soundsname = "mrgmview" inst.entity:AddMiniMapEntity() inst.MiniMapEntity:SetIcon( "mrgmview.tex" ) -- Extra Components inst:AddComponent("dapperness") inst:AddComponent("seasonmanager") -- Stats. inst.components.health:SetMaxHealth(200) inst.components.hunger:SetMax(125) inst.components.sanity:SetMax(200) inst.components.combat.damagemultiplier = 1.25 inst.components.combat:SetAttackPeriod(0.4) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.85) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.85) inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 0.75) -- Beard Warmth inst.components.temperature.inherentinsulation = (TUNING.INSULATION_PER_BEARD_BIT * 9) -- Well learned Sanity Buff inst.components.sanity.neg_aura_mult = 2.75 inst.components.sanity.night_drain_mult = 0 inst.components.dapperness.mitigates_rain = true -- Not Wearing Hat Nervious Sanity Debuff inst.components.sanity.dapperness = (TUNING.DAPPERNESS_MED * -3.0) -- Was a Hat Equiped inst:ListenForEvent("equip", hat) --inst:ListenForEvent("equip_", hat) inst:ListenForEvent("unequip", hat) inst:ListenForEvent("itemlose", hat) -- Is It Winter Weakness inst:ListenForEvent("newcombattarget", weak) -- Was Food Eaten inst:ListenForEvent("oneat", good_cook) -- If die put somewhere inst:ListenForEvent("LuaWallUpdate", dummy) end 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.