Jump to content

Shave Ewecus


Recommended Posts

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

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 by Cunning fox
  • Like 1
Link to comment
Share on other sites

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

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