VendeBon Posted June 9, 2024 Share Posted June 9, 2024 Basically I am trying to create a new stat for my modded character. the stat should work in a way that when the stat is 100 then the speed of the character is 2x and when 0 the speed is 0.7x + the stat feels up only when eating vegetables, how do I do that? Link to comment https://forums.kleientertainment.com/forums/topic/156797-need-help-for-my-custom-stat/ Share on other sites More sharing options...
_zwb Posted June 10, 2024 Share Posted June 10, 2024 11 hours ago, VendeBon said: the stat is 100 then the speed of the character is 2x and when 0 the speed is 0.7x + the stat feels up only when eating vegetables These two seems contradicting, do you mean the character gains speed boost from eating veggie? Link to comment https://forums.kleientertainment.com/forums/topic/156797-need-help-for-my-custom-stat/#findComment-1722373 Share on other sites More sharing options...
VendeBon Posted June 10, 2024 Author Share Posted June 10, 2024 (edited) Basically yeah, but I would want it to be in a stat (so the speed boost could be stored) and the lower the stat the slower the character and vice versa like old wolfgang that you need to eat to be strong but in this case to be fast and you're only limited to vegetables (sorry for my bad english) Edited June 10, 2024 by VendeBon Link to comment https://forums.kleientertainment.com/forums/topic/156797-need-help-for-my-custom-stat/#findComment-1722580 Share on other sites More sharing options...
VendeBon Posted June 12, 2024 Author Share Posted June 12, 2024 I figured out it would be easier to do just a speed boost when eating veggies, but how I could do it Link to comment https://forums.kleientertainment.com/forums/topic/156797-need-help-for-my-custom-stat/#findComment-1724077 Share on other sites More sharing options...
Glommer2 Posted June 21, 2024 Share Posted June 21, 2024 --this is the easiest way, it checks whenever you eat sth, and if it's veg ,your speed boost to 1.5 for 30s local master_postinit = function(inst)--add code below to your master_postinit function inst.components.eater._Eat = inst.components.eater.Eat function inst.components.eater:Eat(food) --local edible = food.components.edible if inst.components.acerolastatus.phase ~= 1 then foodprefer(food) end local edible = food.components.edible local hungerv = edible.hungervalue if edible.foodtype == FOODTYPE.VEGGIE then inst.components.locomotor:SetExternalSpeedMultiplier(inst, "veggie_speed_mod", 1.5)--speed up to 1.5 if inst.vegspeed ~= nil then inst.vegspeed:Cancel() inst.vegspeed = nil end inst.vegspeed = inst:DoTaskInTime(30,function() inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "veggie_speed_mod")--remove it after 30s end) end return inst.components.eater:_Eat(food) end end Link to comment https://forums.kleientertainment.com/forums/topic/156797-need-help-for-my-custom-stat/#findComment-1727755 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