QuickShot010 Posted February 2, 2015 Share Posted February 2, 2015 Hey, so for my next Drok update, your damage depends on your hair stage.BUT!I want to change things up, so when you shave you don't shave all your hair but you go one hair stage back. I got everything working except one critical part, the game thinks you are at hair stage 0 when you shave from 4 to 3 for example. This is because of the local beard days. This is the code i got:local function shave(inst) if inst:HasTag("1") then inst.AnimState:SetBuild("drok") inst.components.combat.damagemultiplier = 1.3 inst:RemoveTag("1") local beard_days = 0 elseif inst:HasTag("2") then inst.AnimState:SetBuild("drokquarter") inst.components.combat.damagemultiplier = 1.3 inst:RemoveTag("2") local beard_days = 4 elseif inst:HasTag("3") then inst.AnimState:SetBuild("drokhalf") inst.components.combat.damagemultiplier = 1.4 inst:RemoveTag("3") local beard_days = 8 elseif inst:HasTag("4") then inst.AnimState:SetBuild("drokfull") inst.components.combat.damagemultiplier = 1.6 inst:RemoveTag("4") local beard_days = 18 elseif inst:HasTag("5") then inst.AnimState:SetBuild("drokfullstubble") inst.components.combat.damagemultiplier = 1.8 inst:RemoveTag("5") local beard_days = 24 endend[...] inst:AddComponent("beard") inst.components.beard.onreset = function() shave(inst) end inst.components.beard.prize = "beardhair" local beard_days = {4,8,18,24,30} local beard_bits = {3,3,7,2,3} inst.components.beard:AddCallback(beard_days[1], function() inst.components.beard.bits = beard_bits[1] inst.AnimState:SetBuild("drokquarter") inst.components.combat.damagemultiplier = 1.3 inst:AddTag("1") end) inst.components.beard:AddCallback(beard_days[2], function() inst.components.beard.bits = beard_bits[2] inst.AnimState:SetBuild("drokhalf") inst.components.combat.damagemultiplier = 1.4 inst:AddTag("2") inst:RemoveTag("1") end) inst.components.beard:AddCallback(beard_days[3], function() inst.components.beard.bits = beard_bits[3] inst.AnimState:SetBuild("drokfull") inst.components.combat.damagemultiplier = 1.6 inst:AddTag("3") inst:RemoveTag("2") end) inst.components.beard:AddCallback(beard_days[4], function() inst.components.beard.bits = beard_bits[4] inst.AnimState:SetBuild("drokfullstubble") inst.components.combat.damagemultiplier = 1.8 inst:AddTag("4") inst:RemoveTag("3") end) inst.components.beard:AddCallback(beard_days[5], function() inst.components.beard.bits = beard_bits[5] inst.AnimState:SetBuild("drokfullbeard") inst.components.combat.damagemultiplier = 1.9 inst:AddTag("5") inst:RemoveTag("4") end) So my question is, how do you set the beard days so the correct beard day vallue goes with the correct hair build when you shave? THANKS! Link to comment https://forums.kleientertainment.com/forums/topic/50238-set-beard-days/ Share on other sites More sharing options...
Developer PeterA Posted February 2, 2015 Developer Share Posted February 2, 2015 Glad that your autocompiler is working again. Regarding the beard, In Beard:Shave, we call Reset, which sets everything back to 0. Is that your issue? Link to comment https://forums.kleientertainment.com/forums/topic/50238-set-beard-days/#findComment-608986 Share on other sites More sharing options...
QuickShot010 Posted February 2, 2015 Author Share Posted February 2, 2015 Glad that your autocompiler is working again. Regarding the beard, In Beard:Shave, we call Reset, which sets everything back to 0. Is that your issue? Could be, any idea how to fix this?Thank you for your help! Link to comment https://forums.kleientertainment.com/forums/topic/50238-set-beard-days/#findComment-608993 Share on other sites More sharing options...
Developer PeterA Posted February 2, 2015 Developer Share Posted February 2, 2015 @QuickShot010, I'm not super familar with this code, but I suspect you'll want to override inst.components.beard.Reset, or potentially all of Shave. Then rather than setting daysgrowth back to 0, you'll want to find with stage of growth you're in, and then set it to the growth of the day before, or maybe simply just cut 7 days of growth and spawn only one hairs(self.prize). Link to comment https://forums.kleientertainment.com/forums/topic/50238-set-beard-days/#findComment-609024 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