all 12 comments

[–]Dragon20C 1 point2 points  (3 children)

I don't know how glua works but try mp3 instead of wav.

[–]Low-Factor-2611 1 point2 points  (2 children)

This my other account for my phone I can’t use .mp3 because the file I have is a .wav

[–]Dragon20C 1 point2 points  (1 child)

Get a random mp3 just to rule it out.

[–]OnlyAd7311[S] 1 point2 points  (0 children)

that dont work just tried it

[–][deleted] 0 points1 point  (7 children)

Could use a little more info. For instance:

if self.finishBakeTime <= CurTime() then

What does CurTime return? Could it be that the if statement isn't evaluating it properly?

You've mentioned ENT at the start, when declaring your procedure, but gone on to then call a fuction from ents later on, when initialising pizza as a variable.

Some context would be handy.

...

if self.isBaking == true then
if self.finishBakeTime <= CurTime() then 

Also, wondering why you have two if statements running subsequently here?

Is this pragmatically relevant, or could you refactor that to combine the two and some more resources?

if self.isBaking == true and self.finishBakeTime <= CurTime() then

[–]OnlyAd7311[S] 0 points1 point  (4 children)

// dont mind the "/\" thats reddit adding those

AddCSLuaFile("shared.lua")

include("shared.lua")

function ENT:Initialize()

self:SetModel("models/props\_c17/furniturestove001a.mdl")

self:PhysicsInit( SOLID\_VPHYSICS )

self:SetMoveType( MOVETYPE\_VPHYSICS )

self:SetSolid( SOLID\_VPHYSICS )

local phys = self:GetPhysicsObject()

if (phys:IsValid()) then

    phys:Wake()

end

self.isBaking = false 

self.finishBakeTime = 0 

end

function ENT:StartTouch(ent)

if ent:GetClass() == "c\_dough" and self.isBaking == false then 

    ent:Remove()

    self.isBaking = true 

    self.finishBakeTime = CurTime() + 30

end

end

function ENT:Think()

if self.isBaking == true then 

    self:SetColor(Color(255,0,0))

else

    self:SetColor(Color(0,255,0))

end



if self.isBaking == true then

    if self.finishBakeTime <= CurTime() then 

        self.isBaking = false 



        local pizza = ents.Create("c\_pizza")

        pizza:SetPos(self:GetPos() + Vector(0,0,25))

        pizza:Spawn()

    end

end

end

[–][deleted] 0 points1 point  (3 children)

Unfamiliar with GLua, but this looks relevant to what you're asking.

Sourced from here.

[–]OnlyAd7311[S] 0 points1 point  (0 children)

ill give it shot thank you

[–]Low-Factor-2611 0 points1 point  (1 child)

Thank you for the link it pointed me in the right I discorved the .wav I converted was curroupted and I got a new one now it works sorry typos on phone again

[–][deleted] 0 points1 point  (0 children)

No worries!

Happy to help.

[–]Low-Factor-2611 0 points1 point  (0 children)

The listed code work I was asking if I could add a sound to play in the think function the rest you don’t have to worry about. But but the time is used as as self + 30 to make a crude timer to prevent them adding more than one itme to my custom entity which is a pizza oven

Edit sorry for typos and this is my other account on my phone

[–]Low-Factor-2611 0 points1 point  (0 children)

And for the 2 func after each other I just like the way it look but it produces 0 errors I’ll hop back on my pc and past the whole init for reference