Sup facepunch, I'm currently working on an RP map that's the main map on a server I play on. I was wondering, how could I make it so that doors will eventually respawn after being blown off with the shotgun?
(in the server a shotgun blows a door off its hinges)
I thought I could use a logic_timer, but I don't know what else.
Just use an ordinary door. Most shotgun door scripts work by disabling the actual door and creating a prop for the thing which falls off. Then after a time the prop is removed and the door is renabled.
I did. The maps been up on the server for about a week now, but the doors have never respawn. Seems to be a problem with the shotgun code, I'll bet they haven't included it because of Gmod 13.
[editline]15th November 2012[/editline]
Shotgun shared.lua (only the part that has to do with doors):
if trace.Entity:GetClass() == "prop_door_rotating" and self.mode == "burst" and (SERVER) then
trace.Entity:Fire("open", "", 0.001)
trace.Entity:Fire("unlock", "", 0.001)
local pos = trace.Entity:GetPos()
local ang = trace.Entity:GetAngles()
local model = trace.Entity:GetModel()
local skin = trace.Entity:GetSkin()
local smoke = EffectData()
smoke:SetOrigin(pos)
util.Effect("effect_smokedoor", smoke)
trace.Entity:SetNotSolid(true)
trace.Entity:SetNoDraw(true)
local function ResetDoor(door, fakedoor)
door:SetNotSolid(false)
door:SetNoDraw(false)
fakedoor:Remove()
end
local norm = (pos - self.Owner:GetPos()):Normalize()
local push = 10000 * norm
local ent = ents.Create("prop_physics")
ent:SetPos(pos)
ent:SetAngles(ang)
ent:SetModel(model)
if(skin) then
ent:SetSkin(skin)
end
ent:Spawn()
timer.Simple(0.01, ent.SetVelocity, ent, push)
timer.Simple(0.01, ent:GetPhysicsObject().ApplyForceCenter, ent:GetPhysicsObject(), push)
timer.Simple(25, ResetDoor, trace.Entity, ent)
end
Any errors in the console or server log? anyway you're better taking this to the lua section.
[QUOTE=mdeceiver79;38466191]Any errors in the console or server log? anyway you're better taking this to the lua section.[/QUOTE]
No, no errors.
Sorry, you need to Log In to post a reply to this thread.