Heeello there.
So I've been lately working again on a gamemode, and I've found a problem.
The thing is, that I've made a script that replaces all props with certains models with another entity (that can drop stuff and be destroyed) that gets the same model (there are two entities almost identical: rocks and trees).
The problem is that when a resource is spawned, it goes through trees and when a tree is moved, there's like an invisible something colliding.
Both rocks and trees have the same things on ENT:Initialize regarding physics
[CODE]
Tree:
function ENT:Initialize()
-- Physics initialize.
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_VPHYSICS)
end
Rocks:
function ENT:Initialize()
-- Physics initialize.
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_VPHYSICS)
self:SetRenderMode( RENDERMODE_TRANSALPHA )
self:SetColor(Color(255,255,255,255))
self.Enabled = true -- This is for a respawning function
end
[/CODE]
This is the function that spawns them: [B](TreeModels and RockModels are two tables fully working)[/B]
[CODE]
function SURVIVAL:InitializeResourceSources()
local classes = {"prop_physics", "prop_physics_override", "prop_physics_multiplayer", "prop_dynamic", "prop_static"}
for k,ent in pairs(ents.GetAll()) do
if table.HasValue(classes, ent:GetClass()) then
if table.HasValue(TreeModels, ent:GetModel()) then
local src = ents.Create("tree")
src:SetPos(ent:GetPos())
src:SetAngles(ent:GetAngles())
src:SetModel(ent:GetModel())
src.ENTHealth = math.random(200,400)
src:Spawn()
ent:Remove()
elseif table.HasValue(RockModels, ent:GetClass()) then
local src = ents.Create("rock")
src:SetPos(ent:GetPos())
src:SetAngles(ent:GetAngles())
src:SetModel(ent:GetModel())
src.ENTHealth = math.random(250,500)
src:Spawn()
ent:Remove()
end
end
end
end
[/CODE]
Here's a video to see what's going on [B][EXTREME LOW QUALITY, I WANTED TO UPLOAD IT FAST][/B]
[video=youtube;8YII4Tt7tcM]https://www.youtube.com/watch?v=8YII4Tt7tcM&feature=youtu.be[/video]
Sorry, you need to Log In to post a reply to this thread.