One Pot with up to 5 Seeds?

I’m trying to get a pot to accept up to 5 different “Seeds” that when placed against it, will grow and give 1 piece of whatever the seed was. Such as; A weed Seed in the Pot will put out 1 weed, but if you put a Coca seed in the pot, it will put out 1 cocaine.

Here’s the code; What am I doing wrong?


AddCSLuaFile("cl_init.lua")

AddCSLuaFile("shared.lua")

include("shared.lua")

function ENT:Initialize()

self.Entity:SetModel("models/nater/weedplant_pot_dirt.mdl")

self.Entity:PhysicsInit(SOLID_VPHYSICS)

self.Entity:SetColor(255, 255, 255, 255)

self.Entity:SetMoveType(MOVETYPE_VPHYSICS)

self.Entity:SetSolid(SOLID_VPHYSICS)

self.Entity:SetUseType(SIMPLE_USE)

local phys = self.Entity:GetPhysicsObject()

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

self.Entity:SetNWBool("Usable", false)

self.Entity:SetNWBool("Plantable", true)

self.damage = 10

local ply = self.Entity:GetNWEntity("owning_ent")

end

function ENT:OnTakeDamage(dmg)

self.damage = self.damage - dmg:GetDamage()

if (self.damage <= 0) then

local effectdata = EffectData()

effectdata:SetOrigin(self.Entity:GetPos())

effectdata:SetMagnitude(2)

effectdata:SetScale(2)

effectdata:SetRadius(3)

util.Effect("Sparks", effectdata)

self.Entity:Remove()

end

end

-----------------

function ENT:Touch(hitEnt)

if hitEnt:GetClass() == "seed_weed" then

if self.Entity:GetNWBool("Plantable") == true then

self.Entity:SetNWBool("Plantable", false)

hitEnt:Remove()

self.Entity:SetModel("models/nater/weedplant_pot_planted.mdl")

timer.Create("Stage2_"..self:EntIndex(), 5, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing1.mdl")

end)

timer.Create("Stage3_"..self:EntIndex(), 15, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing2.mdl")

end)

timer.Create("Stage4_"..self:EntIndex(), 30, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing3.mdl")

end)

timer.Create("Stage5_"..self:EntIndex(), 45, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing4.mdl")

end)

timer.Create("Stage6_"..self:EntIndex(), 60, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing5.mdl")

end)

timer.Create("Stage7_"..self:EntIndex(), 120, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing6.mdl")

end)

timer.Create("Stage8_"..self:EntIndex(), 180, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing7.mdl")

self.Entity:SetNWBool("Weed", true)

end)

end

end

end

function ENT:Touch(hitEnt2)

if hitEnt2:GetClass() == "seed_cocaine" then

if self.Entity:GetNWBool("Plantable") == true then

self.Entity:SetNWBool("Plantable", false)

hitEnt2:Remove()

self.Entity:SetModel("models/nater/weedplant_pot_planted.mdl")

timer.Create("Stage2_"..self:EntIndex(), 5, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing1.mdl")

end)

timer.Create("Stage3_"..self:EntIndex(), 15, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing2.mdl")

end)

timer.Create("Stage4_"..self:EntIndex(), 30, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing3.mdl")

end)

timer.Create("Stage5_"..self:EntIndex(), 45, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing4.mdl")

end)

timer.Create("Stage6_"..self:EntIndex(), 60, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing5.mdl")

end)

timer.Create("Stage7_"..self:EntIndex(), 120, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing6.mdl")

end)

timer.Create("Stage8_"..self:EntIndex(), 180, 1, function()

self.Entity:SetModel("models/nater/weedplant_pot_growing7.mdl")

self.Entity:SetNWBool("Cocaine", true)

end)

end

end

end





function ENT:Use()

if self.Entity:GetNWBool("Cocaine") == true then

self.Entity:SetNWBool("Cocaine", false)

self.Entity:SetNWBool("Plantable", true)

self.Entity:SetModel("models/nater/weedplant_pot_dirt.mdl")

local SpawnPos = self.Entity:GetPos()

local CocaineBag = ents.Create("durgz_cocaine")

CocaineBag:SetPos(SpawnPos)

CocaineBag:Spawn()

end

end

function ENT:Use()

if self.Entity:GetNWBool("Weed") == true then

self.Entity:SetNWBool("Weed", false)

self.Entity:SetNWBool("Plantable", true)

self.Entity:SetModel("models/nater/weedplant_pot_dirt.mdl")

local SpawnPos = self.Entity:GetPos()

local WeedBag = ents.Create("durgz_weed")

WeedBag:SetPos(SpawnPos)

WeedBag:Spawn()

end

end

function ENT:OnRemove()

if self.Entity:GetNWBool("Plantable") == false then

timer.Destroy("Stage2")

timer.Destroy("Stage3")

timer.Destroy("Stage4")

timer.Destroy("Stage5")

timer.Destroy("Stage6")

timer.Destroy("Stage7")

timer.Destroy("Stage8")

end

end 

EDIT: With this code the Pot will only take the Cocaine Seeds and actually grow. If I try to use Weed Seeds, it only bumps up against the Pot and does nothing. Once I remove the Cocaine “part”, it will then allow Weed to grow and put out 1 weed. Oh, and i’m not too great with LUA.

And yes, I realize I posted this in the wrong section. Sorry!