I have been trying to make it so when a player touches the entitie it turns into a ghost prop meaning the player could walk though it/change opacity. It seems to be working but I can't seem to get it to turn the entitie back into a solid after. I have also tried self:SetSolid(SOLID_VPHYSICS)/(SOLID_NONE). Please help me out =D
[lua]
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self.Entity:SetModel("models/hunter/blocks/cube1x1x025.mdl")
self.Entity:SetSkin(0)
self.Entity:SetSolid(SOLID_VPHYSICS)
local phys = self.Entity:GetPhysicsObject()
if phys and phys:IsValid() then phys:Wake() end
end
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( self.Classname )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end
ENT.isTouching = false
function ENT:StartTouch( ent )
if ( ent:IsValid() and ent:IsPlayer() ) then
self:SetColor( 173, 255, 47, 100)
self.isTouching = true
end
end
function ENT:Touch( ent )
if ( self.isTouching ) then
self:SetNotSolid( true )
end
end
function ENT:EndTouch( ent )
if ( ent:IsValid() and ent:IsPlayer() ) then
self:SetColor( 173, 255, 47, 255)
self:SetNotSolid( true )
self.isTouching = false
end
end
function ENT:Think()
end
[/lua]
Sorry, you need to Log In to post a reply to this thread.