Jump to content

Shedding two items at once?


Recommended Posts

SO I've got my character to shed nightmare fuel in the same interval as the bearger. BUT I would now like him to shed two items at once, nightmare fuel and beard hair. 

Here's the code I've got 

inst:AddComponent("shedder")
    inst.components.shedder.shedItemPrefab = "nightmarefuel"
    inst.components.shedder.shedHeight = .5
    inst.components.shedder:StartShedding(TUNING.BEARGER_SHED_INTERVAL * 20) 

 

Do I just paste this in again but with beard hair instead of nightmare fuel or is there a way with more finesse? 

 

Thanks!

Link to comment
Share on other sites

 

inst:DoPeriodicTask(TIME, function(inst)
    local item = "YOUR_ITEM"
    local item_ = "ANOTHER_ITEM"
    if item ~= nil then
        local x, y, z = inst.Transform:GetWorldPosition()
        item.Transform:SetPosition(x + math.random() - .5, SHED_HIEGHT, z + math.random() - .5)
        item_.Transform:SetPosition(x + math.random() - .5, SHED_HIEGHT, z + math.random() - .5)
    end
    return item
   end
end)

I think that would make it only shed one item because the component only has one shedprefab
so it would replace the other one


so i made this one just in case it doesn't work, this is from the shedder component (sorry for shoddy coding) you'll need to replace some variables so i put them in capital letters

Edited by thomas4846
Link to comment
Share on other sites

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
 Share

×
  • Create New...