dave9664 Posted March 26, 2015 Share Posted March 26, 2015 (edited) My character is supposed to be very tough and wears custom armour that is basically represented with this code: inst.components.health:SetAbsorbAmount(0.95) The problem is that it is also applying to the amount of damage taken when starving. The health goes down very slowly. How can I fix this to make the health go down faster when starving? wrexcharactermod.zip Edited March 26, 2015 by dave9664 Link to comment https://forums.kleientertainment.com/forums/topic/52372-how-to-change-amount-of-damage-taken-when-starving/ Share on other sites More sharing options...
DarkXero Posted March 26, 2015 Share Posted March 26, 2015 Huh, starving damage isn't true damage after all.AddComponentPostInit("hunger", function(self) local old = self.DoDec function self:DoDec(dt, ignore_damage) if self.inst.prefab == "wrex" then local old = self.current if self.burning then if self.current <= 0 then if not ignore_damage then self.inst.components.health:DoDelta(-self.hurtrate*dt, true, "hunger", nil, nil, true) -- ich haber hunger end else self:DoDelta(self.burnrate*(-self.hungerrate*dt), true) end end else old(self, dt, ignore_damage) end endend) Link to comment https://forums.kleientertainment.com/forums/topic/52372-how-to-change-amount-of-damage-taken-when-starving/#findComment-625022 Share on other sites More sharing options...
dave9664 Posted March 26, 2015 Author Share Posted March 26, 2015 Ha sorry I don't know what I'm on about, where does this go? In the character.lua? Link to comment https://forums.kleientertainment.com/forums/topic/52372-how-to-change-amount-of-damage-taken-when-starving/#findComment-625082 Share on other sites More sharing options...
DarkXero Posted March 26, 2015 Share Posted March 26, 2015 Modmain.lua.AddComponentPostInit, AddPrefabPostInit... all functions in modutil.lua require the mod environment. Link to comment https://forums.kleientertainment.com/forums/topic/52372-how-to-change-amount-of-damage-taken-when-starving/#findComment-625086 Share on other sites More sharing options...
dave9664 Posted March 26, 2015 Author Share Posted March 26, 2015 His health still goes down reaaallly slowly when he's starving, do I have to increase the -self.hurtrate*dt? Link to comment https://forums.kleientertainment.com/forums/topic/52372-how-to-change-amount-of-damage-taken-when-starving/#findComment-625098 Share on other sites More sharing options...
DarkXero Posted March 26, 2015 Share Posted March 26, 2015 (edited) Then instead of the AddComponentPostInit in modmain.lua (remove it), we can put in the master_postinit of the prefab file:inst.components.hunger.hurtrate = 100 Edited March 26, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/52372-how-to-change-amount-of-damage-taken-when-starving/#findComment-625106 Share on other sites More sharing options...
dave9664 Posted March 26, 2015 Author Share Posted March 26, 2015 Works perfect thank you! Link to comment https://forums.kleientertainment.com/forums/topic/52372-how-to-change-amount-of-damage-taken-when-starving/#findComment-625113 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