AVERY777 Posted September 5, 2020 Share Posted September 5, 2020 (edited) Hello! I’ve been creating a custom character and recently got stuck at prefabs modding, because I’m new to this. My character’s default damage multiplier is 1.5, and it becomes 2.0 for 10 seconds after he eats meat (including raw meat, cooked meat and all food made with meat, like meatball) EXCEPT MONSTER MEAT though. I used whatsmynameagain’s code which works for cave banana. I edited the code, but nothing happend so far in game. Here’s what I did so far: above master_postinit: Quote local function onupdate(inst, dt) inst.boost_time = inst.boost_time - dt if inst.boost_time <= 0 then if inst.boost_task ~= nil then inst.boost_task:Cancel() inst.boost_task = nil end inst.components.combat.damagemultiplier = 1.5 --change this to your char's default multiplier end end local function startmeatboost(inst, duration) inst.boost_time = 10 --boost duration in seconds, change it to whatever you want if inst.boost_task == nil then inst.boost_task = inst:DoPeriodicTask(1, onupdate, nil, 1) --arguments:(time, fn, delay, fnArguments) inst.components.combat.damagemultiplier = inst.boost_mult --increase the multiplier onupdate(inst, 0) --for avoiding a 1 second delay end end local function meat(inst, food) if inst.components.eater and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT then startmeatboost(inst) end end In master_postinit: Quote -- Damage multiplier inst.components.combat.damagemultiplier = 1.5 Quote --remove inst.boost_time from here if you have it inst.boost_task = nil --leave this nil inst.boost_mult = 2 --change this to the desired multiplier after eating meat inst.components.eater:SetOnEatFn(meat) Any help would be much appreciated! Edited September 5, 2020 by AVERY777 typo Link to comment https://forums.kleientertainment.com/forums/topic/121524-help-damage-dealing-buff-after-eating-meat/ Share on other sites More sharing options...
DecDuck Posted September 6, 2020 Share Posted September 6, 2020 Use a food buff, like Warly's dishes. It takes care of all the timing and stuff for you, and you can even have a quote when they eat it. Link to comment https://forums.kleientertainment.com/forums/topic/121524-help-damage-dealing-buff-after-eating-meat/#findComment-1369459 Share on other sites More sharing options...
AVERY777 Posted September 7, 2020 Author Share Posted September 7, 2020 I solved it myself somehow. Quote if inst.components.eater and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT then I just changed this part to: Quote if inst.components.eater and food.components.edible.foodtype == FOODTYPE.MEAT and not food:HasTag("monstermeat") then Link to comment https://forums.kleientertainment.com/forums/topic/121524-help-damage-dealing-buff-after-eating-meat/#findComment-1369657 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