Hi Guys - New Weapon & Looping Sound Created 16 years ago2007-08-24 19:33:47 UTC by Jess Horton Jess Horton

Created 16 years ago2007-08-24 19:33:47 UTC by Jess Horton Jess Horton

Posted 16 years ago2007-08-24 19:33:47 UTC Post #232807
Hello all, I am having a bit of trouble. I coded a new weapon in the good old Half-Life SDK 2.3 and everything compiles no problem. Everything works great in game but I am wondering if I have a leak or a function problem that I just can't track down. I am new to the SDK and have limited experience with it's structure.

Anyhow the problem is ... when I fire the weapon everything works great and then the fire sound begins to loop over and over. It will stop if I switch weapons and then fire the new weapon. I did do my own custom gun shot sound but I triple checked it's format and it is correct. I've scoured my code and the code to a few other guns to check against them but all looks great. I even thought maybe the sound was a bit to long but the Pythons firing sound is longer.

Anybody else even had this problem or is there a wizz out there who might just know. Thanks in advance
Posted 16 years ago2007-08-24 20:08:37 UTC Post #232810
Ok here's an update ... I replaced the sound with the sound from the glock. I mean I did it in the code, events, and whatever and the looping goes away which leads me to believe it's the wave file I created. So on with figuring out why it loops automatically I mean don't you have to physically add cue points in or for it to loop in HL. I didn't know it could do it automatically. I recorded the sound from the firing range brought it home and mixed it down which sounds great but not sure how to take the loop away.
Posted 16 years ago2007-08-24 21:35:27 UTC Post #232815
A). Use that button next time, the one that says "Edit". I'm pretty sure penguin boy could hook you up with a picture of tht.

B). I've heard of sound problems because of the frequency, because of the length, and amongst other problems. Check and make sure you didn't leave anything easily overlooked out of the code (a simple punctuation can cause problems). Also make sure everything with your sound is right.

I'm no coder, but I know some bits, and until someone with more coding knowledge comes along... yeah.
Posted 16 years ago2007-08-24 22:11:04 UTC Post #232818
Haha anyhow the update you didn't read said the code was fine so your coding experience doesn't matter. I'm not sure about the sound stuff since I program, model, and map but thanks for the nice response :)
Posted 16 years ago2007-08-24 23:27:29 UTC Post #232830
as i said though. sounds frequency has always played me a bit. especially in a lower end older game such as half-life, you're much more likely to use a lower frequency than in Source.

Try messing with the sound file. Frequency, length, among others. Simply enough, do you have a file, or a bit of code misspelled? Even though you say the code is fine, it may not be. Like anything when looking for spelling, read it aloud to yourself until you notice an error. Long and unwanted, yes, but it's an extra review that MAY help.

Anyways, good luck.
Posted 16 years ago2007-08-25 10:49:20 UTC Post #232850
Hey bud well here is what I did, I took the wave I created and copied it, then I renamed it to pl_gun3 which is what the glock uses in game. So when I loaded the game then the glock did the same thing.

I then took the original glock wave copied it back to the glock and to my new weapon which makes both sounds work great in game. The code is great which honestly sucks cause it would be a whole lot easier to fix for me.

Anyhow thank you again I'm going to spend the day fixing this wave somehow so I'll let you know what I did when I fix it. Thanks again.
Posted 16 years ago2007-08-25 18:25:42 UTC Post #232880
OMG I cant belive you where able to code a weapon into half-life. I've been trying to do that for sooooo long. Could you post the code or something.

As for the sound. Did you create it by yourself or take it from somthing else? If you took it from someone else, it is possible that the sound file has cue points. Basically this will loop the sound in game. Download a program called "Goldwave" and check if the sound has cue points. Its in one of the menus. If the sound has cue points than delete them.
Posted 16 years ago2007-08-25 20:38:47 UTC Post #232888
Aaron haha I won't give you the code even though yes you did solve my problem. The cue points were taken out and it works great. Anyhow take your time with the weapon coding and it'll come. If you don't know C++ it's going to be alot harder but don't give up. Get a book or too or do trial and error with the code but only modify small things at a time. If I see any questions from you I'll try to help if I can :)
Posted 16 years ago2007-08-25 22:31:38 UTC Post #232899
I managed to get all the code into the source and compile without error,, but theres one line that I cant figure out where it goes.

// custom items...

// AK74
UTIL_PrecacheOtherWeapon( "weapon_AK74" );
UTIL_PrecacheOther( "ammo_AK74" );

any ideas?
Posted 16 years ago2007-08-25 22:45:14 UTC Post #232901
ak74? is that a spoof of the ak47?
Posted 16 years ago2007-08-25 22:51:55 UTC Post #232903
Posted 16 years ago2007-08-25 23:00:05 UTC Post #232906
I see, I've just never heard of the 74... I guess I'm stupid. =) http://en.wikipedia.org/wiki/AK-74
You must be logged in to post a response.