Entity not setting material

Hi guys,

Got a small issue, wondered if anyone could lend me a hand and point out what I’m doing wrong here.

I’ve got a turret and it works perfectly. But I want to give it the Citizen Rebels skin, so I used the method at the bottom of the function. But the material doesn’t set. Obviously I’ve check that I have the file locally as will as it being on the server.

If anyone could help my out that would be awesome.

Thanks!




function ENT:Initialize()
	self:SetModel("models/Combine_turrets/Floor_turret.mdl")
	self:PhysicsInit(SOLID_VPHYSICS)

	self:SetUseType(SIMPLE_USE)


	local phys = self:GetPhysicsObject()
	if phys:IsValid() then
		phys:SetMass(50)
		phys:EnableMotion(false)
		phys:Wake()
	end

	self:SetAmmo(self.DefaultAmmo)
	self:SetMaxObjectHealth(250)
	self:SetObjectHealth(self:GetMaxObjectHealth())
	
		local RandomSkin = math.random(1,3)
		local MaterialToApply = ""
		
		-- Skin 1
		if RandomSkin == 1 then
			MaterialToApply = "models/Floor_turret/Floor_turret/floor_turret_citizen"
		elseif RandomSkin == 2 then
			MaterialToApply = "models/Floor_turret/Floor_turret/floor_turret_citizen2"
		elseif RandomSkin == 3 then
			MaterialToApply = "models/Floor_turret/Floor_turret/floor_turret_citizen4"
		end
		
		self:SetMaterial(MaterialToApply)
	--	self:SetMaterial("models/Floor_turret/Floor_turret/floor_turret_citizen", forceMaterial = true)
			
	
end




Those materials only exist in Episode 2, so you gotta have them in order to see them.

Sorry I don’t quite follow by what you mean.

I’ve got the material files and then placed them within my gamemode folder structure and then obviously downloaded them.

Well you clearly don’t have the materials if you can’t see them in-game.

Btw, the materials originally are called

models/Combine_Turrets/Floor_turret/floor_turret_citizen2

I got the materials from here and this is how I got hold of them with a different directory :o