Failed to load sound... ...file probably missing from disk/repository
2 replies, posted
I began coding Lua just recently and began working on my own SWEP. I searched for any related problems on Facepunch, but found none. I have it fully functional except for when I use a custom sound. The code below is not my whole code, just what I believe is related to the problem.
Any help will be nice, Thanks!
[b]Error:[/b]Failed to load sound "sound\weapons\agun\shot.wav", file probably missing from disk/repository
[b]Code related to error:[/b]
[lua]
SWEP.Primary.Sound = "sound/weapons/agun/shot.wav"
function SWEP:Initialize()
util.PrecacheSound(self.Primary.Sound)
if ( SERVER ) then
self:SetWeaponHoldType( self.HoldType )
end
end
//Primary Attack\\
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
local bullet = {}
bullet.Num = self.Primary.NumberofShots
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
bullet.Tracer = 1
bullet.Force = self.Primary.Force
bullet.Damage = self.Primary.Damage
bullet.AmmoType = self.Primary.Ammo
self:ShootEffects()
self.Owner:FireBullets( bullet )
self.Weapon:EmitSound( self.Primary.Sound )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self:TakePrimaryAmmo(self.Primary.TakeAmmo)
end
[/lua]
Remove "sound/" from the beginning on the filename.
Wow, I can't believe that I never noticed it wasn't in the 'weapons' folder...
I guess that was the problem, and maybe the 'sound/' part.
Now all I need is a better muzzle flash effect and then I'll be done!
Thanks for helping me 20 Smartness, next time I'll try spending more than a few hours trying to fix the problem on my own.
Sorry, you need to Log In to post a reply to this thread.