FatalVitality Posted December 7, 2015 Share Posted December 7, 2015 Heya, I making a character using transformation to alter their stats, however I noticed it also replenishes their stats - it is not supposed to do that. How do I solve this?Here's the code for the transformation- It's also worth mentioning that their stat is based on their beardlocal function DefStats(inst) inst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH) inst.components.hunger:SetMax(TUNING.WILSON_HUNGER) inst.components.sanity:SetMax(TUNING.WILSON_SANITY) inst.components.locomotor.walkspeed = 4.25 inst.components.locomotor.runspeed = 6.25 inst.components.hunger:SetRate(0.8) end local function Stage1_Stats(inst) inst.components.beard.bits = BEARD_BITS[1] inst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH*1.5) inst.components.hunger:SetMax(TUNING.WILSON_HUNGER*1.5) inst.components.sanity:SetMax(TUNING.WILSON_SANITY/1.5) inst.components.locomotor.walkspeed = 4.1 inst.components.locomotor.runspeed = 6.1 inst.components.hunger:SetRate(1) endlocal function master_postinit(inst) inst:AddComponent("beard") inst.components.beard.onreset = DefaultStats inst.components.beard.prize = "beardhair" inst.components.beard:AddCallback(BEARD_DAYS[1], Stage1_Stats) inst.components.beard:AddCallback(BEARD_DAYS[2], Stage2_Stats) inst.components.beard:AddCallback(BEARD_DAYS[3], Stage3_Stats) -- Stats inst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH) inst.components.hunger:SetMax(TUNING.WILSON_HUNGER) inst.components.sanity:SetMax(TUNING.WILSON_SANITY) inst.components.locomotor.walkspeed = 4.25 inst.components.locomotor.runspeed = 6.25 inst.components.hunger:SetRate(0.8)end Link to comment https://forums.kleientertainment.com/forums/topic/60348-why-does-transformation-replenish-stats/ Share on other sites More sharing options...
almightyjanitor Posted December 7, 2015 Share Posted December 7, 2015 (edited) You can see in the stats components that it's doing this:function Hunger:SetMax(amount) self.max = amount self.current = amountendSo instead of using that function, just change the max stat directly like this:inst.components.health.maxhealth = TUNING.WILSON_HEALTH*1.5inst.components.hunger.max = TUNING.WILSON_HUNGER*1.5inst.components.sanity.max = TUNING.WILSON_SANITY/1.5(Note that it's "maxhealth", not "max" like the other two) Edited December 7, 2015 by almightyjanitor Link to comment https://forums.kleientertainment.com/forums/topic/60348-why-does-transformation-replenish-stats/#findComment-694121 Share on other sites More sharing options...
FatalVitality Posted December 7, 2015 Author Share Posted December 7, 2015 You can see in the stats components that it's doing this:function Hunger:SetMax(amount) self.max = amount self.current = amountendSo instead of using that function, just change the max stat directly like this:inst.components.health.maxhealth = TUNING.WILSON_HEALTH*1.5inst.components.hunger.max = TUNING.WILSON_HUNGER*1.5inst.components.sanity.max = TUNING.WILSON_SANITY/1.5(Note that it's "maxhealth", not "max" like the other two) It throws an error Link to comment https://forums.kleientertainment.com/forums/topic/60348-why-does-transformation-replenish-stats/#findComment-694161 Share on other sites More sharing options...
almightyjanitor Posted December 7, 2015 Share Posted December 7, 2015 Can you post what you've changed? Link to comment https://forums.kleientertainment.com/forums/topic/60348-why-does-transformation-replenish-stats/#findComment-694167 Share on other sites More sharing options...
FatalVitality Posted December 7, 2015 Author Share Posted December 7, 2015 Can you post what you've changed? Don't worry about it, I got it using GetPercent and SetPercent. But thank you for your help Link to comment https://forums.kleientertainment.com/forums/topic/60348-why-does-transformation-replenish-stats/#findComment-694173 Share on other sites More sharing options...
almightyjanitor Posted December 7, 2015 Share Posted December 7, 2015 I suspect that you used a colon instead of a period, but as long as it works. Link to comment https://forums.kleientertainment.com/forums/topic/60348-why-does-transformation-replenish-stats/#findComment-694188 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