Jump to content

Recommended Posts

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?

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 by VendeBon

--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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...