Spawn A material?

Hi. Is there a way i can eventually make a stool that spawns a material anywhere i want not just on a object. (I’d like to spawn it on the actual map?)

You would have to make the individual model with the size of and shape with the material on it. Or you could just make the model and material it ingame with the material stool. And maybe theres a way to do it with effects but again you have to specify length width and everything. Since your not being very specific its hard to answer. But if you mean to material world objects such as walls and floors I believe that cannot be done.

Thanks Proost

I was meaning to do it on walls and other parts of maps. I didn’t think it was possible either, but just wanting to know, it was just so if we could try and put decals on a map without decompiling the map

No problem and I agree it would be useful but its out of the reach at the moment >:(

You can how ever replace materials on walls and stuff, if thats useful

Actually you can with the paint-tool. Look at it’s code.

Can’t you spawn info_decals that do just that? The textures you can use with decals are limited though I believe, and if you spawn it on a wall with a normal world material it does the material flashing glitch a bit.

**[Util.Decal

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Util.Decal)**

A z-fight :science:

Also doesn anyone know that page? This one?

Ok so i can use this


function SWEP:PaintScorch()
	local tr = self.Owner:GetEyeTrace()
		local Pos1 = tr.HitPos + tr.HitNormal
		local Pos2 = tr.HitPos - tr.HitNormal
	util.Decal("SmallScorch", Pos1, Pos2)
end

How would i make that work so when i press left click it activates that code (Sorry i’m a bit of a noob)

[editline]11:16AM[/editline]


function TOOL:LeftClick( tr )
local ply = self.Owner    
local tr = self.Owner:GetEyeTrace()
        local Pos1 = tr.HitPos + tr.HitNormal
        local Pos2 = tr.HitPos - tr.HitNormal
    util.Decal("Smile", Pos1, Pos2)
end




Thats what i got to but it says GetEyeRrace is a nil value? Any help.

No one?

Wait, are you trying to make a swep or a stool?

[editline]01:39PM[/editline]

Gimme books. A stool. Right, try this:

[lua]function TOOL:LeftClick( tr )
local Pos1 = tr.HitPos + tr.HitNormal
local Pos2 = tr.HitPos - tr.HitNormal
util.Decal(“Smile”, Pos1, Pos2)
end[/lua]