• Custom entity not spawning correctly in DarkRP F4 menu
    2 replies, posted
Hi, I have created a custom entity which also spawns in extra props using ents.create() I tried this in darkrp and it spawned fine from the Q menu, but when I try to spawn it in the F4 menu, it doesnt spawn the extra props. function ENT:Initialize()     self:SetModel("models/props_lab/powerbox01a.mdl")     self:SetMaterial("models/debug/debugwhite")     self:SetColor(Color(80, 80, 80))          self:PhysicsInit(SOLID_VPHYSICS)     self:SetMoveType(MOVETYPE_VPHYSICS)     self:SetSolid(SOLID_VPHYSICS)          local phys = self:GetPhysicsObject()          if phys:IsValid() then              phys:Wake()              end end function ENT:SpawnFunction(ply, tr, ClassName)     if !tr.Hit then return end     tr.start = ply:EyePos()     tr.endpos = ply:EyePos() + 100 * ply:GetAimVector()     tr.filter = ply     local trace = util.TraceLine(tr)     local ent = ents.Create(ClassName)     ent:SetPos(trace.HitPos + Vector(0, 0, 20))     ent:SetAngles(Angle(0, ply:EyeAngles().y - 180, 0))     ent:Spawn()     ent:Activate()     ent.vent = ents.Create("prop_physics")     ent.vent:SetModel("models/props_vents/vent_small_straight002.mdl")     ent.vent:SetMaterial("models/debug/debugwhite")     ent.vent:SetColor(Color(80, 80, 80))     ent.vent:SetParent(ent)     ent.vent:SetPos(ent:GetPos() + ent:GetRight() * -15)     ent.vent:SetAngles(ent:GetAngles() + Angle(0, 0, -20))     ent.vent:Spawn()     ent.vent:Activate() return ent end Does DarkRP override the spawn function to use its own, and just skips the creation of ent.vent, if so how can I stop this.
Upon further inspection, I have found out that its just skipping the spawn function all together, Its only executing the ENT:Initialize() function Does anyone know why ENT:SpawnFunction() wont execute on darkrp, is it being overridden by something in darkrp to spawn the custom entities?
I have fixed this heres what I changed: function ENT:Initialize()     self:SetModel("models/props_lab/powerbox01a.mdl")     self:SetMaterial("models/debug/debugwhite")     self:SetColor(Color(80, 80, 80))          self:PhysicsInit(SOLID_VPHYSICS)     self:SetMoveType(MOVETYPE_VPHYSICS)     self:SetSolid(SOLID_VPHYSICS)          local phys = self:GetPhysicsObject()          if phys:IsValid() then              phys:Wake()              end     self:SetVar("vent", ents.Create("prop_physics"))     self:GetVar("vent"):SetModel("models/props_vents/vent_small_straight002.mdl")     self:GetVar("vent"):SetMaterial("models/debug/debugwhite")     self:GetVar("vent"):SetColor(Color(80, 80, 80))     self:GetVar("vent"):SetParent(self)     self:GetVar("vent"):SetPos(self:GetPos() + self:GetRight() * -15)     self:GetVar("vent"):SetAngles(self:GetAngles() + Angle(0, 0, -20))     self:GetVar("vent"):Spawn() end I removed the spawn function and changed ent.vent to self:SetVar("vent" .....) and self:GetVar("vent")
Sorry, you need to Log In to post a reply to this thread.