• custom TTT grenade explosion sound won't work
    3 replies, posted
No errors are displayed it's just that the sound never played when the grenade explodes here is my code [lua]AddCSLuaFile() resource.AddFile("sound/soundFile/soundName.wav") ENT.Type = "anim" ENT.Base = "ttt_confgrenade_proj" ENT.Model = Model("models/weapons/w_eq_fraggrenade_thrown.mdl") function ENT:Explode( tr ) if SERVER then self:SetNoDraw( true ) self:SetSolid( SOLID_NONE ) if tr.Fraction != 1.0 then self:SetPos( tr.HitPos + tr.HitNormal * 0.6 ) end local pos = self:GetPos() local effect = EffectData() effect:SetStart( pos ) effect:SetOrigin( pos ) effect:SetScale( 500 ) effect:SetRadius( 500 ) effect:SetMagnitude( 300 ) sound.Play("soundFile/soundName.wav", pos, 100, 100) util.Effect( "Explosion", effect, true, true ) util.BlastDamage( self, self:GetThrower(), pos, 500, 300) self:SetDetonateExact( 0 ) else local spos = self:GetPos() local trs = util.TraceLine( { start=spos + Vector( 0, 0, 64 ), endpos = spos + Vector( 0, 0, -128 ), filter = self } ) util.Decal( "Scorch", trs.HitPos + trs.HitNormal, trs.HitPos - trs.HitNormal ) self:SetDetonateExact( 0 ) end end [/lua] I've checked that the spelling of the sound files is fine but they were fine.
Use Entity.EmitSound instead.
[QUOTE=code_gs;48956979]Use Entity.EmitSound instead.[/QUOTE] Sadly that did not work.
[QUOTE=KTBM;48957108]Sadly that did not work.[/QUOTE] Are you sure the sound is being downloaded to players? Any red message about in console about missing file?
Sorry, you need to Log In to post a reply to this thread.