TwardyBrzoskwin Posted January 7, 2019 Share Posted January 7, 2019 Hi, So i wanted to make Ewecus shaveable so I did this: inst:AddComponent("beard") inst.components.beard.bits = 3 inst.components.beard.daysgrowth = TUNING.BEEFALO_HAIR_GROWTH_DAYS + 1 inst.components.beard.onreset = OnResetBeard inst.components.beard.canshavetest = CanShaveTest inst.components.beard.prize = "steelwool" inst.components.beard:AddCallback(0, OnShaved) inst.components.beard:AddCallback(TUNING.BEEFALO_HAIR_GROWTH_DAYS, OnHairGrowth) But wanted to get phlegm as well on shaving. What do i need to add? Thanks! Link to comment Share on other sites More sharing options...
icantevenname Posted January 8, 2019 Share Posted January 8, 2019 Jus' a shot in the dark, either add inst.components.beard.prize = "phlegm" Or do inst.components.beard.prize = "steelwool", "phlegm" Jus' a guess. Link to comment Share on other sites More sharing options...
Cunning fox Posted January 8, 2019 Share Posted January 8, 2019 (edited) 10 hours ago, icantevenname said: Jus' a shot in the dark, either add inst.components.beard.prize = "phlegm" Or do inst.components.beard.prize = "steelwool", "phlegm" Jus' a guess. Thats a syntax error. Thats how its done: inst:ListenForEvent("shaved", function(inst) local beard = inst.components.beard for k = 1, beard.bits do local bit = SpawnPrefab("phlegm") local x, y, z = inst.Transform:GetWorldPosition() bit.Transform:SetPosition(x, y + 2, z) local speed = 1 + math.random() local angle = math.random() * 2 * PI bit.Physics:SetVel(speed * math.cos(angle), 2 + math.random() * 3, speed * math.sin(angle)) end end) Edited January 8, 2019 by Cunning fox 1 Link to comment Share on other sites More sharing options...
icantevenname Posted January 9, 2019 Share Posted January 9, 2019 12 hours ago, Cunning fox said: Thats a syntax error. Thats how its done: inst:ListenForEvent("shaved", function(inst) local beard = inst.components.beard for k = 1, beard.bits do local bit = SpawnPrefab("phlegm") local x, y, z = inst.Transform:GetWorldPosition() bit.Transform:SetPosition(x, y + 2, z) local speed = 1 + math.random() local angle = math.random() * 2 * PI bit.Physics:SetVel(speed * math.cos(angle), 2 + math.random() * 3, speed * math.sin(angle)) end end) Welp, I tried. Link to comment 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