im making a cooking script and need help

so i make a wine mod and i want to add more then one prop to my refinery here is the code pls reply i cant find eny help

function ENT:Initialize()

self:SetModel( "models/props_wasteland/laundry_basket001.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )      -- Make us work with physics,
self:SetMoveType( MOVETYPE_VPHYSICS )   -- after all, gmod is a physics
self:SetSolid( SOLID_VPHYSICS )         -- Toolbox

    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() == “gin” and self.isBaking == false then
ent:Remove()
self.isBaking = true
self.finishBakeTime = CurTime() + 5

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 wine = ents.Create("wine")
wine:SetPos(self:GetPos() + Vector(0,0,30))
wine:Spawn()
end

end
end

What do you mean?

i want to make something like meth where you have to add more then one item to the macine

https://facepunch.com/forumdisplay.php?f=65

still dont help me :frowning:

First, welcome to Facepunch, second, this belongs in the developer section that Moku linked (and it’s simple enough to put in the “Questions that don’t need their own thread” thread. Third, you can use [ lua] code here [ /lua] tags around code to format it.

As for your code, I would use a table and another variable.



function ENT:Initialize()
	self:SetModel("models/props_wasteland/laundry_basket001.mdl")
	self:PhysicsInit(SOLID_VPHYSICS) -- Make us work with physics,
	self:SetMoveType(MOVETYPE_VPHYSICS) -- after all, gmod is a physics
	self:SetSolid(SOLID_VPHYSICS) -- Toolbox
	local phys = self:GetPhysicsObject()

	if (phys:IsValid()) then
		phys:Wake()
	end

	self.isBaking = false
	self.finishBakeTime = 0
	self.spawnOnFinish = ""
end

local refinetimes = {
	["gin"] = {5,"wine"},
	["hops"] = {10,"beer"},
	["potatos"] = {30,"vodka"},
}

function ENT:StartTouch(ent)
	local reftbl = refinetimes[ent:GetClass()] --This returns either {5,"wine"}, {10,"beer"}, {30,"vodka"} or nil
	if reftbl ~= nil and self.isBaking == false then
		ent:Remove()
		self.isBaking = true
		self.finishBakeTime = CurTime() + reftbl[1]
		self.spawnOnFinish = reftbl[2]
	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 item = ents.Create(self.spawnOnFinish)
			item:SetPos(self:GetPos() + Vector(0, 0, 30))
			item:Spawn()
		end
	end
end


*code is untested

the potatos can i delete that code and fore the hops can i change that to alchol

That code is written with versatility in mind so you should be able to do that if you already have the classes

hey its cool and all budt iwant to do so you have to add gin and then alchol and then you get wine as outcome

i want to do so you have to like add water and gin to the macine and then get wine from the macine and it wont start until both items is added

First you say you want gin and alcohol and then water and gin
???

i also want alcohol budt i want you to make so i need to add alchol and then gin and then water and then i can get wine insted of only adding 1 item

u understand?

[editline]15th January 2017[/editline]

the code works budt i want to example add water and then gin and then honey to the macine and get wine out of it

You might try Scriptfodder jobs, my man. People wont finish your project for you

im new to lua and im not making the wine mod for scriptfodder since im against paying for addons! also i just need help on how to do so you can add more then 1 ingreadence to the macine you dont have to make it for me i just need the code i can edit myself i just dont know what to type