Parenting

Hello, I’ve been trying to parent the env_explosion with Crossbow_bolt. I’ve tried on about 30 occasions to get it right after searching, and no help. My Failed attempts are still in the code, and could you shorted the code for a favor perhaps?


local bar = ents.Create("crossbow_bolt")
bar:SetAngles(self.Owner:EyeAngles())
bar:SetPos(self.Owner:GetShootPos())
bar:SetOwner(self.Owner)
bar:SetPhysicsAttacker(self.Owner)
local explosion = ents.Create( "env_explosion" )
explosion:SetKeyValue( "iMagnitude" , "150" )
explosion:SetKeyValue("spawnflags", "2")
explosion:SetKeyValue("spawnflags", "4")
explosion:SetKeyValue("spawnflags", "16")
explosion:SetKeyValue("spawnflags", "64")
explosion:SetKeyValue("spawnflags", "4")
explosion:SetOwner( bar )
explosion:SetPhysicsAttacker(owner)
bar:Spawn()
local phys = bar:GetPhysicsObject()
phys:ApplyForceCenter(self.Owner:GetAimVector() * 1999999999)
phys:AddAngleVelocity(Vector(0,5000000,0))
explosion:Spawn()
explosion:SetParent( bar )
explosion:Fire("explode","",1.40)
explosion:Fire("explode","",1.80)
explosion:Fire("explode","",2.20)
explosion:Fire("explode","",2.60)
explosion:Fire("kill","",3.1 )
bar:Fire("kill", "", 5)

end
end

Is it supposed to explode in mid-air or after it hits something?

Its supposed to explode in mid-air. After I get the parenting correct, i’m going to add an ar2_explosion and replace the “ring” of the explosion with particles.

[editline]2nd June 2012[/editline]

Problem solved, Thanks anyway guys!