Custom Weapon Help
Hello gents,
I am creating a few custom weapons in Day of Defeat. I've done this before by hooking CurWeapon and replacing the model, etc. But what I've never had to do is use the bullets that come with that weapon. I've made a custom weapon, the mortar, but I use my own entities for what it fires. I need to use an already created weapon, and change its model and sounds. I can do the model bit fine, but the actual weapon firing sounds is what is getting to me. I've searched these forums several times for it, but I can never find a solid answer. If it is not possible, can someone tell me why? Or if it is, please tell me how? |
Re: Custom Weapon Help
Most weapon sounds are handled client-side. When someone shoots a weapon, the server plays an event. Not the register_event type, those are technically "messages." But the EngFunc_PlayBackEvent type.
If you look in the "events/" folder of your mod you will probably find a bunch of blank (or very small) .sc files, with weapon names (ie: carbine.sc). When someone shoots, the server uses PlayBackEvent for the appropiate weapon event. The client receives the event, and then does bullet holes, muzzle flashes, sounds, etcetera, depending on exactly what event it is. This way the server doesn't have to do that superficial stuff, and it saves processing. |
Re: Custom Weapon Help
Oh wonderful, thank you that worked perfect. I'm not able to block those events and thus block weapon sounds and bullet holes server sided.
My only question is whether or not there's an efficient way of blocking it server sided? I can stop firing in client data but that also stops the animations etc. Is there a specific way of preventing the event to get the the original "invoker"? ------------------------------ also, is there a way to change an argument in the forward? like with forward_return? I'd like to change the eventindex to a different event. |
Re: Custom Weapon Help
I'm pretty sure that you should be able to block the PlayBackEvent like any other forward. But, it still might not change the sounds to the player firing, since it's probably done on his client as soon as he shoots, before he even lets the server know. Or something.
------------------------------ I don't think that you can change an argument and then pass the forward along. You'd have to call the function again, with your own arguments, and then use FMRES_SUPERCEDE to stop the original forward from taking place. |
Re: Custom Weapon Help
I am able to change the sound for everyone standing around the client by using your method.
But what is still holding me back is the client's point of view - it is still the same sound and animation. I'd like to keep the same animation, but how can I alter which sound is being played? One thing I can do is block the sound/animation by altering CD_flNextAttack, which tells me that the client has to check that before playing the fire sound. This means there must be a way to alter it. I don't see a CD member that contains that kind of information, so I tried to block the fire and replicate it with my own sound. I am able to play the right animation client-sided, but the sound simply won't play. I am doing it on the FM_PlayBackEvent hook, setting the animation and executing client_cmd( "spk %s", g_szWpnSound ); But no sound plays. Why would this happen? |
Re: Custom Weapon Help
for creating custom weapons this can help a lot:http://www.nsmod.org/forums/index.php?showtopic=4679
Its an framework to create custom weapons for Natural Selection. |
| All times are GMT -4. The time now is 00:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.