Raised This Month: $ Target: $400
 0% 

Custom Weapon Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 02-16-2007 , 15:23   Custom Weapon Help
Reply With Quote #1

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?
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-16-2007 , 18:40   Re: Custom Weapon Help
Reply With Quote #2

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.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 02-16-2007 , 20:32   Re: Custom Weapon Help
Reply With Quote #3

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.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-17-2007 , 02:08   Re: Custom Weapon Help
Reply With Quote #4

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.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 02-28-2007 , 18:59   Re: Custom Weapon Help
Reply With Quote #5

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?
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 03-01-2007 , 03:40   Re: Custom Weapon Help
Reply With Quote #6

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.
__________________

Last edited by schnitzelmaker; 03-01-2007 at 03:43.
schnitzelmaker is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode